Ejemplo n.º 1
0
        internal override IADOPathNode BuildSearchFilter(IADOPathNode filter)
        {
            MappingTable <AttributeConverterEntry> item         = ADNtdsSiteSettingFactory <ADNtdsSiteSetting> .AttributeTable[base.ConnectedStore];
            MappingTable <AttributeConverterEntry> mappingTable = ADReplicationSiteFactory <T> .AttributeTable[base.ConnectedStore];

            return(ADTopologyUtil.BuildSearchFilter(filter, mappingTable, item, base.CmdletSessionInfo));
        }
Ejemplo n.º 2
0
 internal override T GetExtendedObjectFromIdentity(T identityObj, string identityQueryPath, ICollection <string> propertiesToFetch, bool showDeleted)
 {
     if (base.CmdletSessionInfo != null)
     {
         MappingTable <AttributeConverterEntry> item         = ADNtdsSiteSettingFactory <ADNtdsSiteSetting> .AttributeTable[base.ConnectedStore];
         MappingTable <AttributeConverterEntry> mappingTable = ADReplicationSiteFactory <T> .AttributeTable[base.ConnectedStore];
         ICollection <string> parentAttributes = ADTopologyUtil.GetParentAttributes(mappingTable, item, propertiesToFetch);
         ICollection <string> childAttributes  = ADTopologyUtil.GetChildAttributes(mappingTable, item, propertiesToFetch);
         T      extendedObjectFromIdentity     = base.GetExtendedObjectFromIdentity(identityObj, identityQueryPath, parentAttributes, showDeleted);
         string str = ADPathModule.MakePath(extendedObjectFromIdentity.DistinguishedName, "CN=NTDS Site Settings,", ADPathFormat.X500);
         try
         {
             ADTopologyUtil.ConstructAggregateObject <ADNtdsSiteSettingFactory <ADNtdsSiteSetting>, ADNtdsSiteSetting>(str, extendedObjectFromIdentity, identityQueryPath, childAttributes, showDeleted, base.CmdletSessionInfo);
         }
         catch (ADIdentityNotFoundException aDIdentityNotFoundException)
         {
             DebugLogger.LogInfo(this._debugCategory, string.Format("ADReplicationSiteFactory: Ntds-Site-Setting object not found for the site {0}, while constructing ADReplicationSite", extendedObjectFromIdentity.DistinguishedName));
         }
         return(extendedObjectFromIdentity);
     }
     else
     {
         throw new ArgumentNullException(StringResources.SessionRequired);
     }
 }
Ejemplo n.º 3
0
        protected internal override string GetDefaultCreationPathBase()
        {
            ADInterSiteTransportProtocolType value = ADInterSiteTransportProtocolType.IP;

            if (this._cmdletParameters["InterSiteTransportProtocol"] != null)
            {
                ADInterSiteTransportProtocolType?interSiteTransportProtocol = this._cmdletParameters.InterSiteTransportProtocol;
                value = interSiteTransportProtocol.Value;
            }
            return(ADTopologyUtil.CreateISTPPath(value, this.GetRootDSE().ConfigurationNamingContext));
        }
Ejemplo n.º 4
0
 private bool ADReplicationSitePreCommitFSRoutine(ADFactory <T> .DirectoryOperation operation, T instance, ADParameterSet parameters, ADObject directoryObj)
 {
     if (ADFactory <T> .DirectoryOperation.Update == operation || operation == ADFactory <T> .DirectoryOperation.Create)
     {
         MappingTable <AttributeConverterEntry> item         = ADNtdsSiteSettingFactory <ADNtdsSiteSetting> .AttributeTable[base.ConnectedStore];
         MappingTable <AttributeConverterEntry> mappingTable = ADReplicationSiteFactory <T> .AttributeTable[base.ConnectedStore];
         ADTopologyUtil.RemoveChildObjectAttributes(directoryObj, mappingTable, item);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
        internal static IEnumerable <O> RemoveExtraPropertiesFromADAggregateObject <O>(MappingTable <AttributeConverterEntry> attrMapBaseObj, MappingTable <AttributeConverterEntry> attrMapChildObj, ICollection <string> propertiesToFetch, IEnumerable <O> aggregateObjectList)
            where O : ADEntity, new()
        {
            List <string> strs = null;

            if (propertiesToFetch == null || !propertiesToFetch.Contains("*"))
            {
                IEnumerable <string> defaultPropertyFromMappingTable  = ADTopologyUtil.GetDefaultPropertyFromMappingTable(attrMapBaseObj);
                IEnumerable <string> defaultPropertyFromMappingTable1 = ADTopologyUtil.GetDefaultPropertyFromMappingTable(attrMapChildObj);
                HashSet <string>     strs1 = new HashSet <string>(defaultPropertyFromMappingTable, StringComparer.OrdinalIgnoreCase);
                strs1.UnionWith(defaultPropertyFromMappingTable1);
                if (propertiesToFetch != null)
                {
                    strs1.UnionWith(propertiesToFetch);
                }
                foreach (O o in aggregateObjectList)
                {
                    o.TrackChanges = false;
                    strs           = new List <string>();
                    foreach (string propertyName in o.PropertyNames)
                    {
                        if (strs1.Contains(propertyName))
                        {
                            continue;
                        }
                        strs.Add(propertyName);
                    }
                    List <string> .Enumerator enumerator = strs.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            string str = enumerator.Current;
                            o.Remove(str);
                        }
                    }
                    finally
                    {
                        enumerator.Dispose();
                    }
                    o.TrackChanges = true;
                }
                return(aggregateObjectList);
            }
            else
            {
                return(aggregateObjectList);
            }
        }
Ejemplo n.º 6
0
        internal static void ConstructAggregateObject <F, O>(string childDN, ADObject parentObj, string identityQueryPath, ICollection <string> propertiesToFetch, bool showDeleted, CmdletSessionInfo cmdletSessionInfo)
            where F : ADFactory <O>, new()
            where O : ADEntity, new()
        {
            F f = Activator.CreateInstance <F>();

            f.SetCmdletSessionInfo(cmdletSessionInfo);
            O o = Activator.CreateInstance <O>();

            o.Identity = childDN;
            O extendedObjectFromIdentity = f.GetExtendedObjectFromIdentity(o, identityQueryPath, propertiesToFetch, showDeleted);

            if (extendedObjectFromIdentity != null)
            {
                ADTopologyUtil.MergeADObjectProperties(parentObj, extendedObjectFromIdentity);
            }
        }
Ejemplo n.º 7
0
 internal override IEnumerable <T> GetExtendedObjectFromFilter(IADOPathNode filter, string searchBase, ADSearchScope searchScope, ICollection <string> propertiesToFetch, int?resultSetSize, int?pageSize, bool showDeleted)
 {
     if (base.CmdletSessionInfo != null)
     {
         MappingTable <AttributeConverterEntry> item         = ADNtdsSiteSettingFactory <ADNtdsSiteSetting> .AttributeTable[base.ConnectedStore];
         MappingTable <AttributeConverterEntry> mappingTable = ADReplicationSiteFactory <T> .AttributeTable[base.ConnectedStore];
         ICollection <string> parentAttributes = ADTopologyUtil.GetParentAttributes(mappingTable, item, propertiesToFetch);
         ICollection <string> childAttributes  = ADTopologyUtil.GetChildAttributes(mappingTable, item, propertiesToFetch);
         if (!parentAttributes.Contains("*"))
         {
             parentAttributes.Add("*");
         }
         IEnumerable <T> extendedObjectFromFilter = base.GetExtendedObjectFromFilter(this.StructuralObjectFilter, searchBase, searchScope, parentAttributes, resultSetSize, pageSize, showDeleted);
         ADNtdsSiteSettingFactory <ADNtdsSiteSetting> aDNtdsSiteSettingFactory = new ADNtdsSiteSettingFactory <ADNtdsSiteSetting>();
         aDNtdsSiteSettingFactory.SetCmdletSessionInfo(base.CmdletSessionInfo);
         IEnumerable <ADNtdsSiteSetting>        aDNtdsSiteSettings = aDNtdsSiteSettingFactory.GetExtendedObjectFromFilter(aDNtdsSiteSettingFactory.StructuralObjectFilter, searchBase, searchScope, childAttributes, resultSetSize, pageSize, showDeleted);
         Dictionary <string, ADNtdsSiteSetting> strs = new Dictionary <string, ADNtdsSiteSetting>();
         foreach (ADNtdsSiteSetting aDNtdsSiteSetting in aDNtdsSiteSettings)
         {
             strs.Add(aDNtdsSiteSetting.DistinguishedName, aDNtdsSiteSetting);
         }
         List <T> ts = new List <T>();
         foreach (T t in extendedObjectFromFilter)
         {
             string str = ADPathModule.MakePath(t.DistinguishedName, "CN=NTDS Site Settings,", ADPathFormat.X500);
             if (strs.ContainsKey(str))
             {
                 ADNtdsSiteSetting item1 = strs[str];
                 ADTopologyUtil.MergeADObjectProperties(t, item1);
             }
             ts.Add(t);
         }
         IEnumerable <T> ts1 = this.ApplyClientSideFilter(ts);
         return(ADTopologyUtil.RemoveExtraPropertiesFromADAggregateObject <T>(mappingTable, item, propertiesToFetch, ts1));
     }
     else
     {
         throw new ArgumentNullException(StringResources.SessionRequired);
     }
 }