directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r813541 - in /directory: apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/ apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/ apacheds/branches/...
Date Thu, 10 Sep 2009 18:46:12 GMT
Author: elecharny
Date: Thu Sep 10 18:46:11 2009
New Revision: 813541

URL: http://svn.apache.org/viewvc?rev=813541&view=rev
Log:
Fixed DS initialization plus some  DN normalization

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
Thu Sep 10 18:46:11 2009
@@ -58,7 +58,6 @@
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
 import org.apache.directory.shared.ldap.util.DateUtils;
-import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -225,9 +224,6 @@
         // Load apachemeta schema from within the ldap-schema Jar with all the
         // schema it depends on.  This is a minimal mandatory set of schemas.
         // -----------------------------------------------------------------------
-        
-        loader = new JarLdifSchemaLoader();
-        loader.loadAllEnabled( registries );  
         SerializableComparator.setRegistry( registries.getComparatorRegistry() );
 
         wrapped.setId( ID );
@@ -255,6 +251,8 @@
             LOG.error( "Failed to initialize wrapped partition.", e );
             throw new RuntimeException( e );
         }
+
+        loader.loadAllEnabled( registries );  
     }
     
     
@@ -443,4 +441,13 @@
         
         opContext.modify( name, mods, ByPassConstants.SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS
);
     }
+
+
+    /**
+     * @param loader the loader to set
+     */
+    public void setLoader( SchemaLoader loader )
+    {
+        this.loader = loader;
+    }
 }

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
Thu Sep 10 18:46:11 2009
@@ -36,6 +36,7 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
 
 
 /**
@@ -63,10 +64,11 @@
             {
                 String path = DirectoryServiceFactory.class.getResource( "" ).getPath();
                 int targetPos = path.indexOf( "target" );
-                workingDirectory = path.substring( 0, targetPos + 6 );
+                workingDirectory = path.substring( 0, targetPos + 6 ) + "/server-work";
             }
 
             DirectoryService service = new DefaultDirectoryService();
+            service.setWorkingDirectory( new File( workingDirectory ) );
             SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
             Registries registries = service.getRegistries();
             
@@ -78,11 +80,14 @@
             // Extract the schema on disk (a brand new one) and load the registries
             File schemaRepository = new File( workingDirectory, "schema" );
             SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory
) );
-            extractor.extractOrCopy();
             
             schemaPartition.setWrappedPartition( ldifPartition );
             schemaPartition.setRegistries( registries );
             
+            JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
+            loader.loadAllEnabled( registries );
+            extractor.extractOrCopy();
+
             service.getChangeLog().setEnabled( true );
 
             // change the working directory to something that is unique
@@ -95,7 +100,7 @@
             ((JdbmPartition)systemPartition).setCacheSize( 500 );
             systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
             systemPartition.setRegistries( registries );
-            ((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory
) );
+            ((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory,
"system" ) );
     
             // Add objectClass attribute for the system partition
             Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
Thu Sep 10 18:46:11 2009
@@ -180,6 +180,7 @@
                     return;
                 }
 
+                /*
                 try
                 {
                     cleanup();
@@ -190,6 +191,7 @@
                     testAborted( notifier, settings.getDescription(), ioe );
                     return;
                 }
+                */
 
                 try
                 {

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
Thu Sep 10 18:46:11 2009
@@ -20,17 +20,12 @@
 package org.apache.directory.server.core.authz;
 
 
-import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.DefaultDirectoryService;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.DirectoryServiceFactory;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
 
-import org.apache.directory.server.core.partition.ldif.LdifPartition;
-import org.apache.directory.server.core.schema.SchemaPartition;
-import org.apache.directory.server.core.subtree.SubentryInterceptor;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.name.LdapDN;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
 
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -41,7 +36,24 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InitialDirContext;
 import javax.naming.ldap.LdapContext;
-import java.util.Hashtable;
+
+import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.partition.ldif.LdifPartition;
+import org.apache.directory.server.core.schema.SchemaPartition;
+import org.apache.directory.server.core.subtree.SubentryInterceptor;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
 
 
 /**
@@ -60,12 +72,58 @@
     {
         public DirectoryService newInstance() throws Exception
         {
-            DefaultDirectoryService service = new DefaultDirectoryService();
-            SchemaPartition schemaPartition = new SchemaPartition();
-            schemaPartition.setWrappedPartition( new LdifPartition() );
-            service.getSchemaService().setSchemaPartition( schemaPartition );
-            service.setAccessControlEnabled( true );
+            String workingDirectory = System.getProperty( "workingDirectory" );
+
+            if ( workingDirectory == null )
+            {
+                String path = DirectoryServiceFactory.class.getResource( "" ).getPath();
+                int targetPos = path.indexOf( "target" );
+                workingDirectory = path.substring( 0, targetPos + 6 ) + "/server-work";
+            }
+
+            DirectoryService service = new DefaultDirectoryService();
+            service.setWorkingDirectory( new File( workingDirectory ) );
+            SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
+            Registries registries = service.getRegistries();
+            
+            // Init the LdifPartition
+            LdifPartition ldifPartition = new LdifPartition();
+            
+            ldifPartition.setWorkingDirectory( workingDirectory + "/schema" );
+            
+            // Extract the schema on disk (a brand new one) and load the registries
+            File schemaRepository = new File( workingDirectory, "schema" );
+            SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory
) );
+            
+            schemaPartition.setWrappedPartition( ldifPartition );
+            schemaPartition.setRegistries( registries );
+            
+            JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
+            loader.loadAllEnabled( registries );
+            extractor.extractOrCopy();
+
             service.getChangeLog().setEnabled( true );
+
+            // change the working directory to something that is unique
+            // on the system and somewhere either under target directory
+            // or somewhere in a temp area of the machine.
+            
+            // Inject the System Partition
+            Partition systemPartition = new JdbmPartition();
+            systemPartition.setId( "system" );
+            ((JdbmPartition)systemPartition).setCacheSize( 500 );
+            systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
+            systemPartition.setRegistries( registries );
+            ((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory,
"system" ) );
+    
+            // Add objectClass attribute for the system partition
+            Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();
+            indexedAttrs.add( 
+                new JdbmIndex<Object,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT
) );
+            ( ( JdbmPartition ) systemPartition ).setIndexedAttributes( indexedAttrs );
+            
+            service.setSystemPartition( systemPartition );
+            service.setAccessControlEnabled( true );
             AutzIntegUtils.service = service;
             return service;
         }
@@ -76,12 +134,58 @@
     {
         public DirectoryService newInstance() throws Exception
         {
-            DefaultDirectoryService service = new DefaultDirectoryService();
-            SchemaPartition schemaPartition = new SchemaPartition();
-            schemaPartition.setWrappedPartition( new LdifPartition() );
-            service.getSchemaService().setSchemaPartition( schemaPartition );
-            service.setAccessControlEnabled( false );
+            String workingDirectory = System.getProperty( "workingDirectory" );
+
+            if ( workingDirectory == null )
+            {
+                String path = DirectoryServiceFactory.class.getResource( "" ).getPath();
+                int targetPos = path.indexOf( "target" );
+                workingDirectory = path.substring( 0, targetPos + 6 ) + "/server-work";
+            }
+
+            DirectoryService service = new DefaultDirectoryService();
+            service.setWorkingDirectory( new File( workingDirectory ) );
+            SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
+            Registries registries = service.getRegistries();
+            
+            // Init the LdifPartition
+            LdifPartition ldifPartition = new LdifPartition();
+            
+            ldifPartition.setWorkingDirectory( workingDirectory + "/schema" );
+            
+            // Extract the schema on disk (a brand new one) and load the registries
+            File schemaRepository = new File( workingDirectory, "schema" );
+            SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory
) );
+            
+            schemaPartition.setWrappedPartition( ldifPartition );
+            schemaPartition.setRegistries( registries );
+            
+            JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
+            loader.loadAllEnabled( registries );
+            extractor.extractOrCopy();
+
             service.getChangeLog().setEnabled( true );
+
+            // change the working directory to something that is unique
+            // on the system and somewhere either under target directory
+            // or somewhere in a temp area of the machine.
+            
+            // Inject the System Partition
+            Partition systemPartition = new JdbmPartition();
+            systemPartition.setId( "system" );
+            ((JdbmPartition)systemPartition).setCacheSize( 500 );
+            systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
+            systemPartition.setRegistries( registries );
+            ((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory,
"system" ) );
+    
+            // Add objectClass attribute for the system partition
+            Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();
+            indexedAttrs.add( 
+                new JdbmIndex<Object,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT
) );
+            ( ( JdbmPartition ) systemPartition ).setIndexedAttributes( indexedAttrs );
+            
+            service.setSystemPartition( systemPartition );
+            service.setAccessControlEnabled( false );
             AutzIntegUtils.service = service;
             return service;
         }

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
Thu Sep 10 18:46:11 2009
@@ -20,33 +20,43 @@
 package org.apache.directory.server.core.partition;
 
 
+import static org.apache.directory.server.core.integ.IntegrationUtils.getRootContext;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.CiRunner;
 import org.apache.directory.server.core.integ.DirectoryServiceFactory;
 import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.annotations.Factory;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.core.partition.ldif.LdifPartition;
 import org.apache.directory.server.core.schema.SchemaPartition;
-
-import static org.apache.directory.server.core.integ.IntegrationUtils.getRootContext;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.ldap.LdapContext;
-
 
 
 /**
@@ -84,11 +94,57 @@
     {
         public DirectoryService newInstance() throws Exception 
         {
-            DefaultDirectoryService service = new DefaultDirectoryService();
-            SchemaPartition schemaPartition = new SchemaPartition();
-            schemaPartition.setWrappedPartition( new LdifPartition() );
-            service.getSchemaService().setSchemaPartition( schemaPartition );
+            String workingDirectory = System.getProperty( "workingDirectory" );
+
+            if ( workingDirectory == null )
+            {
+                String path = DirectoryServiceFactory.class.getResource( "" ).getPath();
+                int targetPos = path.indexOf( "target" );
+                workingDirectory = path.substring( 0, targetPos + 6 ) + "/server-work";
+            }
+
+            DirectoryService service = new DefaultDirectoryService();
+            service.setWorkingDirectory( new File( workingDirectory ) );
+            SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
+            Registries registries = service.getRegistries();
+            
+            // Init the LdifPartition
+            LdifPartition ldifPartition = new LdifPartition();
+            
+            ldifPartition.setWorkingDirectory( workingDirectory + "/schema" );
+            
+            // Extract the schema on disk (a brand new one) and load the registries
+            File schemaRepository = new File( workingDirectory, "schema" );
+            SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory
) );
+            
+            schemaPartition.setWrappedPartition( ldifPartition );
+            schemaPartition.setRegistries( registries );
+            
+            JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
+            loader.loadAllEnabled( registries );
+            extractor.extractOrCopy();
+
             service.getChangeLog().setEnabled( true );
+
+            // change the working directory to something that is unique
+            // on the system and somewhere either under target directory
+            // or somewhere in a temp area of the machine.
+            
+            // Inject the System Partition
+            Partition systemPartition = new JdbmPartition();
+            systemPartition.setId( "system" );
+            ((JdbmPartition)systemPartition).setCacheSize( 500 );
+            systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
+            systemPartition.setRegistries( registries );
+            ((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory,
"system" ) );
+    
+            // Add objectClass attribute for the system partition
+            Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();
+            indexedAttrs.add( 
+                new JdbmIndex<Object,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT
) );
+            ( ( JdbmPartition ) systemPartition ).setIndexedAttributes( indexedAttrs );
+            
+            service.setSystemPartition( systemPartition );
             
             Partition foo = new JdbmPartition();
             foo.setId( "foo" );

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=813541&r1=813540&r2=813541&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 10 18:46:11 2009
@@ -1410,7 +1410,7 @@
         partitions.add( schemaService.getSchemaPartition() );
         systemPartition.getSuffixDn().normalize( getRegistries().getAttributeTypeRegistry().getNormalizerMapping()
);
 
-        adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+        adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN ).normalize( getRegistries().getAttributeTypeRegistry().getNormalizerMapping()
);
         adminDn.normalize( getRegistries().getAttributeTypeRegistry().getNormalizerMapping()
);
         adminSession = new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG
), this );
         

Modified: directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Thu Sep 10 18:46:11 2009
@@ -120,7 +120,6 @@
     public final void initialize( ) throws Exception
     {
         store.setWorkingDirectory( getPartitionDir() );
-        //store.init( registries );
 
         EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( store, registries );
         CursorBuilder cursorBuilder = new CursorBuilder( store, evaluatorBuilder );

Modified: directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/branches/apacheds-schema/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Thu Sep 10 18:46:11 2009
@@ -201,7 +201,7 @@
             // The partition directory does not exist, we have to create it
             try
             {
-                suffixDirectory.mkdirs();
+                suffixDirectory.mkdir();
             }
             catch ( SecurityException se )
             {
@@ -217,7 +217,15 @@
             
             if ( contextEntry == null )
             {
-                throw new NamingException( "The expected context entry does not exist" );
+                if ( contextEntryFile.exists() )
+                {
+                    LdifReader reader = new LdifReader( contextEntryFile );
+                    contextEntry = new DefaultServerEntry( registries, reader.next().getEntry()
); 
+                }
+                else
+                {
+                    throw new NamingException( "The expected context entry does not exist"
);
+                }
             }
             
             if ( contextEntry.get( SchemaConstants.ENTRY_CSN_AT ) == null )

Modified: directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java?rev=813541&r1=813540&r2=813541&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java
(original)
+++ directory/shared/branches/shared-schema/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/SchemaLdifExtractor.java
Thu Sep 10 18:46:11 2009
@@ -71,14 +71,14 @@
     {
         if ( ! outputDirectory.exists() )
         {
-            outputDirectory.mkdirs();
+            outputDirectory.mkdir();
         }
 
         File schemaDirectory = new File( outputDirectory, "schema" );
         
         if ( ! schemaDirectory.exists() )
         {
-            schemaDirectory.mkdirs();
+            schemaDirectory.mkdir();
         }
 
         Pattern pattern = Pattern.compile( ".*schema/ou=schema.*\\.ldif" );



Mime
View raw message