Esempio n. 1
0
        /// <summary>
        /// Sends a GetObject 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 <GetObject> GetObject(string uri)
        {
            var body = new GetObject()
            {
                Uri = uri ?? string.Empty,
            };

            return(SendRequest(body, isMultiPart: true, isFinalPart: true));
        }
Esempio n. 2
0
        /// <summary>
        /// Sends a GetObject message to a store.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="messageFlag">The message flag.</param>
        /// <returns>The message identifier.</returns>
        public virtual long GetObject(string uri, MessageFlags messageFlag = MessageFlags.MultiPartAndFinalPart)
        {
            var header = CreateMessageHeader(Protocols.Store, MessageTypes.Store.GetObject, messageFlags: messageFlag);

            var getObject = new GetObject()
            {
                Uri = uri
            };

            return(Session.SendMessage(header, getObject));
        }
        /// <summary>
        /// Handles the GetObject message from a customer.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="getObject">The GetObject message.</param>
        protected virtual void HandleGetObject(IMessageHeader header, GetObject getObject)
        {
            var args = Notify(OnGetObject, header, getObject, new DataObject());

            HandleGetObject(args);

            if (args.Cancel)
            {
                return;
            }

            if (args.Context.Data == null || args.Context.Data.Length == 0)
            {
                Object(args.Context, header.MessageId, MessageFlags.NoData);
            }
            else
            {
                Object(args.Context, header.MessageId);
            }
        }