private OutgoingMessage HandleNormalEnumerate(IncomingMessage requestMessage, EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
        {
            var responseMessage = CreateEnumerateResponse();
            var enumerator = GetEnumerator(request, requestMessage, context, responseMessage);

            OnEnumerationStarted(context.Context, enumerator, request.EnumerationMode);

            responseMessage.SetBody(
                new SerializerBodyWriter(new EnumerateResponse
                                             {
                                                 EnumerationContext = contextKey,
                                                 Expires = request.Expires
                                             }));
            return responseMessage;
        }
Example #2
0
 private IEnumerator <object> GetEnumerator(EnumerateRequest request, IncomingMessage requestMessage, EnumerationContext context, OutgoingMessage responseMessage)
 {
     return(GetHandler(request.Filter)
            .Enumerate(context, requestMessage, responseMessage)
            .GetEnumerator());
 }
Example #3
0
        private OutgoingMessage HandleNormalEnumerate(IncomingMessage requestMessage, EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
        {
            var responseMessage = CreateEnumerateResponse();
            var enumerator      = GetEnumerator(request, requestMessage, context, responseMessage);

            OnEnumerationStarted(context.Context, enumerator, request.EnumerationMode);

            responseMessage.SetBody(
                new SerializerBodyWriter(new EnumerateResponse
            {
                EnumerationContext = contextKey,
                Expires            = request.Expires
            }));
            return(responseMessage);
        }
Example #4
0
        private OutgoingMessage HandleOptimizedEnumerate(IncomingMessage requestMessage, EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
        {
            var responseMessage = CreateEnumerateResponse();
            var maxElements     = CalculateMaxElements(request.MaxElements);

            if (request.EnumerationMode == EnumerationMode.EnumerateEPR)
            {
                var  enumerator = GetEnumerator(request, requestMessage, context, responseMessage);
                bool endOfSequence;
                var  items = enumerator.Take(maxElements, out endOfSequence);
                if (!endOfSequence)
                {
                    OnEnumerationStarted(context.Context, enumerator, request.EnumerationMode);
                }
                responseMessage.SetBody(new SerializerBodyWriter(
                                            new EnumerateResponse
                {
                    Items              = new EnumerationItemList(items, request.EnumerationMode),
                    EndOfSequence      = endOfSequence ? new EndOfSequence() : null,
                    EnumerationContext = endOfSequence ? null : contextKey
                }));
                return(responseMessage);
            }
            throw new NotSupportedException();
        }
Example #5
0
        private OutgoingMessage HandleCountEnumerate(IncomingMessage requestMessage, EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
        {
            var responseMessage = CreateEnumerateResponse();
            int count           = GetHandler(request.Filter)
                                  .EstimateRemainingItemsCount(context, requestMessage, responseMessage);

            responseMessage.AddHeader(new TotalItemsCountEstimateHeader(count), false);
            responseMessage.SetBody(new SerializerBodyWriter(new EnumerateResponse
            {
                EnumerationContext = contextKey
            }));
            return(responseMessage);
        }
 private IEnumerator<object> GetEnumerator(EnumerateRequest request, IncomingMessage requestMessage, EnumerationContext context, OutgoingMessage responseMessage)
 {
     return GetHandler(request.Filter)
         .Enumerate(context, requestMessage, responseMessage)
         .GetEnumerator();
 }
 private OutgoingMessage HandleOptimizedEnumerate(IncomingMessage requestMessage, EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
 {
     var responseMessage = CreateEnumerateResponse();
     var maxElements = CalculateMaxElements(request.MaxElements);
     if (request.EnumerationMode == EnumerationMode.EnumerateEPR)
     {
         var enumerator = GetEnumerator(request, requestMessage, context, responseMessage);
         bool endOfSequence;
         var items = enumerator.Take(maxElements, out endOfSequence);
         if (!endOfSequence)
         {
             OnEnumerationStarted(context.Context, enumerator, request.EnumerationMode);
         }
         responseMessage.SetBody(new SerializerBodyWriter(
                              new EnumerateResponse
                                  {
                                      Items = new EnumerationItemList(items, request.EnumerationMode),
                                      EndOfSequence = endOfSequence ? new EndOfSequence() : null,
                                      EnumerationContext = endOfSequence ? null : contextKey
                                  }));
         return responseMessage;
     }
     throw new NotSupportedException();
 }                     
        private OutgoingMessage HandleCountEnumerate(IncomingMessage requestMessage, EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
        {
            var responseMessage = CreateEnumerateResponse();
            int count = GetHandler(request.Filter)
                .EstimateRemainingItemsCount(context, requestMessage, responseMessage);

            responseMessage.AddHeader(new TotalItemsCountEstimateHeader(count), false);
            responseMessage.SetBody(new SerializerBodyWriter(new EnumerateResponse
                                                          {
                                                              EnumerationContext = contextKey
                                                          }));
            return responseMessage;
        }