Example #1
0
 // Token: 0x060011C2 RID: 4546 RVA: 0x00036980 File Offset: 0x00034B80
 public static void ProvisionDefaultProperties(Task task, IConfigurable temporaryObject, IConfigurable dataObject, bool checkProvisioningLayerAvailability)
 {
     using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, "ProvisioningLayerLatency", "ProvisionDefaultProperties", LoggerHelper.CmdletPerfMonitors))
     {
         ProvisioningLayer.ProvisionDefaultPropertiesImpl(task, temporaryObject, dataObject, checkProvisioningLayerAvailability);
     }
 }
Example #2
0
 // Token: 0x060011BE RID: 4542 RVA: 0x000367A4 File Offset: 0x000349A4
 public static void SetUserScope(Task task)
 {
     using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, "ProvisioningLayerLatency", "SetUserScope", LoggerHelper.CmdletPerfMonitors))
     {
         ProvisioningLayer.SetUserScopeImpl(task);
     }
 }
 public static ProvisioningHandler[] GetProvisioningHandlers(Task task)
 {
     ProvisioningHandler[] provisioningHandlersImpl;
     using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, "ProvisioningLayerLatency", "GetProvisioningHandlers", LoggerHelper.CmdletPerfMonitors))
     {
         provisioningHandlersImpl = ProvisioningLayer.GetProvisioningHandlersImpl(task);
     }
     return(provisioningHandlersImpl);
 }
 public static ProvisioningValidationError[] ValidateUserScope(Task task)
 {
     ProvisioningValidationError[] result;
     using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, "ProvisioningLayerLatency", "ValidateUserScope", LoggerHelper.CmdletPerfMonitors))
     {
         result = ProvisioningLayer.ValidateUserScopeImpl(task);
     }
     return(result);
 }
        private static void ProvisionDefaultPropertiesImpl(Task task, IConfigurable temporaryObject, IConfigurable dataObject, bool checkProvisioningLayerAvailability)
        {
            if (checkProvisioningLayerAvailability && (ProvisioningLayer.Disabled || !task.IsProvisioningLayerAvailable))
            {
                return;
            }
            ADObject adobject = dataObject as ADObject;
            HashSet <PropertyDefinition> hashSet = null;

            for (int i = 0; i < task.ProvisioningHandlers.Length; i++)
            {
                IConfigurable configurable = null;
                using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, task.ProvisioningHandlers[i].AgentName, "ProvisionDefaultProperties", LoggerHelper.CmdletPerfMonitors))
                {
                    configurable = task.ProvisioningHandlers[i].ProvisionDefaultProperties(temporaryObject);
                }
                task.WriteVerbose(Strings.ProvisionDefaultProperties(i));
                if (configurable != null)
                {
                    if (hashSet == null)
                    {
                        hashSet = ProvisioningLayer.LoadPrefilledProperties(dataObject as ADObject);
                    }
                    ADObject adobject2 = configurable as ADObject;
                    if (adobject2 != null && adobject != null)
                    {
                        foreach (object obj in adobject2.propertyBag.Keys)
                        {
                            PropertyDefinition         propertyDefinition         = (PropertyDefinition)obj;
                            ProviderPropertyDefinition providerPropertyDefinition = propertyDefinition as ProviderPropertyDefinition;
                            if (providerPropertyDefinition != null && !hashSet.Contains(providerPropertyDefinition))
                            {
                                if (ProvisioningLayer.IsPropertyPrefilled(adobject.propertyBag, providerPropertyDefinition))
                                {
                                    throw new ProvisioningException(Strings.PropertyIsAlreadyProvisioned(propertyDefinition.Name, i));
                                }
                                if (task.IsVerboseOn)
                                {
                                    task.WriteVerbose(Strings.PropertyProvisioned(i, propertyDefinition.Name, (adobject2[propertyDefinition] ?? "<null>").ToString()));
                                }
                            }
                        }
                    }
                    dataObject.CopyChangesFrom(configurable);
                    temporaryObject.CopyChangesFrom(configurable);
                }
            }
        }
        private static void EndProcessingImpl(Task task)
        {
            Dictionary <int, Exception> dictionary = null;

            if (ProvisioningLayer.Disabled || !task.IsProvisioningLayerAvailable)
            {
                return;
            }
            for (int i = 0; i < task.ProvisioningHandlers.Length; i++)
            {
                using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, task.ProvisioningHandlers[i].AgentName, "Dispose", LoggerHelper.CmdletPerfMonitors))
                {
                    try
                    {
                        IDisposable disposable = task.ProvisioningHandlers[i] as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ProvisioningLayer.IsUnsafeException(ex))
                        {
                            throw;
                        }
                        if (dictionary == null)
                        {
                            dictionary = new Dictionary <int, Exception>();
                        }
                        dictionary.Add(i, ex);
                    }
                }
            }
            if (dictionary != null)
            {
                foreach (int key in dictionary.Keys)
                {
                    task.WriteWarning(dictionary[key].ToString());
                }
            }
        }
        private static void OnCompleteImpl(Task task, bool succeeded, Exception exception)
        {
            Dictionary <int, Exception> dictionary = null;

            if (ProvisioningLayer.Disabled || !task.IsProvisioningLayerAvailable)
            {
                return;
            }
            for (int i = 0; i < task.ProvisioningHandlers.Length; i++)
            {
                try
                {
                    using (new CmdletMonitoredScope(task.CurrentTaskContext.UniqueId, task.ProvisioningHandlers[i].AgentName, "OnComplete", LoggerHelper.CmdletPerfMonitors))
                    {
                        task.ProvisioningHandlers[i].OnComplete(succeeded, exception);
                    }
                }
                catch (Exception ex)
                {
                    if (ProvisioningLayer.IsUnsafeException(ex))
                    {
                        throw;
                    }
                    if (dictionary == null)
                    {
                        dictionary = new Dictionary <int, Exception>();
                    }
                    dictionary.Add(i, ex);
                }
            }
            if (dictionary != null)
            {
                foreach (int num in dictionary.Keys)
                {
                    task.WriteWarning(Strings.HandlerThronwExceptionInOnComplete(num, dictionary[num].ToString()));
                }
            }
        }