Exemplo n.º 1
0
		public System.Collections.Generic.IEnumerable<NativeCimClass> QueryClasses (NativeDestinationOptions options, string namespaceName, string queryDialect, string queryExpression)
		{
			var context = new EnumerationContext(CimNamespaces.CimNamespace, new Filter(queryDialect, new CimEnumerationFilter { Namespace = namespaceName, Filter = queryExpression }), new Selector[0]);
			foreach (EndpointAddress address in _handler.Enumerate (context)) {
				yield return CimEnumerationHelper.CreateClass (address);
			}
		}
Exemplo n.º 2
0
      private EnumerateResponse HandleOptimizedEnumerate(EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
      {
         int maxElements = request.MaxElements != null 
                              ? request.MaxElements.Value 
                              : 1;

         if (request.EnumerationMode == EnumerationMode.EnumerateEPR)
         {
            IEnumerator<object> enumerator = GetHandler(request.Filter).Enumerate(context).GetEnumerator();

            bool endOfSequence;
            EnumerationItemList items = new EnumerationItemList(PullItems(maxElements, request.EnumerationMode,enumerator, out endOfSequence));
            if (!endOfSequence)
            {
               _activeEnumerations[contextKey] = new EnumerationState(enumerator, request.EnumerationMode);
            }
            return new EnumerateResponse
                      {
                         Items = items,
                         EndOfSequence = endOfSequence ? new EndOfSequence() : null,
                         EnumerationContext = endOfSequence ? null : contextKey
                      };
         }
         throw new NotSupportedException();
      }
Exemplo n.º 3
0
      public EnumerateResponse Enumerate(EnumerateRequest request)
      {         
         EnumerationContextKey contextKey = EnumerationContextKey.Unique();         
         EnumerationContext context = new EnumerationContext(contextKey.Text, request.Filter, SelectorSetHeader.GetCurrent());
         if (RequestTotalItemsCountEstimate.IsPresent)
         {
            HandleCountEnumerate(contextKey.Text, request.Filter);
            return new EnumerateResponse
            {
               EnumerationContext = contextKey
            };
         }
         if (request.OptimizeEnumeration != null)
         {
            return HandleOptimizedEnumerate(contextKey, request, context);
         }         

         IEnumerator<object> enumerator = GetHandler(request.Filter).Enumerate(context).GetEnumerator();
         _activeEnumerations[contextKey] = new EnumerationState(enumerator, request.EnumerationMode);
         return new EnumerateResponse
                   {
                      EnumerationContext = contextKey,
                      Expires = request.Expires
                   };
      }
Exemplo n.º 4
0
        public EnumerateResponse Enumerate(EnumerateRequest request)
        {
            EnumerationContextKey contextKey = EnumerationContextKey.Unique();
            EnumerationContext    context    = new EnumerationContext(contextKey.Text, request.Filter, SelectorSetHeader.GetCurrent());

            if (RequestTotalItemsCountEstimate.IsPresent)
            {
                HandleCountEnumerate(contextKey.Text, request.Filter);
                return(new EnumerateResponse
                {
                    EnumerationContext = contextKey
                });
            }
            if (request.OptimizeEnumeration != null)
            {
                return(HandleOptimizedEnumerate(contextKey, request, context));
            }

            IEnumerator <object> enumerator = GetHandler(request.Filter).Enumerate(context).GetEnumerator();

            _activeEnumerations[contextKey] = new EnumerationState(enumerator, request.EnumerationMode);
            return(new EnumerateResponse
            {
                EnumerationContext = contextKey,
                Expires = request.Expires
            });
        }
Exemplo n.º 5
0
        private EnumerateResponse HandleOptimizedEnumerate(EnumerationContextKey contextKey, EnumerateRequest request, EnumerationContext context)
        {
            int maxElements = request.MaxElements != null
                              ? request.MaxElements.Value
                              : 1;

            if (request.EnumerationMode == EnumerationMode.EnumerateEPR)
            {
                IEnumerator <object> enumerator = GetHandler(request.Filter).Enumerate(context).GetEnumerator();

                bool endOfSequence;
                EnumerationItemList items = new EnumerationItemList(PullItems(maxElements, request.EnumerationMode, enumerator, out endOfSequence));
                if (!endOfSequence)
                {
                    _activeEnumerations[contextKey] = new EnumerationState(enumerator, request.EnumerationMode);
                }
                return(new EnumerateResponse
                {
                    Items = items,
                    EndOfSequence = endOfSequence ? new EndOfSequence() : null,
                    EnumerationContext = endOfSequence ? null : contextKey
                });
            }
            throw new NotSupportedException();
        }