Пример #1
0
 public void Save(IConfigurable instance)
 {
     using (HostRpcClient hostRpcClient = new HostRpcClient(this.serverFqdn))
     {
         hostRpcClient.SetDarTask((TaskStoreObject)instance);
     }
 }
Пример #2
0
 public IEnumerable <T> FindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) where T : IConfigurable, new()
 {
     using (HostRpcClient client = new HostRpcClient(this.serverFqdn))
     {
         foreach (TaskStoreObject task in client.GetDarTask(this.darParams))
         {
             yield return((T)((object)task));
         }
     }
     yield break;
 }
Пример #3
0
        protected override void InternalProcessRecord()
        {
            base.WriteObject("Sending no op task");
            OrganizationId organizationId = (this.TenantId != null) ? GetDarTask.ResolveOrganizationId(this.TenantId) : OrganizationId.ForestWideOrgId;
            string         fqdn           = GetDarTask.ResolveServerId(base.CurrentOrganizationId).Fqdn;

            using (HostRpcClient hostRpcClient = new HostRpcClient(fqdn))
            {
                string          text    = Guid.NewGuid().ToString();
                TaskStoreObject darTask = new TaskStoreObject
                {
                    Id       = text,
                    TaskType = "Common.NoOp",
                    TenantId = organizationId.GetBytes(Encoding.UTF8)
                };
                hostRpcClient.SetDarTask(darTask);
                base.WriteObject("Task enqueued, waiting for completed status. ID:" + text);
                for (int i = 0; i < this.Retries; i++)
                {
                    TaskStoreObject[] darTask2 = hostRpcClient.GetDarTask(new DarTaskParams
                    {
                        TaskId = text
                    });
                    if (darTask2.Length > 1)
                    {
                        base.WriteError(new Exception("Unexected number of tasks returned by GetDarTask"), ErrorCategory.InvalidResult, darTask2.Length);
                        return;
                    }
                    if (darTask2.Length == 1)
                    {
                        base.WriteObject("Task state: " + darTask2[0].TaskState);
                        if (darTask2[0].TaskState == DarTaskState.Completed)
                        {
                            return;
                        }
                    }
                    else
                    {
                        base.WriteObject("No tasks found");
                    }
                    Thread.Sleep(1000);
                }
            }
            base.WriteError(new Exception("Operation timeout"), ErrorCategory.OperationTimeout, null);
        }
        protected override void InternalProcessRecord()
        {
            if (this.TenantId != null)
            {
                base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId);
            }
            string fqdn = GetDarTask.ResolveServerId(base.CurrentOrganizationId).Fqdn;
            DarTaskAggregateParams darTaskAggregateParams = new DarTaskAggregateParams
            {
                TenantId = base.CurrentOrganizationId.GetBytes(Encoding.UTF8),
                TaskType = this.TaskType
            };

            using (HostRpcClient hostRpcClient = new HostRpcClient(fqdn))
            {
                hostRpcClient.RemoveDarTaskAggregate(darTaskAggregateParams);
            }
        }
Пример #5
0
 protected override void InternalProcessRecord()
 {
     if (this.TenantId != null)
     {
         try
         {
             base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId);
         }
         catch (ArgumentException exception)
         {
             base.WriteError(exception, ErrorCategory.InvalidArgument, this.TenantId);
             return;
         }
         base.WriteObject(string.Format(Strings.ResolvedOrg, base.CurrentOrganizationId));
         this.ExecutionUnit = GetDarTask.ResolveServerId(base.CurrentOrganizationId);
         base.WriteObject(string.Format(Strings.ResolvedServer, this.ExecutionUnit));
     }
     try
     {
         using (HostRpcClient hostRpcClient = new HostRpcClient(this.ExecutionUnit.Fqdn))
         {
             string darInfo = hostRpcClient.GetDarInfo();
             if (!string.IsNullOrEmpty(darInfo))
             {
                 foreach (string sendToPipeline in darInfo.Split(new char[]
                 {
                     '\n'
                 }))
                 {
                     base.WriteObject(sendToPipeline);
                 }
             }
         }
     }
     catch (ServerUnavailableException exception2)
     {
         base.WriteError(exception2, ErrorCategory.ConnectionError, this.ExecutionUnit.Fqdn);
     }
 }
Пример #6
0
 public IConfigurable Read <T>(ObjectId identity) where T : IConfigurable, new()
 {
     if (identity == null)
     {
         throw new ArgumentNullException("identity");
     }
     using (HostRpcClient hostRpcClient = new HostRpcClient(this.serverFqdn))
     {
         DarTaskParams darTaskParams = new DarTaskParams
         {
             TaskId   = this.darParams.TaskId,
             TenantId = this.darParams.TenantId
         };
         TaskStoreObject[] darTask = hostRpcClient.GetDarTask(darTaskParams);
         int num = 0;
         if (num < darTask.Length)
         {
             TaskStoreObject taskStoreObject = darTask[num];
             return((T)((object)taskStoreObject));
         }
     }
     return(null);
 }