directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1001777 - in /directory/apacheds/trunk/server-config/src: main/java/org/apache/directory/server/config/ConfigPartitionReader.java test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
Date Mon, 27 Sep 2010 15:20:24 GMT
Author: kayyagari
Date: Mon Sep 27 15:20:24 2010
New Revision: 1001777

URL: http://svn.apache.org/viewvc?rev=1001777&view=rev
Log:
o updated config reader to work with any sort of LDIF partition
o fixed an issue with loading disabled webapps
o updated test to use SingleFileLdifPartition

Modified:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1001777&r1=1001776&r2=1001777&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Mon Sep 27 15:20:24 2010
@@ -72,7 +72,7 @@ import org.apache.directory.server.core.
 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.partition.ldif.AbstractLdifPartition;
 import org.apache.directory.server.dhcp.service.DhcpService;
 import org.apache.directory.server.dhcp.service.StoreBasedDhcpService;
 import org.apache.directory.server.dhcp.store.DhcpStore;
@@ -115,7 +115,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-;
+
 
 /**
  * A class used for reading the configuration present in a Partition
@@ -128,7 +128,7 @@ public class ConfigPartitionReader
     private static final Logger LOG = LoggerFactory.getLogger( ConfigPartitionReader.class
);
 
     /** the partition which holds the configuration data */
-    private LdifPartition configPartition;
+    private AbstractLdifPartition configPartition;
 
     /** the search engine of the partition */
     private SearchEngine<Entry, Long> se;
@@ -162,8 +162,9 @@ public class ConfigPartitionReader
      * Creates a new instance of ConfigPartitionReader.
      *
      * @param configPartition the non null config partition
+     * @param partitionsDir the directory where all the partitions' data is stored
      */
-    public ConfigPartitionReader( LdifPartition configPartition )
+    public ConfigPartitionReader( AbstractLdifPartition configPartition, File partitionsDir
)
     {
         if ( configPartition == null )
         {
@@ -178,7 +179,7 @@ public class ConfigPartitionReader
         this.configPartition = configPartition;
         se = configPartition.getSearchEngine();
         this.schemaManager = configPartition.getSchemaManager();
-        workDir = configPartition.getPartitionDir().getParentFile();
+        this.workDir = partitionsDir;
         
         // setup ObjectClass attribute type value
         OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT
);
@@ -1418,6 +1419,11 @@ public class ConfigPartitionReader
                 .get();
             Entry webAppEntry = configPartition.lookup( forwardEntry.getId() );
 
+            if ( ! isEnabled( webAppEntry ) )
+            {
+                continue;
+            }
+            
             WebApp app = new WebApp();
             app.setWarFile( getString( ConfigSchemaConstants.ADS_HTTP_WARFILE, webAppEntry
) );
 

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java?rev=1001777&r1=1001776&r2=1001777&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
Mon Sep 27 15:20:24 2010
@@ -32,6 +32,7 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.partition.ldif.LdifPartition;
+import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
 import org.apache.directory.server.core.schema.SchemaPartition;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.transport.Transport;
@@ -101,18 +102,19 @@ public class ConfigPartitionReaderTest
             throw new Exception( "Schema load failed : " + LdapExceptionUtils.printErrors(
errors ) );
         }
 
-        LdifConfigExtractor.extract( workDir, true );
+        File configDir = new File( workDir, "config" ); // could be any directory, cause
the config is now in a single file
+        
+        String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, true
);
 
-        LdifPartition configPartition = new LdifPartition();
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
         configPartition.setId( "config" );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
-        configPartition.setWorkingDirectory( workingDirectory + "/config" );
-        configPartition.setPartitionDir( new File( configPartition.getWorkingDirectory()
) );
-
+        
         configPartition.initialize();
-
-        ConfigPartitionReader cpReader = new ConfigPartitionReader( configPartition );
+        
+        ConfigPartitionReader cpReader = new ConfigPartitionReader( configPartition, workDir
);
+        
         dirService = cpReader.createDirectoryService();
 
         SchemaPartition schemaPartition = dirService.getSchemaService().getSchemaPartition();



Mime
View raw message