Exemplo n.º 1
0
        /// <summary>
        /// Sends a GetResources message to a store.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <GetResources> GetResources(string uri)
        {
            var body = new GetResources()
            {
                Uri = uri ?? string.Empty,
            };

            return(SendRequest(body));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the GetResources message from a customer.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="getResources">The GetResources message.</param>
        protected virtual void HandleGetResources(IMessageHeader header, GetResources getResources)
        {
            var args = Notify(OnGetResources, header, getResources, new List <Resource>());

            HandleGetResources(args);

            if (!args.Cancel)
            {
                GetResourcesResponse(header, args.Context);
            }
        }
        /// <summary>
        /// Sends a GetResources message to a store.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns>The message identifier.</returns>
        public virtual long GetResources(string uri)
        {
            var header = CreateMessageHeader(Protocols.Discovery, MessageTypes.Discovery.GetResources);

            var getResources = new GetResources()
            {
                Uri = uri
            };

            return(Session.SendMessage(header, getResources,
                                       h => _requests[h.MessageId] = uri // Cache requested URIs by message ID
                                       ));
        }