directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1045362 - in /directory/apacheds/trunk: ./ core-annotations/src/main/java/org/apache/directory/server/core/factory/ jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ ldif-partition/src/main/java/org/a...
Date Mon, 13 Dec 2010 20:29:38 GMT
Author: seelmann
Date: Mon Dec 13 20:29:37 2010
New Revision: 1045362

URL: http://svn.apache.org/viewvc?rev=1045362&view=rev
Log:
Consistent usage of 'URI partitionPath' for all partitions


Modified:
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
    directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
    directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
    directory/apacheds/trunk/pom.xml
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
    directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
    directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
Mon Dec 13 20:29:37 2010
@@ -48,7 +48,7 @@ public class AvlPartitionFactory impleme
         partition.setId( id );
         partition.setSuffix( new DN( suffix ) );
         partition.setCacheSize( 500 );
-        partition.setPartitionDir( workingDirectory );
+        partition.setPartitionPath( workingDirectory.toURI() );
         return partition;
     }
 

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
Mon Dec 13 20:29:37 2010
@@ -164,9 +164,9 @@ public class DSAnnotationProcessor
                 {
                     BTreePartition<?> btreePartition = ( BTreePartition<?> )
partition;
                     btreePartition.setCacheSize( createPartition.cacheSize() );
-                    btreePartition.setPartitionDir( new File( service
+                    btreePartition.setPartitionPath( new File( service
                             .getInstanceLayout().getPartitionsDirectory(),
-                            createPartition.name() ) );
+                            createPartition.name() ).toURI() );
 
                     // Process the indexes if any
                     CreateIndex[] indexes = createPartition.indexes();

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DefaultDirectoryServiceFactory.java
Mon Dec 13 20:29:37 2010
@@ -158,12 +158,12 @@ public class DefaultDirectoryServiceFact
 
         // Init the LdifPartition
         LdifPartition ldifPartition = new LdifPartition();
-        String workingDirectory = directoryService.getInstanceLayout().getPartitionsDirectory().getPath();
-        ldifPartition.setWorkingDirectory( workingDirectory + "/schema" );
+        File workingDirectory = directoryService.getInstanceLayout().getPartitionsDirectory();
+        ldifPartition.setPartitionPath( new File(workingDirectory, "schema" ).toURI() );
 
         // Extract the schema on disk (a brand new one) and load the registries
         File schemaRepository = new File( workingDirectory, "schema" );
-        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );
+        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( workingDirectory
);
         
         try
         {

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
Mon Dec 13 20:29:37 2010
@@ -48,7 +48,7 @@ public class JdbmPartitionFactory implem
         partition.setId( id );
         partition.setSuffix( new DN( suffix ) );
         partition.setCacheSize( 500 );
-        partition.setPartitionDir( workingDirectory );
+        partition.setPartitionPath( workingDirectory.toURI() );
         return partition;
     }
 

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
Mon Dec 13 20:29:37 2010
@@ -48,8 +48,7 @@ public class LdifPartitionFactory implem
         partition.setId( id );
         partition.setSuffix( new DN( suffix ) );
         partition.setCacheSize( 500 );
-        partition.setWorkingDirectory( workingDirectory.getAbsolutePath() );
-        partition.setPartitionDir( workingDirectory );
+        partition.setPartitionPath( workingDirectory.toURI() );
         return partition;
     }
 

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Mon Dec 13 20:29:37 2010
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
+import java.io.File;
+
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.xdbm.AbstractXdbmPartition;
 import org.apache.directory.server.xdbm.Index;
@@ -51,7 +53,7 @@ public class JdbmPartition extends Abstr
 
     protected void doInit() throws Exception
     {
-        store.setPartitionDir( getPartitionDir() );
+        store.setPartitionDir( new File( getPartitionPath() ) );
 
         EvaluatorBuilder<Long> evaluatorBuilder = new EvaluatorBuilder<Long>(
store, schemaManager );
         CursorBuilder<Long> cursorBuilder = new CursorBuilder<Long>( store, evaluatorBuilder
);
@@ -75,7 +77,7 @@ public class JdbmPartition extends Abstr
         // Normalize the suffix
         suffix.normalize( schemaManager );
         store.setSuffixDn( suffix );
-        store.setPartitionDir( getPartitionDir() );
+        store.setPartitionDir( new File( getPartitionPath() ) );
 
         for ( Index<?, Entry, Long> index : getIndexedAttributes() )
         {

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
Mon Dec 13 20:29:37 2010
@@ -47,9 +47,6 @@ import org.apache.directory.shared.ldap.
  */
 public abstract class AbstractLdifPartition extends BTreePartition<Long>
 {
-    /** The directory into which the partition is stored */
-    protected String workingDirectory;
-
     /** We use a partition to manage searches on this partition */
     protected AvlPartition wrappedPartition;
 
@@ -69,24 +66,6 @@ public abstract class AbstractLdifPartit
 
 
     /**
-     * @return the workingDirectory
-     */
-    public String getWorkingDirectory()
-    {
-        return workingDirectory;
-    }
-
-
-    /**
-     * @param workingDirectory the workingDirectory to set
-     */
-    public void setWorkingDirectory( String workingDirectory )
-    {
-        this.workingDirectory = workingDirectory;
-    }
-
-
-    /**
      * @return the contextEntry
      */
     public Entry getContextEntry()

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Mon Dec 13 20:29:37 2010
@@ -143,6 +143,8 @@ public class LdifPartition extends Abstr
 
         LOG.debug( "id is : {}", wrappedPartition.getId() );
 
+        File partitionDir = new File( getPartitionPath() );
+
         // Initialize the suffixDirectory : it's a composition
         // of the workingDirectory followed by the suffix
         if ( ( suffix == null ) || ( suffix.isEmpty() ) )
@@ -158,13 +160,13 @@ public class LdifPartition extends Abstr
         }
 
         String suffixDirName = getFileName( suffix );
-        suffixDirectory = new File( workingDirectory, suffixDirName );
+        suffixDirectory = new File( partitionDir, suffixDirName );
 
         // Create the context entry now, if it does not exists, or load the
         // existing entries
         if ( suffixDirectory.exists() )
         {
-            loadEntries( new File( workingDirectory ) );
+            loadEntries( partitionDir );
         }
         else
         {

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
Mon Dec 13 20:29:37 2010
@@ -72,9 +72,6 @@ public class SingleFileLdifPartition ext
     /** flag used internally to detect if partition data was updated in memory but not on
disk */
     private boolean dirty = false;
 
-    /** file name of the underlying LDIF store */
-    private String fileName;
-
     /** lock for serializing the operations on the backing LDIF file */
     private Object lock = new Object();
 
@@ -82,32 +79,10 @@ public class SingleFileLdifPartition ext
 
 
     /**
-     * 
      * Creates a new instance of SingleFileLdifPartition.
-     *
-     * @param file the LDIF file containing the partition's data (can also be empty)
      */
-    public SingleFileLdifPartition( String file )
+    public SingleFileLdifPartition()
     {
-        if ( file == null )
-        {
-            throw new IllegalArgumentException( "ldif file cannot be null" );
-        }
-
-        try
-        {
-            ldifFile = new RandomAccessFile( file, "rws" );
-            fileName = file;
-
-            File partitionDir = new File( file ).getParentFile();
-            setPartitionDir( partitionDir );
-            setWorkingDirectory( partitionDir.getAbsolutePath() );
-        }
-        catch ( IOException e )
-        {
-            throw new RuntimeException( e );
-        }
-
         wrappedPartition = new AvlPartition();
     }
 
@@ -115,6 +90,19 @@ public class SingleFileLdifPartition ext
     @Override
     protected void doInit() throws InvalidNameException, Exception
     {
+        if ( getPartitionPath() == null )
+        {
+            throw new IllegalArgumentException( "Partition path cannot be null" );
+        }
+
+        File partitionFile = new File( getPartitionPath() );
+        if ( partitionFile.exists() && !partitionFile.isFile() )
+        {
+            throw new IllegalArgumentException( "Partition path must be a LDIF file" );
+        }
+
+        ldifFile = new RandomAccessFile( partitionFile, "rws" );
+
         // Initialize the AvlPartition
         wrappedPartition.setId( id );
         wrappedPartition.setSuffix( suffix );
@@ -143,28 +131,6 @@ public class SingleFileLdifPartition ext
     }
 
 
-    @Override
-    public void setPartitionDir( File partitionDir )
-    {
-        // partition directory will always be the directory
-        // in which the backing LDIF file is present 
-        if ( getPartitionDir() != null )
-        {
-            super.setPartitionDir( partitionDir );
-        }
-    }
-
-
-    @Override
-    public void setWorkingDirectory( String workingDirectory )
-    {
-        if ( getWorkingDirectory() != null )
-        {
-            super.setWorkingDirectory( workingDirectory );
-        }
-    }
-
-
     /**
      * load the entries from the LDIF file if present
      * @throws Exception
@@ -300,15 +266,6 @@ public class SingleFileLdifPartition ext
 
 
     /**
-     * @return the backing LDIF file's name
-     */
-    public String getFileName()
-    {
-        return fileName;
-    }
-
-
-    /**
      * writes the partition's data to the file if {@link #enableRewriting} is set to true
      * and partition was modified since the last write or {@link #dirty} data. 
      * 

Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
Mon Dec 13 20:29:37 2010
@@ -142,7 +142,7 @@ public class LdifPartitionTest
         partition.setId( "test-ldif" );
         partition.setSuffix( new DN( "ou=test,ou=system" ) );
         partition.setSchemaManager( schemaManager );
-        partition.setWorkingDirectory( wkdir.getAbsolutePath() );
+        partition.setPartitionPath( wkdir.toURI() );
 
         partition.setContextEntry( contextEntry );
         partition.initialize();

Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
Mon Dec 13 20:29:37 2010
@@ -210,12 +210,12 @@ public class SingleFileLdifPartitionTest
             rf.setLength( 0 );
         }
 
-        SingleFileLdifPartition partition = new SingleFileLdifPartition( fileName );
+        SingleFileLdifPartition partition = new SingleFileLdifPartition();
         partition.setCheckHasEntryDuringAdd( true );
         partition.setId( "test-ldif" );
+        partition.setPartitionPath( new File( fileName ).toURI() );
         partition.setSuffix( new DN( "ou=test,ou=system" ) );
         partition.setSchemaManager( schemaManager );
-        partition.setWorkingDirectory( ldifFileInUse.getParent() );
         partition.initialize();
 
         return partition;
@@ -279,7 +279,7 @@ public class SingleFileLdifPartitionTest
         assertNotNull( id );
         assertEquals( contextEntry, partition.lookup( id ) );
 
-        RandomAccessFile file = new RandomAccessFile( partition.getFileName(), "r" );
+        RandomAccessFile file = new RandomAccessFile( new File( partition.getPartitionPath()
), "r" );
 
         assertEquals( getEntryLdifLen( contextEntry ), file.length() );
 
@@ -367,7 +367,7 @@ public class SingleFileLdifPartitionTest
         modOpCtx.setDn( contextEntry.getDn() );
 
         partition.modify( modOpCtx );
-        RandomAccessFile file = new RandomAccessFile( partition.getFileName(), "r" );
+        RandomAccessFile file = new RandomAccessFile( new File( partition.getPartitionPath()
), "r" );
         assertEquals( getEntryLdifLen( modOpCtx.getAlteredEntry() ), file.length() );
 
         // perform the above operation, this time without causing change to the entry's size
@@ -551,7 +551,7 @@ public class SingleFileLdifPartitionTest
         delOpCtx.setDn( contextEntry.getDn() );
 
         partition.delete( delOpCtx );
-        RandomAccessFile file = new RandomAccessFile( partition.getFileName(), "r" );
+        RandomAccessFile file = new RandomAccessFile( new File( partition.getPartitionPath()
), "r" );
 
         assertEquals( 0L, file.length() );
         assertNull( partition.getContextEntry() );
@@ -845,7 +845,7 @@ public class SingleFileLdifPartitionTest
         assertNotNull( id );
         assertEquals( contextEntry, partition.lookup( id ) );
 
-        RandomAccessFile file = new RandomAccessFile( partition.getFileName(), "r" );
+        RandomAccessFile file = new RandomAccessFile( new File( partition.getPartitionPath()
), "r" );
 
         // but the file will be empty
         assertFalse( getEntryLdifLen( contextEntry ) == file.length() );

Modified: directory/apacheds/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/pom.xml?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/pom.xml (original)
+++ directory/apacheds/trunk/pom.xml Mon Dec 13 20:29:37 2010
@@ -142,6 +142,10 @@
     <module>ldap-client-test</module>
     <module>service</module>
     <module>wrapper</module>
+    <!--
+    <module>hbase-partition</module>
+    <module>hbase-partition-test</module>
+    -->
   </modules>
   
   <profiles>

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ChangePasswordConfigReaderTest.java
Mon Dec 13 20:29:37 2010
@@ -109,8 +109,9 @@ public class ChangePasswordConfigReaderT
         File configDir = new File( workDir, "changePasswordServer" ); // could be any directory,
cause the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "changePasswordServer.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         

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=1045362&r1=1045361&r2=1045362&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 Dec 13 20:29:37 2010
@@ -103,8 +103,9 @@ public class ConfigPartitionReaderTest
 
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "config.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
 

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigWriterTest.java
Mon Dec 13 20:29:37 2010
@@ -111,8 +111,9 @@ public class ConfigWriterTest
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "config.ldif",
true );
 
         // Creating of the config partition
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         configPartition.initialize();

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
Mon Dec 13 20:29:37 2010
@@ -102,8 +102,9 @@ public class DhcpServerConfigReaderTest
         File configDir = new File( workDir, "dhcpServer" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "dhcpServer.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/DnsServerConfigReaderTest.java
Mon Dec 13 20:29:37 2010
@@ -100,8 +100,9 @@ public class DnsServerConfigReaderTest
         File configDir = new File( workDir, "dnsServer" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "dnsServer.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/HttpServerConfigReaderTest.java
Mon Dec 13 20:29:37 2010
@@ -100,8 +100,9 @@ public class HttpServerConfigReaderTest
         File configDir = new File( workDir, "httpServer" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "httpServer.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/KerberosServerConfigReaderTest.java
Mon Dec 13 20:29:37 2010
@@ -101,8 +101,9 @@ public class KerberosServerConfigReaderT
         File configDir = new File( workDir, "kerberosServer" ); // could be any directory,
cause the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "kerberosServer.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
Mon Dec 13 20:29:37 2010
@@ -101,8 +101,9 @@ public class LdapServerConfigReaderTest
         File configDir = new File( workDir, "ldapServer" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "ldapServer.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
Mon Dec 13 20:29:37 2010
@@ -100,8 +100,9 @@ public class NtpServerConfigReaderTest
         File configDir = new File( workDir, "ntpServer" ); // could be any directory, cause
the config is now in a single file
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "ntpServer.ldif",
true );
 
-        SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
+        SingleFileLdifPartition configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
+        configPartition.setPartitionPath( new File( configFile ).toURI() );
         configPartition.setSuffix( new DN( "ou=config" ) );
         configPartition.setSchemaManager( schemaManager );
         

Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
(original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
Mon Dec 13 20:29:37 2010
@@ -134,7 +134,8 @@ public class ApacheDS
             {
                 if( p instanceof BTreePartition )
                 {
-                    ( ( BTreePartition ) p ).setPartitionDir( new File( directoryService.getInstanceLayout().getPartitionsDirectory(),
p.getId() ) );
+                    File partitionPath = new File( directoryService.getInstanceLayout().getPartitionsDirectory(),
p.getId() );
+                    ( ( BTreePartition ) p ).setPartitionPath( partitionPath.toURI() );
                 }
                 
                 if( p.getSchemaManager() == null )
@@ -148,7 +149,8 @@ public class ApacheDS
             
             if( sysPartition instanceof BTreePartition )
             {
-                ( ( BTreePartition ) sysPartition ).setPartitionDir( new File( directoryService.getInstanceLayout().getPartitionsDirectory(),
sysPartition.getId() ) );
+                File partitionPath = new File( directoryService.getInstanceLayout().getPartitionsDirectory(),
sysPartition.getId() );
+                ( ( BTreePartition ) sysPartition ).setPartitionPath( partitionPath.toURI()
);
             }
 
             if( sysPartition.getSchemaManager() == null )
@@ -477,7 +479,7 @@ public class ApacheDS
         // Init the LdifPartition
         LdifPartition ldifPartition = new LdifPartition();
         String workingDirectory = directoryService.getInstanceLayout().getPartitionsDirectory().getPath();
-        ldifPartition.setWorkingDirectory( workingDirectory + "/schema" );
+        ldifPartition.setPartitionPath( new File( workingDirectory, "schema" ).toURI() );
 
         // Extract the schema on disk (a brand new one) and load the registries
         File schemaRepository = new File( workingDirectory, "schema" );

Modified: directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
(original)
+++ directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
Mon Dec 13 20:29:37 2010
@@ -999,7 +999,7 @@ public class ServiceBuilder
         else
         {
             // Set the Partition working dir as a default
-            index.setWkDirPath( partition.getPartitionDir() );
+            index.setWkDirPath( new File( partition.getPartitionPath() ) );
         }
                 
         return index;
@@ -1045,7 +1045,8 @@ public class ServiceBuilder
         jdbmPartition.setCacheSize( jdbmPartitionBean.getPartitionCacheSize() );
         jdbmPartition.setId( jdbmPartitionBean.getPartitionId() );
         jdbmPartition.setOptimizerEnabled( jdbmPartitionBean.isJdbmPartitionOptimizerEnabled()
);
-        jdbmPartition.setPartitionDir( new File( directoryService.getInstanceLayout().getPartitionsDirectory(),
jdbmPartitionBean.getPartitionId() ) );
+        File partitionPath = new File( directoryService.getInstanceLayout().getPartitionsDirectory(),
jdbmPartitionBean.getPartitionId() );
+        jdbmPartition.setPartitionPath( partitionPath.toURI() );
         
         try
         {

Modified: directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
(original)
+++ directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
Mon Dec 13 20:29:37 2010
@@ -197,7 +197,7 @@ public class ApacheDsService
 
         // Init the LdifPartition
         schemaLdifPartition = new LdifPartition();
-        schemaLdifPartition.setWorkingDirectory( schemaPartitionDirectory.getPath() );
+        schemaLdifPartition.setPartitionPath( schemaPartitionDirectory.toURI() );
 
         // Extract the schema on disk (a brand new one) and load the registries
         if ( schemaPartitionDirectory.exists() )
@@ -249,10 +249,10 @@ public class ApacheDsService
             isConfigPartitionFirstExtraction = true;
         }
 
-        configPartition = new SingleFileLdifPartition( confFile.getAbsolutePath() );
-
+        configPartition = new SingleFileLdifPartition();
         configPartition.setId( "config" );
-        configPartition.setSuffix( new DN( "ou=config" ) );
+        configPartition.setPartitionPath( confFile.toURI() );
+        configPartition.setSuffix( new DN( "ou=config", schemaManager ) );
         configPartition.setSchemaManager( schemaManager );
 
         configPartition.initialize();

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=1045362&r1=1045361&r2=1045362&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
Mon Dec 13 20:29:37 2010
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 
 import java.io.File;
+import java.net.URI;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -80,7 +81,9 @@ public abstract class BTreePartition<ID>
     
     /** The root DN for this partition */
     protected DN suffix;
-    private File partitionDir;
+    
+    /** The path in which this Partition stores files */
+    protected URI partitionPath;
 
     /** The set of indexed attributes */
     private Set<Index<? extends Object, Entry, ID>> indexedAttributes;
@@ -103,24 +106,25 @@ public abstract class BTreePartition<ID>
     // C O N F I G U R A T I O N   M E T H O D S
     // ------------------------------------------------------------------------
     /**
-     * Gets the directory in which this Partition stores files.
+     * Gets the path in which this Partition stores data.
      *
-     * @return the directory in which this Partition stores files.
+     * @return the path in which this Partition stores data.
      */
-    public File getPartitionDir()
+    public URI getPartitionPath()
     {
-        return partitionDir;
+        return partitionPath;
     }
 
 
     /**
-     * Sets the directory in which this Partition stores files.
+     * Sets the path in which this Partition stores data. This may be an URL to
+     * a file or directory, or an JDBC URL.
      *
-     * @param partitionDir the directory in which this Partition stores files.
+     * @param partitionDir the path in which this Partition stores data.
      */
-    public void setPartitionDir( File partitionDir )
+    public void setPartitionPath( URI partitionPath )
     {
-        this.partitionDir = partitionDir;
+        this.partitionPath = partitionPath;
     }
 
 



Mime
View raw message