Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SubscribeResponseMessage"/> class with the supplied content.
        /// </summary>
        /// <remarks>
        /// Generally used as a convienence method to quickly create a response message with a body containing the provided
        /// <paramref name="subscriptionManager"/> and <paramref name="expires"/> information.
        /// </remarks>
        /// <param name="subscriptionManager">The <see cref="SubscriptionManager"/> this response message will return to the subscriber.</param>
        /// <param name="expires">The <see cref="Expires"/> information for the new subscription.</param>
        public SubscribeResponseMessage(SubscriptionManager subscriptionManager, Expires expires)
        {
            Contract.Requires <ArgumentNullException>(subscriptionManager != null, "subscriptionManager");
            Contract.Requires <ArgumentNullException>(expires != null, "expires");

            this.body = new SubscribeResponseMessageBody(subscriptionManager, expires);
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SubscribeResponseMessageBody"/> class with the supplied values.
        /// </summary>
        /// <param name="subscriptionManager">The <see cref="WsEventing.SubscriptionManager"/> instance to return.</param>
        /// <param name="expires">The <see cref="WsEventing.Expires"/> instance to return to the client. This value is optional.</param>
        public SubscribeResponseMessageBody(SubscriptionManager subscriptionManager, Expires expires)
        {
            Contract.Requires <ArgumentNullException>(subscriptionManager != null, "subscriptionManager");

            this.manager = subscriptionManager;
            this.expires = expires;
        }
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.ReadStartElement("GetStatusResponse", Constants.WsEventing.Namespace);

            if (reader.IsStartElement("Expires", Constants.WsEventing.Namespace))
            {
                this.Expires = new Expires(reader);
            }

            reader.ReadEndElement();
        }
Exemple #4
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized. </param>
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (reader.IsStartElement("SubscribeResponse", Constants.WsEventing.Namespace) == false)
            {
                throw new XmlException("Invalid Element, it must be 'SubscribeResponse'");
            }

            reader.ReadStartElement("SubscribeResponse", Constants.WsEventing.Namespace);
            this.SubscriptionManager = new SubscriptionManager(reader);
            this.Expires             = new Expires(reader);
            reader.ReadEndElement();
        }
Exemple #5
0
        /// <summary>
        /// Adds an <see cref="XmlSchema"/> instance for this type to the supplied <see cref="XmlSchemaSet"/>.
        /// </summary>
        /// <param name="xs">The <see cref="XmlSchemaSet"/> to add an <see cref="XmlSchema"/> to.</param>
        /// <returns>An <see cref="XmlQualifiedName"/> for the current object.</returns>
        public static XmlQualifiedName AcquireSchema(XmlSchemaSet xs)
        {
            if (xs == null)
            {
                throw new ArgumentNullException("xs");
            }

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CommonContracts.WsEventing.Subscribe.xsd"))
            {
                Debug.Assert(stream != null, "Resource Stream 'CommonContracts.WsEventing.Subscribe.xsd' was not able to be opened");

                var schema = XmlSchema.Read(stream, null);

                var imports = new XmlSchemaSet();
                Delivery.AcquireSchema(imports);
                Expires.AcquireSchema(imports);

                foreach (var includeSchema in imports.Schemas().Cast <XmlSchema>())
                {
                    if (includeSchema.TargetNamespace == Constants.WsEventing.Namespace)
                    {
                        XmlSchemaInclude include = new XmlSchemaInclude();
                        include.Schema = includeSchema;
                        schema.Includes.Add(include);
                    }
                }

                xs.Add(schema);
            }

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CommonContracts.WsEventing.WsAddressing.xsd"))
            {
                Debug.Assert(stream != null, "Resource Stream 'CommonContracts.WsEventing.WsAddressing.xsd' was not able to be opened");

                var schema = XmlSchema.Read(stream, null);
                xs.Add(schema);
            }


            return(new XmlQualifiedName("SubscribeType", Constants.WsEventing.Namespace));
        }
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.ReadStartElement("Renew", Constants.WsEventing.Namespace);
            reader.Read();

            if (reader.IsStartElement("Expires", Constants.WsEventing.Namespace))
            {
                this.Expires = new Expires(reader);
            }

            if (reader.LocalName == "Expires")
            {
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
        }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RenewRequestMessage"/> class.
        /// </summary>
        /// <remarks>
        /// This overload will create the default <see cref="RenewRequestMessageBody"/> type and use to the supplied <paramref name="expires"/>
        /// information to the event source (which MAY be honored) to be applied to the subscription.
        /// </remarks>
        /// <param name="identifier">The <see cref="Identifier"/> containing the subscription information.</param>
        /// <param name="expires">The <see cref="Expires"/> containing the time when the subscription would like expiration, as requested by the subscriber.</param>
        public RenewRequestMessage(Identifier identifier, Expires expires) : this(identifier)
        {
            Contract.Requires <ArgumentNullException>(expires != null, "expires");

            this.body = new RenewRequestMessageBody(expires);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RenewResponseMessage"/> with the supplied <paramref name="body"/> value.
        /// </summary>
        /// <param name="expires">The <see cref="Expires"/> containing the details of the new subscription expiration.</param>
        public RenewResponseMessage(Expires expires)
        {
            Contract.Requires <ArgumentNullException>(expires != null, "expires");

            this.body = new RenewResponseMessageBody(expires);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GetStatusResponseMessageBody"/> class with the supplied <paramref name="expires"/> value.
        /// </summary>
        /// <remarks>This constructor is used if the subscription is valid and has not expired.</remarks>
        /// <param name="expires">An <see cref="Expires"/> instance indicating the status of the subscription indicated in a <see cref="GetStatusResponseMessage"/>.</param>
        public GetStatusResponseMessageBody(Expires expires)
        {
            Contract.Requires <ArgumentNullException>(expires != null, "expires");

            this.expires = expires;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RenewRequestMessageBody"/> class with the indicated <see cref="WsEventing.Expires">expiration</see>.
        /// </summary>
        /// <param name="expires">The <see cref="WsEventing.Expires"/> value containing the details of the requested new expiration for the subscription.</param>
        public RenewRequestMessageBody(Expires expires)
        {
            Contract.Requires <ArgumentNullException>(expires != null, "expires");

            this.expires = expires;
        }