directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1021406 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Date Mon, 11 Oct 2010 16:19:51 GMT
Author: kayyagari
Date: Mon Oct 11 16:19:50 2010
New Revision: 1021406

URL: http://svn.apache.org/viewvc?rev=1021406&view=rev
Log:
o deferring creating the system entry till it was found missing 

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1021406&r1=1021405&r2=1021406&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Mon Oct 11 16:19:50 2010
@@ -298,26 +298,25 @@ public class DefaultPartitionNexus exten
 
         // Add root context entry for system partition
         DN systemSuffixDn = DNFactory.create( ServerDNConstants.SYSTEM_DN, schemaManager
);
-        Entry systemEntry = new DefaultEntry( schemaManager, systemSuffixDn );
+        CoreSession adminSession = directoryService.getAdminSession();
 
-        // Add the ObjectClasses
-        systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
-            SchemaConstants.ORGANIZATIONAL_UNIT_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC
);
-
-        // Add some operational attributes
-        systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN
);
-        systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
-        systemEntry.add( SchemaConstants.ENTRY_CSN_AT, directoryService.getCSN().toString()
);
-        systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
-        systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ), NamespaceTools
-            .getRdnValue( ServerDNConstants.SYSTEM_DN ) );
-        DN adminDn = DNFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED, schemaManager
);
-        CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG
),
-            directoryService );
-        AddOperationContext addOperationContext = new AddOperationContext( adminSession,
systemEntry );
-
-        if ( !system.hasEntry( new EntryOperationContext( adminSession, systemEntry.getDn()
) ) )
+        if ( !system.hasEntry( new EntryOperationContext( adminSession, systemSuffixDn )
) )
         {
+            Entry systemEntry = new DefaultEntry( schemaManager, systemSuffixDn );
+            
+            // Add the ObjectClasses
+            systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC
);
+            
+            // Add some operational attributes
+            systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN
);
+            systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+            systemEntry.add( SchemaConstants.ENTRY_CSN_AT, directoryService.getCSN().toString()
);
+            systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
+            systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN
), NamespaceTools
+                .getRdnValue( ServerDNConstants.SYSTEM_DN ) );
+            
+            AddOperationContext addOperationContext = new AddOperationContext( adminSession,
systemEntry );
             system.add( addOperationContext );
         }
 



Mime
View raw message