directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r811164 - in /directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core: DefaultDirectoryService.java authz/DefaultAuthorizationInterceptor.java partition/PartitionNexus.java security/CoreKeyStoreSpi.java
Date Thu, 03 Sep 2009 22:51:44 GMT
Author: elecharny
Date: Thu Sep  3 22:51:44 2009
New Revision: 811164

URL: http://svn.apache.org/viewvc?rev=811164&view=rev
Log:
Cleaned up NexusPartition from useless static methods (getAdminDn and such)

Modified:
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=811164&r1=811163&r2=811164&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Thu Sep  3 22:51:44 2009
@@ -1084,11 +1084,11 @@
         /*
          * If the admin entry is there, then the database was already created
          */
-        if ( !partitionNexus.hasEntry( new EntryOperationContext( adminSession, PartitionNexus.getAdminName()
) ) )
+        if ( !partitionNexus.hasEntry( new EntryOperationContext( adminSession, adminDn )
) )
         {
             firstStart = true;
 
-            ServerEntry serverEntry = new DefaultServerEntry( getRegistries(), PartitionNexus.getAdminName()
);
+            ServerEntry serverEntry = new DefaultServerEntry( getRegistries(), adminDn );
             
             serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, 
                                 SchemaConstants.TOP_OC,

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=811164&r1=811163&r2=811164&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
Thu Sep  3 22:51:44 2009
@@ -126,10 +126,10 @@
         // disable this static module if basic access control mechanisms are enabled
         enabled = ! directoryService.isAccessControlEnabled();
         
-        USER_BASE_DN = PartitionNexus.getUsersBaseName();
+        USER_BASE_DN = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN );
         USER_BASE_DN.normalize( normalizerMapping );
         
-        GROUP_BASE_DN = PartitionNexus.getGroupsBaseName();
+        GROUP_BASE_DN = new LdapDN( ServerDNConstants.GROUPS_SYSTEM_DN );
         GROUP_BASE_DN.normalize( normalizerMapping );
      
         ADMIN_GROUP_DN = new LdapDN( ServerDNConstants.ADMINISTRATORS_GROUP_DN );

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java?rev=811164&r1=811163&r2=811164&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
Thu Sep  3 22:51:44 2009
@@ -33,7 +33,6 @@
 import java.util.UUID;
 
 import javax.naming.ConfigurationException;
-import javax.naming.InvalidNameException;
 import javax.naming.NameNotFoundException;
 import javax.naming.directory.SearchControls;
 import javax.naming.ldap.LdapContext;
@@ -96,9 +95,6 @@
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
-import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
-import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
-import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.util.DateUtils;
@@ -238,21 +234,20 @@
         registries = directoryService.getRegistries();
         atRegistry = registries.getAttributeTypeRegistry();
         
+        // Initialize and normalize the localy used DNs
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN );
+        adminDn.normalize( atRegistry.getNormalizerMapping() );
+            
         initializeSystemPartition( directoryService );
         
         List<Partition> initializedPartitions = new ArrayList<Partition>();
         initializedPartitions.add( 0, this.system );
     
-        //noinspection unchecked
-        Iterator<? extends Partition> partitions = ( Iterator<? extends Partition>
) directoryService.getPartitions().iterator();
-        
         try
         {
-            while ( partitions.hasNext() )
+            for ( Partition partition : directoryService.getPartitions() )
             {
-                Partition partition = partitions.next();
-                LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
);
-                adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
+                //adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
                 CoreSession adminSession = new DefaultCoreSession( 
                     new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService
);
     
@@ -873,107 +868,6 @@
     }
 
 
-    
-    
-    
-    
-    /**
-     * Gets the DN for the admin user.
-     * 
-     * @return the admin user DN
-     */
-    public static final LdapDN getAdminName()
-    {
-        LdapDN adminDn = null;
-
-        try
-        {
-            adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN );
-        }
-        catch ( Exception e )
-        {
-            throw new InternalError();
-        }
-        
-        try
-        {
-            Map<String, OidNormalizer> oidsMap = new HashMap<String, OidNormalizer>();
-            
-            // UID normalizer
-            OidNormalizer uidOidNormalizer = new OidNormalizer( "uid",
-                new NoOpNormalizer( SchemaConstants.UID_AT_OID ) );
-            
-            oidsMap.put( SchemaConstants.UID_AT, uidOidNormalizer );
-            oidsMap.put( SchemaConstants.USER_ID_AT, uidOidNormalizer );
-            oidsMap.put( SchemaConstants.UID_AT_OID, uidOidNormalizer );
-            
-            // OU normalizer
-            OidNormalizer ouOidNormalizer = new OidNormalizer( "ou",
-                new DeepTrimToLowerNormalizer( SchemaConstants.OU_AT_OID ) );
-            
-            oidsMap.put( SchemaConstants.OU_AT, ouOidNormalizer );
-            oidsMap.put( SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT, ouOidNormalizer );
-            oidsMap.put( SchemaConstants.OU_AT_OID,ouOidNormalizer );
-
-            adminDn.normalize( oidsMap );
-        }
-        catch ( InvalidNameException ine )
-        {
-            // Nothing we can do ...
-        }
-        catch ( Exception ne )
-        {
-            // Nothing we can do ...
-        }
-
-        return adminDn;
-    }
-
-
-    /**
-     * Gets the DN for the base entry under which all groups reside.
-     * A new Name instance is created and returned every time.
-     * @return the groups base DN
-     */
-    public static final LdapDN getGroupsBaseName()
-    {
-        LdapDN groupsBaseDn = null;
-
-        try
-        {
-            groupsBaseDn = new LdapDN( ServerDNConstants.GROUPS_SYSTEM_DN );
-        }
-        catch ( Exception e )
-        {
-            throw new InternalError();
-        }
-
-        return groupsBaseDn;
-    }
-
-
-    /**
-     * Gets the DN for the base entry under which all non-admin users reside.
-     * A new Name instance is created and returned every time.
-     * @return the users base DN
-     */
-    public static final LdapDN getUsersBaseName()
-    {
-        LdapDN usersBaseDn = null;
-
-        try
-        {
-            usersBaseDn = new LdapDN( ServerDNConstants.USERS_SYSTEM_DN );
-        }
-        catch ( Exception e )
-        {
-            throw new InternalError();
-        }
-
-        return usersBaseDn;
-    }
-
-
     /**
      * Gets the LdapContext associated with the calling thread.
      * 

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java?rev=811164&r1=811163&r2=811164&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
Thu Sep  3 22:51:44 2009
@@ -37,11 +37,11 @@
 
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.NotImplementedException;
+import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.SingletonEnumeration;
@@ -78,7 +78,7 @@
 
     private ServerEntry getTlsEntry() throws Exception
     {
-        LdapDN adminDn = PartitionNexus.getAdminName();
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN );
         LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.SIMPLE
);
         CoreSession session = directoryService.getSession( principal );
         return session.lookup( adminDn );



Mime
View raw message