Пример #1
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (base.HasErrors)
            {
                return;
            }
            if (this.Identity != null)
            {
                this.Server = ServerIdParameter.Parse(this.Identity.Server);
            }
            if (this.Server == null || string.Compare(this.Server.ToString(), "localhost", true) == 0)
            {
                this.Server = new ServerIdParameter();
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(base.CurrentOrganizationId), 263, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\Queueviewer\\QueueTasks.cs");
            ServerIdParameter     server = this.Server;
            Server           entry       = (Server)this.GetDataObject <Server>(server, tenantOrTopologyConfigurationSession, null, null, Strings.ErrorServerNotFound(server.ToString()), Strings.ErrorServerNotUnique(server.ToString()));
            ADScopeException ex;

            if (!tenantOrTopologyConfigurationSession.TryVerifyIsWithinScopes(entry, true, out ex))
            {
                base.WriteError(new TaskInvalidOperationException(Strings.ErrorCannotChangeObjectOutOfWriteScope((this.Identity != null) ? this.Identity.ToString() : this.Server.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ExchangeErrorCategory.Context, this.Identity);
            }
            if (this.Filter != null && !VersionedQueueViewerClient.UsePropertyBagBasedAPI((string)this.Server))
            {
                this.InitializeInnerFilter <QueueInfoSchema>(this.Filter, ObjectSchema.GetInstance <QueueInfoSchema>());
            }
        }
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (base.Identity == null && this.Server == null)
     {
         this.Server = ServerIdParameter.Parse("localhost");
     }
     if (this.Filter != null && !VersionedQueueViewerClient.UsePropertyBagBasedAPI((string)this.Server))
     {
         this.InitializeInnerFilter <MessageInfoSchema>(this.Filter, ObjectSchema.GetInstance <MessageInfoSchema>());
     }
 }
Пример #3
0
        protected override void InternalProcessRecord()
        {
            ObjectType[] array      = null;
            int          totalCount = 0;
            int          num        = 0;

            try
            {
                int         num2        = 3;
                QueryFilter queryFilter = DateTimeConverter.ConvertQueryFilter(this.innerFilter);
                while (num2-- > 0)
                {
                    try
                    {
                        if (base.BookmarkObject != null)
                        {
                            ObjectType bookmarkObject = base.BookmarkObject;
                            bookmarkObject.ConvertDatesToUniversalTime();
                        }
                        QueueViewerInputObject queueViewerInputObject = new QueueViewerInputObject((base.BookmarkIndex <= 0) ? -1 : (base.BookmarkIndex - 1), base.BookmarkObject, base.IncludeBookmark, this.IncludeLatencyInfo.IsPresent, this.IncludeDetails.IsPresent, base.ResultSize.IsUnlimited ? int.MaxValue : base.ResultSize.Value, queryFilter, base.SearchForward, base.SortOrder);
                        using (QueueViewerClient <ObjectType> queueViewerClient = new QueueViewerClient <ObjectType>((string)this.Server))
                        {
                            if (!VersionedQueueViewerClient.UsePropertyBagBasedAPI(this.targetServer))
                            {
                                PagedDataObject bookmarkObject2 = null;
                                if (typeof(ObjectType) == typeof(ExtensibleQueueInfo))
                                {
                                    if (base.Filter != null)
                                    {
                                        this.innerFilter = new MonadFilter(base.Filter, this, ObjectSchema.GetInstance <QueueInfoSchema>()).InnerFilter;
                                    }
                                    this.InitializeInnerFilter <QueueInfo>(null, QueueInfoSchema.Identity);
                                    if (base.BookmarkObject != null)
                                    {
                                        bookmarkObject2 = new QueueInfo(base.BookmarkObject as ExtensibleQueueInfo);
                                    }
                                }
                                else
                                {
                                    if (base.Filter != null)
                                    {
                                        this.innerFilter = new MonadFilter(base.Filter, this, ObjectSchema.GetInstance <MessageInfoSchema>()).InnerFilter;
                                    }
                                    this.InitializeInnerFilter <MessageInfo>(MessageInfoSchema.Identity, MessageInfoSchema.Queue);
                                    if (base.BookmarkObject != null)
                                    {
                                        bookmarkObject2 = new MessageInfo(base.BookmarkObject as ExtensibleMessageInfo);
                                    }
                                }
                                queueViewerInputObject.QueryFilter = this.innerFilter;
                                List <SortOrderEntry> list = null;
                                if (queueViewerInputObject.SortOrder != null)
                                {
                                    list = new List <SortOrderEntry>();
                                    foreach (QueueViewerSortOrderEntry queueViewerSortOrderEntry in queueViewerInputObject.SortOrder)
                                    {
                                        list.Add(SortOrderEntry.Parse(queueViewerSortOrderEntry.ToString()));
                                    }
                                }
                                array = queueViewerClient.GetQueueViewerObjectPage(queueViewerInputObject.QueryFilter, (queueViewerInputObject.SortOrder != null) ? list.ToArray() : null, queueViewerInputObject.SearchForward, queueViewerInputObject.PageSize, bookmarkObject2, queueViewerInputObject.BookmarkIndex, queueViewerInputObject.IncludeBookmark, queueViewerInputObject.IncludeDetails, queueViewerInputObject.IncludeComponentLatencyInfo, ref totalCount, ref num);
                            }
                            else if (VersionedQueueViewerClient.UseCustomSerialization(this.targetServer))
                            {
                                array = queueViewerClient.GetPropertyBagBasedQueueViewerObjectPageCustomSerialization(queueViewerInputObject, ref totalCount, ref num);
                            }
                            else
                            {
                                array = queueViewerClient.GetPropertyBagBasedQueueViewerObjectPage(queueViewerInputObject, ref totalCount, ref num);
                            }
                            break;
                        }
                    }
                    catch (RpcException ex)
                    {
                        if ((ex.ErrorCode != 1753 && ex.ErrorCode != 1727) || num2 == 0)
                        {
                            throw;
                        }
                    }
                }
                if (base.ReturnPageInfo)
                {
                    base.WriteObject(new PagedPositionInfo(num + 1, totalCount));
                }
                DateTimeConverter.ConvertResultSet <ObjectType>(array);
                foreach (ObjectType dataObject in array)
                {
                    base.WriteResult(dataObject);
                }
            }
            catch (ParsingNonFilterablePropertyException ex2)
            {
                base.WriteError(ex2, ErrorCategory.InvalidArgument, ex2.PropertyName);
            }
            catch (QueueViewerException ex3)
            {
                base.WriteError(ErrorMapper.GetLocalizedException(ex3.ErrorCode, null, this.Server), ErrorCategory.InvalidOperation, null);
            }
            catch (RpcException ex4)
            {
                base.WriteError(ErrorMapper.GetLocalizedException(ex4.ErrorCode, null, this.Server), ErrorCategory.InvalidOperation, null);
            }
        }