directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1376025 - in /directory/apacheds/branches/apacheds-mvbt: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ serv...
Date Wed, 22 Aug 2012 12:51:28 GMT
Author: elecharny
Date: Wed Aug 22 12:51:28 2012
New Revision: 1376025

URL: http://svn.apache.org/viewvc?rev=1376025&view=rev
Log:
o removed the JdbmRdnIndex( String attributeId ) constructor
o some other minor cleanup

Modified:
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/branches/apacheds-mvbt/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1376025&r1=1376024&r2=1376025&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
(original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
Wed Aug 22 12:51:28 2012
@@ -132,7 +132,7 @@ public class JdbmIndex<K, O> extends Abs
      */
     public JdbmIndex( String attributeId )
     {
-        super( attributeId, true );
+        this( attributeId, true );
         initialized = false;
     }
 
@@ -143,6 +143,7 @@ public class JdbmIndex<K, O> extends Abs
     public JdbmIndex( String attributeId, boolean withReverse )
     {
         super( attributeId, withReverse );
+
         initialized = false;
     }
 

Modified: directory/apacheds/branches/apacheds-mvbt/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-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1376025&r1=1376024&r2=1376025&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Wed Aug 22 12:51:28 2012
@@ -164,7 +164,7 @@ public class JdbmPartition extends Abstr
             {
                 allIndices.add( index.getAttribute().getOid() );
             }
-            
+
             List<Index<?, Entry, Long>> indexToBuild = new ArrayList<Index<?,
Entry, Long>>();
 
             // this loop is used for two purposes
@@ -175,7 +175,7 @@ public class JdbmPartition extends Abstr
             {
                 String indexOid = index.getAttribute().getOid();
                 allIndices.add( indexOid );
-                
+
                 // take the part after removing .db from the
                 String name = indexOid + JDBM_DB_FILE_EXTN;
 
@@ -186,7 +186,7 @@ public class JdbmPartition extends Abstr
                     indexToBuild.add( index );
                 }
             }
-            
+
             if ( indexToBuild.size() > 0 )
             {
                 buildUserIndex( indexToBuild );
@@ -269,25 +269,25 @@ public class JdbmPartition extends Abstr
             for ( Index index : userIndexes )
             {
                 AttributeType atType = index.getAttribute();
-  
+
                 String attributeOid = index.getAttribute().getOid();
-  
+
                 LOG.info( "building the index for attribute type {}", atType );
-          
+
                 Tuple<Long, Entry> tuple = cursor.get();
 
                 Long id = tuple.getKey();
                 Entry entry = tuple.getValue();
-    
+
                 Attribute entryAttr = entry.get( atType );
-    
+
                 if ( entryAttr != null )
                 {
                     for ( Value<?> value : entryAttr )
                     {
                         index.add( value.getValue(), id );
                     }
-    
+
                     // Adds only those attributes that are indexed
                     presenceIdx.add( attributeOid, id );
                 }
@@ -353,13 +353,9 @@ public class JdbmPartition extends Abstr
     {
         JdbmIndex<?, Entry> jdbmIndex;
 
-        if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_RDN_AT_OID ) )
+        if ( index instanceof JdbmRdnIndex )
         {
-            jdbmIndex = new JdbmRdnIndex();
-            jdbmIndex.setAttributeId( ApacheSchemaConstants.APACHE_RDN_AT_OID );
-            jdbmIndex.setCacheSize( index.getCacheSize() );
-            jdbmIndex.setNumDupLimit( JdbmIndex.DEFAULT_DUPLICATE_LIMIT );
-            jdbmIndex.setWkDirPath( index.getWkDirPath() );
+            jdbmIndex = ( JdbmRdnIndex ) index;
         }
         else if ( index instanceof JdbmIndex<?, ?> )
         {
@@ -429,10 +425,10 @@ public class JdbmPartition extends Abstr
     /**
      * {@inheritDoc}
      */
-    protected final Index createSystemIndex( String oid, URI path, boolean withReverse )
 throws Exception
+    protected final Index createSystemIndex( String oid, URI path, boolean withReverse )
throws Exception
     {
         LOG.debug( "Supplied index {} is not a JdbmIndex.  " +
-         "Will create new JdbmIndex using copied configuration parameters." );
+            "Will create new JdbmIndex using copied configuration parameters." );
         JdbmIndex<?, Entry> jdbmIndex;
 
         if ( oid.equals( ApacheSchemaConstants.APACHE_RDN_AT_OID ) )

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1376025&r1=1376024&r2=1376025&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
(original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
Wed Aug 22 12:51:28 2012
@@ -30,6 +30,7 @@ import javax.naming.NamingException;
 import jdbm.recman.BaseRecordManager;
 import jdbm.recman.SnapshotRecordManager;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.partition.impl.btree.LongComparator;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.ParentIdAndRdn;
@@ -55,18 +56,11 @@ public class JdbmRdnIndex<E> extends Jdb
 
     public JdbmRdnIndex()
     {
-        super();
+        super( ApacheSchemaConstants.APACHE_RDN_AT_OID );
         initialized = false;
     }
 
 
-    public JdbmRdnIndex( String attributeId )
-    {
-        initialized = false;
-        setAttributeId( attributeId );
-    }
-
-
     public void init( SchemaManager schemaManager, AttributeType attributeType ) throws IOException
     {
         LOG.debug( "Initializing an Index for attribute '{}'", attributeType.getName() );

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1376025&r1=1376024&r2=1376025&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
(original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
Wed Aug 22 12:51:28 2012
@@ -212,12 +212,12 @@ public class JdbmStoreTest
         // inject context entry
         Dn suffixDn = new Dn( schemaManager, "dc=example,dc=com" );
         Entry entry = new DefaultEntry( schemaManager, suffixDn,
-            "objectClass: top", 
+            "objectClass: top",
             "objectClass: domain",
             "dc: example",
             SchemaConstants.ENTRY_CSN_AT, new CsnFactory( 0 ).newInstance().toString(),
             SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
-        
+
         store2.add( new AddOperationContext( null, entry ) );
 
         // lookup the context entry
@@ -254,7 +254,7 @@ public class JdbmStoreTest
         assertEquals( "foo", jdbmPartition.getId() );
 
         assertNull( jdbmPartition.getRdnIndex() );
-        jdbmPartition.addIndex( new JdbmRdnIndex( ApacheSchemaConstants.APACHE_RDN_AT_OID
) );
+        jdbmPartition.addIndex( new JdbmRdnIndex() );
         assertNotNull( jdbmPartition.getRdnIndex() );
 
         assertNull( jdbmPartition.getOneAliasIndex() );
@@ -338,7 +338,7 @@ public class JdbmStoreTest
         assertNotNull( store.getRdnIndex() );
         try
         {
-            store.addIndex( new JdbmRdnIndex( ApacheSchemaConstants.APACHE_RDN_AT_OID ) );
+            store.addIndex( new JdbmRdnIndex() );
             fail();
         }
         catch ( IllegalStateException e )
@@ -425,7 +425,7 @@ public class JdbmStoreTest
         assertNotNull( userIndices.next() );
         assertFalse( userIndices.hasNext() );
         assertNotNull( store.getUserIndex( OU_AT ) );
-        
+
         try
         {
             store.getUserIndex( SN_AT );
@@ -494,9 +494,9 @@ public class JdbmStoreTest
         assertTrue( cursor.next() );
         assertEquals( 2L, ( long ) cursor.get().getId() );
         assertFalse( cursor.next() );
-        
+
         cursor.close();
-        
+
         assertEquals( 3, store.getChildCount( 1L ) );
 
         store.delete( 2L );
@@ -506,8 +506,8 @@ public class JdbmStoreTest
         // add an alias and delete to test dropAliasIndices method
         Dn dn = new Dn( schemaManager, "commonName=Jack Daniels,ou=Apache,ou=Board of Directors,o=Good
Times Co." );
         Entry entry = new DefaultEntry( schemaManager, dn,
-            "objectClass: top", 
-            "objectClass: alias", 
+            "objectClass: top",
+            "objectClass: alias",
             "objectClass: extensibleObject",
             "ou: Apache",
             "commonName: Jack Daniels",
@@ -527,8 +527,8 @@ public class JdbmStoreTest
     {
         Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co."
);
         Entry entry = new DefaultEntry( schemaManager, dn,
-            "objectClass: top", 
-            "objectClass: person", 
+            "objectClass: top",
+            "objectClass: person",
             "objectClass: organizationalPerson",
             "ou: Not Present",
             "cn: Martin King" );
@@ -568,8 +568,8 @@ public class JdbmStoreTest
     {
         Dn dn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co."
);
         Entry entry = new DefaultEntry( schemaManager, dn,
-            "objectClass: top", 
-            "objectClass: person", 
+            "objectClass: top",
+            "objectClass: person",
             "objectClass: organizationalPerson",
             "ou: Engineering",
             "cn: Private Ryan",
@@ -595,8 +595,8 @@ public class JdbmStoreTest
     {
         Dn dn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co."
);
         Entry entry = new DefaultEntry( schemaManager, dn,
-            "objectClass: top", 
-            "objectClass: person", 
+            "objectClass: top",
+            "objectClass: person",
             "objectClass: organizationalPerson",
             "ou: Engineering",
             "cn: Private Ryan",
@@ -623,8 +623,8 @@ public class JdbmStoreTest
     {
         Dn childDn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times
Co." );
         Entry childEntry = new DefaultEntry( schemaManager, childDn,
-            "objectClass: top", 
-            "objectClass: person", 
+            "objectClass: top",
+            "objectClass: person",
             "objectClass: organizationalPerson",
             "ou", "Engineering",
             "cn", "Private Ryan",
@@ -734,8 +734,8 @@ public class JdbmStoreTest
     {
         Dn dn = new Dn( schemaManager, "cn=Tim B,ou=Sales,o=Good Times Co." );
         Entry entry = new DefaultEntry( schemaManager, dn,
-            "objectClass: top", 
-            "objectClass: person", 
+            "objectClass: top",
+            "objectClass: person",
             "objectClass: organizationalPerson",
             "cn", "Tim B",
             "entryCSN", new CsnFactory( 1 ).newInstance().toString(),

Modified: directory/apacheds/branches/apacheds-mvbt/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java?rev=1376025&r1=1376024&r2=1376025&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
(original)
+++ directory/apacheds/branches/apacheds-mvbt/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
Wed Aug 22 12:51:28 2012
@@ -61,6 +61,7 @@ import org.apache.directory.server.confi
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.InstanceLayout;
+import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.api.changelog.ChangeLog;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.apache.directory.server.core.api.journal.Journal;
@@ -69,7 +70,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authn.Authenticator;
 import org.apache.directory.server.core.authn.DelegatingAuthenticator;
-import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.authn.ppolicy.PpolicyConfigContainer;
 import org.apache.directory.server.core.changelog.DefaultChangeLog;
 import org.apache.directory.server.core.journal.DefaultJournal;
@@ -1090,12 +1090,6 @@ public class ServiceBuilder
             return null;
         }
 
-        JdbmIndex<String, Entry> index = new JdbmIndex<String, Entry>();
-
-        index.setAttributeId( jdbmIndexBean.getIndexAttributeId() );
-        index.setCacheSize( jdbmIndexBean.getIndexCacheSize() );
-        index.setNumDupLimit( jdbmIndexBean.getIndexNumDupLimit() );
-
         String indexFileName = jdbmIndexBean.getIndexFileName();
 
         if ( indexFileName == null )
@@ -1103,6 +1097,11 @@ public class ServiceBuilder
             indexFileName = jdbmIndexBean.getIndexAttributeId();
         }
 
+        JdbmIndex<String, Entry> index = new JdbmIndex<String, Entry>( jdbmIndexBean.getIndexAttributeId()
);
+
+        index.setCacheSize( jdbmIndexBean.getIndexCacheSize() );
+        index.setNumDupLimit( jdbmIndexBean.getIndexNumDupLimit() );
+
         // Find the OID for this index
         SchemaManager schemaManager = directoryService.getSchemaManager();
 



Mime
View raw message