コード例 #1
0
ファイル: AdamInstance.cs プロジェクト: modulexcite/pash-1
        public static AdamInstanceCollection FindAll(DirectoryContext context, string partitionName)
        {
            AdamInstanceCollection adamInstanceCollection;

            if (context != null)
            {
                if (context.ContextType == DirectoryContextType.ConfigurationSet)
                {
                    if (partitionName != null)
                    {
                        if (partitionName.Length != 0)
                        {
                            context = new DirectoryContext(context);
                            try
                            {
                                adamInstanceCollection = ConfigurationSet.FindAdamInstances(context, partitionName, null);
                            }
                            catch (ActiveDirectoryObjectNotFoundException activeDirectoryObjectNotFoundException)
                            {
                                adamInstanceCollection = new AdamInstanceCollection(new ArrayList());
                            }
                            return(adamInstanceCollection);
                        }
                        else
                        {
                            throw new ArgumentException(Res.GetString("EmptyStringParameter"), "partitionName");
                        }
                    }
                    else
                    {
                        throw new ArgumentNullException("partitionName");
                    }
                }
                else
                {
                    throw new ArgumentException(Res.GetString("TargetShouldBeConfigSet"), "context");
                }
            }
            else
            {
                throw new ArgumentNullException("context");
            }
        }
コード例 #2
0
        public ReadOnlyDirectoryServerCollection FindAllDirectoryServers(string siteName)
        {
            base.CheckIfDisposed();
            if (siteName == null)
            {
                throw new ArgumentNullException("siteName");
            }
            if (this.appType == ApplicationPartitionType.ADApplicationPartition)
            {
                return(this.FindAllDirectoryServersInternal(siteName));
            }
            if (!this.committed)
            {
                throw new InvalidOperationException(Res.GetString("CannotPerformOperationOnUncommittedObject"));
            }
            ReadOnlyDirectoryServerCollection servers = new ReadOnlyDirectoryServerCollection();

            servers.AddRange(ConfigurationSet.FindAdamInstances(base.context, base.Name, siteName));
            return(servers);
        }
コード例 #3
0
        public static AdamInstanceCollection FindAll(DirectoryContext context, string partitionName)
        {
            AdamInstanceCollection adamInstanceCollection = null;

            // validate parameters (partitionName validated by the call to ConfigSet)
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            // contexttype should be ConfigurationSet
            if (context.ContextType != DirectoryContextType.ConfigurationSet)
            {
                throw new ArgumentException(SR.TargetShouldBeConfigSet, nameof(context));
            }

            if (partitionName == null)
            {
                throw new ArgumentNullException(nameof(partitionName));
            }

            if (partitionName.Length == 0)
            {
                throw new ArgumentException(SR.EmptyStringParameter, nameof(partitionName));
            }

            //  work with copy of the context
            context = new DirectoryContext(context);

            try
            {
                adamInstanceCollection = ConfigurationSet.FindAdamInstances(context, partitionName, null);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                // this is the case where  we could not find an ADAM instance in that config set (return empty collection)
                adamInstanceCollection = new AdamInstanceCollection(new ArrayList());
            }

            return(adamInstanceCollection);
        }
コード例 #4
0
 public AdamInstanceCollection FindAllAdamInstances()
 {
     this.CheckIfDisposed();
     return(ConfigurationSet.FindAdamInstances(this.context, null, null));
 }