/// <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);
            }
        }
Ejemplo n.º 2
0
        /// <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
                                       ));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a GetResources message to a store.
        /// </summary>
        /// <param name="context">The context information.</param>
        /// <param name="scope">The scope.</param>
        /// <param name="storeLastWriteFilter">An optional parameter to filter discovery on a date when an object last changed.</param>
        /// <param name="activeStatusFilter">if not <c>null</c>, request only objects with a matching active status.</param>
        /// <param name="includeEdges">if set to <c>true</c>, request edges.</param>
        /// <param name="countObjects">if set to <c>true</c>, request object counts.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <GetResources> GetResources(ContextInfo context, ContextScopeKind scope, DateTime?storeLastWriteFilter = null, ActiveStatusKind?activeStatusFilter = null, bool includeEdges = false, bool countObjects = false, IMessageHeaderExtension extension = null)
        {
            var body = new GetResources
            {
                Context = context,
                Scope   = scope,
                StoreLastWriteFilter = storeLastWriteFilter,
                ActiveStatusFilter   = activeStatusFilter,
                IncludeEdges         = includeEdges,
                CountObjects         = countObjects,
            };

            return(SendRequest(body, extension: extension));
        }