directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r937693 - in /directory/apacheds/trunk: avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/ jdbm-partition/src/main/java/org/apache/director...
Date Sat, 24 Apr 2010 20:46:46 GMT
Author: seelmann
Date: Sat Apr 24 20:46:45 2010
New Revision: 937693

URL: http://svn.apache.org/viewvc?rev=937693&view=rev
Log:
Removed duplicate suffix getter/setters, moved suffix getter/setter to super class

Modified:
    directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
    directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
    directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.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/LdifStore.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
    directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java

Modified: directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
(original)
+++ directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlPartition.java
Sat Apr 24 20:46:45 2010
@@ -87,8 +87,8 @@ public class AvlPartition extends Abstra
 
         // initialize the store
         store.setId( getId() );
-        suffix.normalize( schemaManager.getNormalizerMapping() );
-        store.setSuffixDn( suffix.getName() );
+        suffixDn.normalize( schemaManager.getNormalizerMapping() );
+        store.setSuffixDn( suffixDn );
 
         Set<Index<?, ServerEntry, Long>> userIndices = new HashSet<Index<?,
ServerEntry, Long>>();
 

Modified: directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
(original)
+++ directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
Sat Apr 24 20:46:45 2010
@@ -47,7 +47,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
-import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchObjectException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -123,14 +122,6 @@ public class AvlStore<E> extends Abstrac
     /** a map of attributeType numeric ID to system userIndices */
     private Map<String, AvlIndex<? extends Object, E>> systemIndices = new HashMap<String,
AvlIndex<? extends Object, E>>();
 
-    /** 
-     * TODO we need to check out why we have so many suffix 
-     * dn and string accessor/mutators on both Store and Partition
-     * interfaces.  I think a lot of this comes from the fact 
-     * that we implemented DN to have both the up and norm
-     * names.
-     */
-    private DN suffixDn;
 
     /**
      * {@inheritDoc}
@@ -499,65 +490,6 @@ public class AvlStore<E> extends Abstrac
     /**
      * {@inheritDoc}
      */
-    public DN getSuffix()
-    {
-        if ( suffixDn == null )
-        {
-            return null;
-        }
-
-        try
-        {
-            return new DN( suffixDn.getNormName() );
-        }
-        catch ( LdapInvalidDnException e )
-        {
-            // shouldn't happen
-            LOG.error( "", e );
-        }
-
-        return null;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public DN getUpSuffix()
-    {
-        if ( suffixDn == null )
-        {
-            return null;
-        }
-
-        try
-        {
-            return new DN( suffixDn.getName() );
-        }
-        catch ( LdapInvalidDnException e )
-        {
-            // shouldn't happen
-            LOG.error( "", e );
-        }
-
-        return null;
-    }
-
-
-    public String getSuffixDn()
-    {
-        if ( suffixDn == null )
-        {
-            return null;
-        }
-
-        return suffixDn.getName();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public Index<?, E, Long> getSystemIndex( String id ) throws IndexNotFoundException
     {
         try
@@ -1634,23 +1566,6 @@ public class AvlStore<E> extends Abstrac
     /**
      * {@inheritDoc}
      */
-    public void setSuffixDn( String suffixDn )
-    {
-        protect( "suffixDn" );
-        try
-        {
-            this.suffixDn = new DN( suffixDn );
-        }
-        catch ( LdapInvalidDnException e )
-        {
-            throw new IllegalArgumentException( e );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public void setUpdnIndex( Index<String, E, Long> index ) throws Exception
     {
         protect( "updnIndex" );

Modified: directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
(original)
+++ directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
Sat Apr 24 20:46:45 2010
@@ -86,6 +86,7 @@ public class AvlStoreTest
     private static File wkdir;
     private static AvlStore<ServerEntry> store;
     private static SchemaManager schemaManager = null;
+    private static DN EXAMPLE_COM;
 
 
     @BeforeClass
@@ -113,6 +114,9 @@ public class AvlStoreTest
         {
             fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors()
) );
         }
+
+        EXAMPLE_COM = new DN( "dc=example,dc=com" );
+        EXAMPLE_COM.normalize( schemaManager.getNormalizerMapping() );
     }
 
 
@@ -186,15 +190,14 @@ public class AvlStoreTest
         assertNotNull( store.getSubAliasIndex() );
 
         assertNull( store.getSuffixDn() );
-        store.setSuffixDn( "dc=example,dc=com" );
-        assertEquals( "dc=example,dc=com", store.getSuffixDn() );
+        store.setSuffixDn( EXAMPLE_COM );
+        assertEquals( "dc=example,dc=com", store.getSuffixDn().getName() );
 
         assertNull( store.getUpdnIndex() );
         store.setUpdnIndex( new AvlIndex<String, Attributes>( "updn" ) );
         assertNotNull( store.getUpdnIndex() );
 
-        assertNotNull( store.getUpSuffix() );
-        assertNotNull( store.getSuffix() );
+        assertNotNull( store.getSuffixDn() );
 
         assertEquals( 0, store.getUserIndices().size() );
         Set<Index<?, Attributes, Long>> set = new HashSet<Index<?, Attributes,
Long>>();
@@ -304,7 +307,7 @@ public class AvlStoreTest
         assertNotNull( store.getSuffixDn() );
         try
         {
-            store.setSuffixDn( "dc=example,dc=com" );
+            store.setSuffixDn( EXAMPLE_COM );
             fail();
         }
         catch ( IllegalStateException e )
@@ -347,8 +350,7 @@ public class AvlStoreTest
         {
         }
 
-        assertNotNull( store.getUpSuffix() );
-        assertNotNull( store.getSuffix() );
+        assertNotNull( store.getSuffixDn() );
 
         assertEquals( 2, store.getUserIndices().size() );
         assertFalse( store.hasUserIndexOn( "dc" ) );

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=937693&r1=937692&r2=937693&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
Sat Apr 24 20:46:45 2010
@@ -82,8 +82,8 @@ public class JdbmPartition extends Abstr
         store.setId( id );
 
         // Normalize the suffix
-        suffix.normalize( schemaManager.getNormalizerMapping() );
-        store.setSuffixDn( suffix.getNormName() );
+        suffixDn.normalize( schemaManager.getNormalizerMapping() );
+        store.setSuffixDn( suffixDn );
         store.setPartitionDir( getPartitionDir() );
 
         Set<Index<?, ServerEntry, Long>> userIndices = new HashSet<Index<?,
ServerEntry, Long>>();

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Sat Apr 24 20:46:45 2010
@@ -75,12 +75,6 @@ public class JdbmStore<E> extends Abstra
     /** the JDBM record manager used by this database */
     private RecordManager recMan;
 
-    /** the normalized suffix DN of this backend database */
-    private DN normSuffix;
-
-    /** the user provided suffix DN of this backend database */
-    private DN upSuffix;
-
     /** the master table storing entries by primary key */
     private JdbmMasterTable<ServerEntry> master;
 
@@ -127,7 +121,6 @@ public class JdbmStore<E> extends Abstra
     private static AttributeType ALIASED_OBJECT_NAME_AT;
 
     private DN contextEntryDn;
-    private String suffixDn;
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
@@ -142,21 +135,6 @@ public class JdbmStore<E> extends Abstra
     // -----------------------------------------------------------------------
     // C O N F I G U R A T I O N   M E T H O D S
     // -----------------------------------------------------------------------
-
-
-    public void setSuffixDn( String suffixDn )
-    {
-        protect( "suffixDn" );
-        this.suffixDn = suffixDn;
-    }
-
-
-    public String getSuffixDn()
-    {
-        return suffixDn;
-    }
-
-
     public Long getDefaultId()
     {
         return 1L;
@@ -179,8 +157,6 @@ public class JdbmStore<E> extends Abstra
         ENTRY_CSN_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_CSN_AT
);
         ENTRY_UUID_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_UUID_AT
);
 
-        this.upSuffix = new DN( suffixDn );
-        this.normSuffix = DN.normalize( upSuffix, schemaManager.getNormalizerMapping() );
         partitionDir.mkdirs();
 
         // First, check if the file storing the data exists
@@ -858,9 +834,9 @@ public class JdbmStore<E> extends Abstra
         }
         
         int dnSize = dn.size();
-        int i = normSuffix.size(); 
+        int i = suffixDn.size(); 
 
-        RDN key = new RDN( normSuffix.getNormName() );
+        RDN key = new RDN( suffixDn.getNormName() );
         key._setParentId( 0 );
         
         Long curEntryId = rdnIdx.forwardLookup( key );
@@ -949,9 +925,9 @@ public class JdbmStore<E> extends Abstra
         normDN.normalize( schemaManager.getNormalizerMapping() );
         
         int dnSize = normDN.size();
-        int i = normSuffix.size(); 
+        int i = suffixDn.size(); 
 
-        RDN key = new RDN( normSuffix.getNormName() );
+        RDN key = new RDN( suffixDn.getNormName() );
         key._setParentId( 0 );
 
         Long curEntryId = rdnIdx.forwardLookup( key );
@@ -982,7 +958,7 @@ public class JdbmStore<E> extends Abstra
         DN normDN = new DN( dn );
         normDN.normalize( schemaManager.getNormalizerMapping() );
         
-        if( normSuffix.equals( normDN ) )
+        if( suffixDn.equals( normDN ) )
         {
             return 0L;
         }
@@ -1057,7 +1033,7 @@ public class JdbmStore<E> extends Abstra
         oneAliasIdx.drop( ancestorId, targetId );
         subAliasIdx.drop( ancestorId, targetId );
 
-        while ( !ancestorDn.equals( normSuffix ) && ancestorDn.size() > normSuffix.size()
)
+        while ( !ancestorDn.equals( suffixDn ) && ancestorDn.size() > suffixDn.size()
)
         {
             ancestorDn = ( DN ) ancestorDn.getPrefix( ancestorDn.size() - 1 );
             ancestorId = getEntryId( ancestorDn.getNormName() );
@@ -1126,9 +1102,9 @@ public class JdbmStore<E> extends Abstra
          * need to point it out to the user instead of saying the target
          * does not exist when it potentially could outside of this upSuffix.
          */
-        if ( !normalizedAliasTargetDn.isChildOf( normSuffix ) )
+        if ( !normalizedAliasTargetDn.isChildOf( suffixDn ) )
         {
-            String msg = I18n.err( I18n.ERR_225, upSuffix.getName() );
+            String msg = I18n.err( I18n.ERR_225, suffixDn.getName() );
             LdapAliasDereferencingException e = new LdapAliasDereferencingException( msg
);
             //e.setResolvedName( aliasDn );
             throw e;
@@ -1202,7 +1178,7 @@ public class JdbmStore<E> extends Abstra
          * ignored since everything is under its scope.  The first loop 
          * iteration shall handle the parents.
          */
-        while ( !ancestorDn.equals( normSuffix ) && null != ancestorId )
+        while ( !ancestorDn.equals( suffixDn ) && null != ancestorId )
         {
             if ( !NamespaceTools.isDescendant( ancestorDn, normalizedAliasTargetDn ) )
             {
@@ -1241,10 +1217,10 @@ public class JdbmStore<E> extends Abstra
         DN parentDn = null;
         RDN rdn = null;
 
-        if ( entryDn.getNormName().equals( normSuffix.getNormName() ) )
+        if ( entryDn.getNormName().equals( suffixDn.getNormName() ) )
         {
             parentId = 0L;
-            rdn = new RDN( normSuffix.getNormName() );
+            rdn = new RDN( suffixDn.getNormName() );
             rdn.setUpName( entryDn.getName() );
         }
         else
@@ -1460,18 +1436,6 @@ public class JdbmStore<E> extends Abstra
     }
 
 
-    public DN getSuffix()
-    {
-        return normSuffix;
-    }
-
-
-    public DN getUpSuffix()
-    {
-        return upSuffix;
-    }
-
-
     public void setProperty( String propertyName, String propertyValue ) throws Exception
     {
         master.setProperty( propertyName, propertyValue );
@@ -2236,7 +2200,7 @@ public class JdbmStore<E> extends Abstra
 
         subAliasIdx.drop( ancestorId, targetId );
 
-        while ( !ancestorDn.equals( upSuffix ) )
+        while ( !ancestorDn.equals( suffixDn ) )
         {
             ancestorDn = ( DN ) ancestorDn.getPrefix( 1 );
             ancestorId = getEntryId( ancestorDn.getNormName() );

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
Sat Apr 24 20:46:45 2010
@@ -88,6 +88,7 @@ public class JdbmStoreTest
     JdbmStore<ServerEntry> store;
     private static SchemaManager schemaManager = null;
     private static LdifSchemaLoader loader;
+    private static DN EXAMPLE_COM;
 
 
     @BeforeClass
@@ -114,6 +115,9 @@ public class JdbmStoreTest
         {
             fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors()
) );
         }
+
+        EXAMPLE_COM = new DN( "dc=example,dc=com" );
+        EXAMPLE_COM.normalize( schemaManager.getNormalizerMapping() );
     }
 
 
@@ -183,7 +187,7 @@ public class JdbmStoreTest
         store2.setSyncOnWrite( false );
         store2.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
         store2.addIndex( new JdbmIndex( SchemaConstants.UID_AT_OID ) );
-        store2.setSuffixDn( "dc=example,dc=com" );
+        store2.setSuffixDn( EXAMPLE_COM );
         store2.init( schemaManager );
 
         // inject context entry
@@ -246,11 +250,10 @@ public class JdbmStoreTest
         assertNotNull( store.getSubAliasIndex() );
 
         assertNull( store.getSuffixDn() );
-        store.setSuffixDn( "dc=example,dc=com" );
-        assertEquals( "dc=example,dc=com", store.getSuffixDn() );
+        store.setSuffixDn( EXAMPLE_COM );
+        assertEquals( "dc=example,dc=com", store.getSuffixDn().getName() );
 
-        assertNull( store.getUpSuffix() );
-        assertNull( store.getSuffix() );
+        assertNotNull( store.getSuffixDn() );
 
         assertEquals( 0, store.getUserIndices().size() );
         Set<Index<?, Attributes, Long>> set = new HashSet<Index<?, Attributes,
Long>>();
@@ -359,7 +362,7 @@ public class JdbmStoreTest
         assertNotNull( store.getSuffixDn() );
         try
         {
-            store.setSuffixDn( "dc=example,dc=com" );
+            store.setSuffixDn( EXAMPLE_COM );
             fail();
         }
         catch ( IllegalStateException e )
@@ -393,8 +396,7 @@ public class JdbmStoreTest
         {
         }
 
-        assertNotNull( store.getUpSuffix() );
-        assertNotNull( store.getSuffix() );
+        assertNotNull( store.getSuffixDn() );
 
         assertEquals( 2, store.getUserIndices().size() );
         assertFalse( store.hasUserIndexOn( "dc" ) );

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=937693&r1=937692&r2=937693&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
Sat Apr 24 20:46:45 2010
@@ -158,7 +158,7 @@ public class LdifPartition extends BTree
     {
         // Initialize the AvlPartition
         wrappedPartition.setId( id );
-        wrappedPartition.setSuffix( suffix.getName() );
+        wrappedPartition.setSuffix( suffixDn.getName() );
         wrappedPartition.setSchemaManager( schemaManager );
         wrappedPartition.initialize();
 
@@ -172,19 +172,19 @@ public class LdifPartition extends BTree
 
         // Initialize the suffixDirectory : it's a composition
         // of the workingDirectory followed by the suffix
-        if ( ( suffix == null ) || ( suffix.isEmpty() ) )
+        if ( ( suffixDn == null ) || ( suffixDn.isEmpty() ) )
         {
             String msg = I18n.err( I18n.ERR_150 );
             LOG.error( msg );
             throw new LdapInvalidDnException( msg );
         }
 
-        if ( !suffix.isNormalized() )
+        if ( !suffixDn.isNormalized() )
         {
-            suffix.normalize( schemaManager.getNormalizerMapping() );
+            suffixDn.normalize( schemaManager.getNormalizerMapping() );
         }
 
-        String suffixDirName = getFileName( suffix );
+        String suffixDirName = getFileName( suffixDn );
         suffixDirectory = new File( workingDirectory, suffixDirName );
 
         // Create the context entry now, if it does not exists, or load the
@@ -516,7 +516,7 @@ public class LdifPartition extends BTree
         StringBuilder filePath = new StringBuilder();
         filePath.append( suffixDirectory ).append( File.separator );
 
-        DN baseDn = ( DN ) entryDn.getSuffix( suffix.size() );
+        DN baseDn = ( DN ) entryDn.getSuffix( suffixDn.size() );
 
         for ( int i = 0; i < baseDn.size() - 1; i++ )
         {

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifStore.java
Sat Apr 24 20:46:45 2010
@@ -91,7 +91,7 @@ public class LdifStore<E> extends Abstra
      */
     public void loadConfig() throws Exception
     {
-        String upsuffixDir = wrappedStore.getUpSuffix().getName().toLowerCase();
+        String upsuffixDir = wrappedStore.getSuffixDn().getName().toLowerCase();
         File dir = new File( partitionDir, upsuffixDir );
 
         if ( !dir.exists() )
@@ -544,24 +544,12 @@ public class LdifStore<E> extends Abstra
     }
 
 
-    public DN getSuffix()
-    {
-        return wrappedStore.getSuffix();
-    }
-
-
-    public String getSuffixDn()
+    public DN getSuffixDn()
     {
         return wrappedStore.getSuffixDn();
     }
 
 
-    public DN getUpSuffix()
-    {
-        return wrappedStore.getUpSuffix();
-    }
-
-
     public void setCacheSize( int size )
     {
         wrappedStore.setCacheSize( size );
@@ -574,7 +562,7 @@ public class LdifStore<E> extends Abstra
     }
 
 
-    public void setSuffixDn( String suffixDn )
+    public void setSuffixDn( DN suffixDn )
     {
         wrappedStore.setSuffixDn( suffixDn );
     }

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
Sat Apr 24 20:46:45 2010
@@ -92,7 +92,7 @@ public abstract class BTreePartition<ID>
 
     protected String id;
     protected int cacheSize = -1;
-    protected DN suffix;
+    protected DN suffixDn;
     private File partitionDir;
 
     /** The rootDSE context */
@@ -511,7 +511,7 @@ public abstract class BTreePartition<ID>
      */
     public void setSuffix( String suffix ) throws LdapInvalidDnException
     {
-        this.suffix = new DN( suffix );
+        this.suffixDn = new DN( suffix );
     }
 
 
@@ -520,7 +520,7 @@ public abstract class BTreePartition<ID>
      */
     public String getSuffix()
     {
-        return suffix.getName();
+        return suffixDn.getName();
     }
 
 
@@ -529,7 +529,7 @@ public abstract class BTreePartition<ID>
      */
     public DN getSuffixDn()
     {
-        return suffix;
+        return suffixDn;
     }
 
 

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
Sat Apr 24 20:46:45 2010
@@ -23,6 +23,7 @@ package org.apache.directory.server.xdbm
 import java.io.File;
 
 import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
@@ -53,6 +54,9 @@ public abstract class AbstractStore<E, I
     /** The store unique identifier */
     protected String id;
 
+    /** The suffix DN */
+    protected DN suffixDn;
+
     /** A pointer on the schemaManager */
     protected SchemaManager schemaManager;
 
@@ -123,4 +127,20 @@ public abstract class AbstractStore<E, I
         return id;
     }
 
+
+    public void setSuffixDn( DN suffixDn )
+    {
+        protect( "suffixDn" );
+        if ( !suffixDn.isNormalized() )
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_218, suffixDn.getName()
) );
+        }
+        this.suffixDn = suffixDn;
+    }
+
+
+    public DN getSuffixDn()
+    {
+        return suffixDn;
+    }
 }

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
Sat Apr 24 20:46:45 2010
@@ -116,10 +116,20 @@ public interface Store<E, ID>
     Set<Index<?, E, ID>> getUserIndices();
 
 
-    void setSuffixDn( String suffixDn );
+    /**
+     * Sets the suffix DN, must be normalized.
+     * 
+     * @param suffixDn the new suffix DN
+     */
+    void setSuffixDn( DN suffixDn );
 
 
-    String getSuffixDn();
+    /**
+     * Gets the suffix DN.
+     * 
+     * @return the suffix DN
+     */
+    DN getSuffixDn();
 
 
     /**
@@ -506,12 +516,6 @@ public interface Store<E, ID>
     int getChildCount( ID id ) throws Exception;
 
 
-    DN getSuffix();
-
-
-    DN getUpSuffix();
-
-
     void setProperty( String propertyName, String propertyValue ) throws Exception;
 
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
Sat Apr 24 20:46:45 2010
@@ -74,7 +74,7 @@ public class DefaultOptimizer<E, ID> imp
         {
             try
             {
-                this.contextEntryId = db.getEntryId( db.getSuffix().getNormName() );
+                this.contextEntryId = db.getEntryId( db.getSuffixDn().getNormName() );
             }
             catch ( Exception e )
             {

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
Sat Apr 24 20:46:45 2010
@@ -100,7 +100,7 @@ public class SubtreeScopeCursor<ID> exte
         {
             try
             {
-                this.contextEntryId = db.getEntryId( db.getSuffix().getNormName() );
+                this.contextEntryId = db.getEntryId( db.getSuffixDn().getNormName() );
             }
             catch ( Exception e )
             {

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
(original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
Sat Apr 24 20:46:45 2010
@@ -93,7 +93,7 @@ public class SubtreeScopeEvaluator<E, ID
         {
             try
             {
-                this.contextEntryId = db.getEntryId( db.getSuffix().getNormName() );
+                this.contextEntryId = db.getEntryId( db.getSuffixDn().getNormName() );
             }
             catch ( Exception e )
             {

Modified: directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java?rev=937693&r1=937692&r2=937693&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
(original)
+++ directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java
Sat Apr 24 20:46:45 2010
@@ -66,10 +66,9 @@ public class StoreUtils
      */
     public static void loadExampleData( Store<ServerEntry, Long> store, SchemaManager
schemaManager ) throws Exception
     {
-        store.setSuffixDn( "o=Good Times Co." );
-
         DN suffixDn = new DN( "o=Good Times Co." );
         suffixDn.normalize( schemaManager.getNormalizerMapping() );
+        store.setSuffixDn( suffixDn );
 
         store.init( schemaManager );
 



Mime
View raw message