You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/06/20 16:16:26 UTC
svn commit: r191471 - in /directory/apacheds/branches/db_refactor/core/src:
main/java/org/apache/ldap/server/jndi/
main/java/org/apache/ldap/server/partition/
main/java/org/apache/ldap/server/partition/store/impl/btree/
main/java/org/apache/ldap/server...
Author: trustin
Date: Mon Jun 20 07:16:24 2005
New Revision: 191471
URL: http://svn.apache.org/viewcvs?rev=191471&view=rev
Log:
Merged PartitionStore into BTreeContextPartition
JdbmPartitionStore now extends BTreeContextPartition
Removed:
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/PartitionStore.java
Modified:
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/SystemPartition.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ApplicationPartition.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/BTreeContextPartition.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultOptimizer.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultSearchEngine.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEnumerator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEvaluator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/LeafEvaluator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEnumerator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEvaluator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SearchResultEnumeration.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEnumerator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEvaluator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/EntryNode.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/MainFrame.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/PartitionViewer.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/jdbm/JdbmPartitionStore.java
directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsAdminTest.java
directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsNonAdminTest.java
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java Mon Jun 20 07:16:24 2005
@@ -51,9 +51,9 @@
import org.apache.ldap.server.partition.store.impl.btree.DefaultSearchEngine;
import org.apache.ldap.server.partition.store.impl.btree.ExpressionEnumerator;
import org.apache.ldap.server.partition.store.impl.btree.ExpressionEvaluator;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStore;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
import org.apache.ldap.server.partition.store.impl.btree.SearchEngine;
-import org.apache.ldap.server.partition.store.impl.btree.jdbm.JdbmPartitionStore;
+import org.apache.ldap.server.partition.store.impl.btree.jdbm.JdbmBTreeContextPartition;
import org.apache.ldap.server.schema.AttributeTypeRegistry;
import org.apache.ldap.server.schema.ConcreteNameComponentNormalizer;
import org.apache.ldap.server.schema.GlobalRegistries;
@@ -513,7 +513,7 @@
LdapName suffix = new LdapName();
suffix.add( SystemPartition.SUFFIX );
- PartitionStore db = new JdbmPartitionStore( suffix, suffix, workDir.getPath() );
+ BTreeContextPartition db = new JdbmBTreeContextPartition( suffix, suffix, workDir.getPath() );
AttributeTypeRegistry attributeTypeRegistry = bootstrapRegistries .getAttributeTypeRegistry();
OidRegistry oidRegistry = bootstrapRegistries.getOidRegistry();
ExpressionEvaluator evaluator = new ExpressionEvaluator( db, oidRegistry, attributeTypeRegistry );
@@ -577,7 +577,7 @@
Name upSuffix = new LdapName( cfg.getSuffix() );
Normalizer dnNorm = reg.lookup( "distinguishedNameMatch" ) .getNormalizer();
Name normSuffix = new LdapName( ( String ) dnNorm.normalize( cfg.getSuffix() ) );
- PartitionStore db = new JdbmPartitionStore( upSuffix, normSuffix, partitionWorkDir.getPath() );
+ BTreeContextPartition db = new JdbmBTreeContextPartition( upSuffix, normSuffix, partitionWorkDir.getPath() );
// ----------------------------------------------------------------
// create the search engine using db, enumerators and evaluators
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/SystemPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/SystemPartition.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/SystemPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/SystemPartition.java Mon Jun 20 07:16:24 2005
@@ -27,7 +27,7 @@
import org.apache.ldap.common.util.DateUtils;
import org.apache.ldap.common.util.NamespaceTools;
import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStore;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
import org.apache.ldap.server.partition.store.impl.btree.SearchEngine;
@@ -162,7 +162,7 @@
* also contain all system index attribute types - if not the system will
* not operate correctly.
*/
- public SystemPartition( PartitionStore db, SearchEngine searchEngine,
+ public SystemPartition( BTreeContextPartition db, SearchEngine searchEngine,
AttributeType[] indexAttributes )
throws NamingException
{
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ApplicationPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ApplicationPartition.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ApplicationPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ApplicationPartition.java Mon Jun 20 07:16:24 2005
@@ -22,7 +22,7 @@
import org.apache.ldap.common.schema.AttributeType;
import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStore;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
import org.apache.ldap.server.partition.store.impl.btree.SearchEngine;
@@ -60,7 +60,7 @@
* @throws NamingException on failures while creating this partition
*/
public ApplicationPartition(
- PartitionStore db, SearchEngine searchEngine, AttributeType[] indexAttributes )
+ BTreeContextPartition db, SearchEngine searchEngine, AttributeType[] indexAttributes )
throws NamingException
{
super( db, searchEngine, indexAttributes );
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java Mon Jun 20 07:16:24 2005
@@ -145,7 +145,7 @@
*
* @param base the base distinguished/absolute name for the search/listing
* @return a NamingEnumeration containing objects of type
- * {@link org.apache.ldap.server.partition.store.impl.btree.jdbm.PartitionStoreSearchResult}
+ * {@link org.apache.ldap.server.partition.store.impl.btree.jdbm.BTreeContextPartitionSearchResult}
* @throws NamingException if there are any problems
*/
NamingEnumeration list( Name base ) throws NamingException;
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/BTreeContextPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/BTreeContextPartition.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/BTreeContextPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/BTreeContextPartition.java Mon Jun 20 07:16:24 2005
@@ -19,6 +19,7 @@
import java.math.BigInteger;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import javax.naming.Name;
@@ -103,12 +104,6 @@
public static final String ALIAS_OID = "1.2.6.1.4.1.18060.1.1.1.3.7" ;
/**
- * the database used for this backing store which is also initialized during
- * configuration time
- */
- private PartitionStore db = null;
-
- /**
* the search engine used to search the database
*/
private SearchEngine searchEngine = null;
@@ -118,18 +113,14 @@
// C O N S T R U C T O R S
// ------------------------------------------------------------------------
-
/**
* Creates a context partition with a new database and a search engine.
*
- * @param db the dedicated database for this backing store
* @param searchEngine the search engine for this backing store
*/
- protected BTreeContextPartition( PartitionStore db, SearchEngine searchEngine,
- AttributeType[] indexAttributes )
+ public BTreeContextPartition( SearchEngine searchEngine, AttributeType[] indexedAttrs )
throws NamingException
{
- this.db = db;
this.searchEngine = searchEngine;
HashSet sysOidSet = new HashSet();
@@ -141,40 +132,40 @@
sysOidSet.add( SUBALIAS_OID );
sysOidSet.add( ALIAS_OID );
- for ( int ii = 0; ii < indexAttributes.length; ii ++ )
+ for ( int ii = 0; ii < indexedAttrs.length; ii ++ )
{
- String oid = indexAttributes[ii].getOid();
+ String oid = indexedAttrs[ii].getOid();
// check if attribute is a system attribute
if ( sysOidSet.contains( oid ) )
{
if ( oid.equals( EXISTANCE_OID ) )
{
- db.setExistanceIndexOn( indexAttributes[ii] );
+ setExistanceIndexOn( indexedAttrs[ii] );
}
else if ( oid.equals( HIERARCHY_OID ) )
{
- db.setHierarchyIndexOn( indexAttributes[ii] );
+ setHierarchyIndexOn( indexedAttrs[ii] );
}
else if ( oid.equals( UPDN_OID ) )
{
- db.setUpdnIndexOn( indexAttributes[ii] );
+ setUpdnIndexOn( indexedAttrs[ii] );
}
else if ( oid.equals( NDN_OID ) )
{
- db.setNdnIndexOn( indexAttributes[ii] );
+ setNdnIndexOn( indexedAttrs[ii] );
}
else if ( oid.equals( ONEALIAS_OID ) )
{
- db.setOneAliasIndexOn( indexAttributes[ii] );
+ setOneAliasIndexOn( indexedAttrs[ii] );
}
else if ( oid.equals( SUBALIAS_OID ) )
{
- db.setSubAliasIndexOn( indexAttributes[ii] );
+ setSubAliasIndexOn( indexedAttrs[ii] );
}
else if ( oid.equals( ALIAS_OID ) )
{
- db.setAliasIndexOn( indexAttributes[ii] );
+ setAliasIndexOn( indexedAttrs[ii] );
}
else
{
@@ -184,7 +175,7 @@
}
else
{
- db.addIndexOn( indexAttributes[ii] );
+ addIndexOn( indexedAttrs[ii] );
}
}
}
@@ -196,17 +187,6 @@
/**
- * Gets the Database used by this ContextPartition.
- *
- * @return the database used
- */
- public PartitionStore getDb()
- {
- return db;
- }
-
-
- /**
* Gets the DefaultSearchEngine used by this ContextPartition to search the
* Database.
*
@@ -225,7 +205,7 @@
public void delete( Name dn ) throws NamingException
{
- BigInteger id = db.getEntryId( dn.toString() );
+ BigInteger id = getEntryId( dn.toString() );
// don't continue if id is null
if ( id == null )
@@ -234,7 +214,7 @@
+ dn + "' to delete it!");
}
- if ( db.getChildCount( id ) > 0 )
+ if ( getChildCount( id ) > 0 )
{
LdapContextNotEmptyException cnee = new LdapContextNotEmptyException(
"[66] Cannot delete entry " + dn + " it has children!" );
@@ -242,33 +222,19 @@
throw cnee;
}
- db.delete( id );
+ delete( id );
}
-
- public void add( String updn, Name dn, Attributes entry ) throws NamingException
- {
- db.add( updn, dn, entry );
- }
-
-
- public void modify( Name dn, int modOp, Attributes mods ) throws NamingException
- {
- db.modify( dn, modOp, mods );
- }
-
-
- public void modify( Name dn, ModificationItem[] mods ) throws NamingException
- {
- db.modify( dn, mods );
- }
+ public abstract void add( String updn, Name dn, Attributes entry ) throws NamingException;
+ public abstract void modify( Name dn, int modOp, Attributes mods ) throws NamingException;
+ public abstract void modify( Name dn, ModificationItem[] mods ) throws NamingException;
public NamingEnumeration list( Name base ) throws NamingException
{
SearchResultEnumeration list;
list = new SearchResultEnumeration( ArrayUtils.EMPTY_STRING_ARRAY,
- db.list( db.getEntryId( base.toString() ) ), db );
+ list( getEntryId( base.toString() ) ), this );
return list;
}
@@ -282,13 +248,13 @@
underlying = searchEngine.search( base, env, filter, searchCtls );
- return new SearchResultEnumeration( attrIds, underlying, db );
+ return new SearchResultEnumeration( attrIds, underlying, this );
}
public Attributes lookup( Name dn ) throws NamingException
{
- return db.lookup( db.getEntryId( dn.toString() ) );
+ return lookup( getEntryId( dn.toString() ) );
}
@@ -318,50 +284,190 @@
public boolean hasEntry( Name dn ) throws NamingException
{
- return null != db.getEntryId( dn.toString() );
+ return null != getEntryId( dn.toString() );
}
- public void modifyRn( Name dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+ public abstract void modifyRn( Name dn, String newRdn, boolean deleteOldRdn ) throws NamingException;
+ public abstract void move( Name oldChildDn, Name newParentDn ) throws NamingException;
+ public abstract void move( Name oldChildDn, Name newParentDn, String newRdn,
+ boolean deleteOldRdn ) throws NamingException;
+
+
+ public abstract void sync() throws NamingException;
+ public abstract void destroy() throws NamingException;
+ public abstract boolean isInitialized();
+
+ public boolean isSuffix( Name dn ) throws NamingException
{
- db.modifyRdn( dn, newRdn, deleteOldRdn );
+ return getSuffix( true ).equals( dn ) ;
}
- public void move( Name oldChildDn, Name newParentDn ) throws NamingException
+ public void inspect() throws Exception
{
- db.move( oldChildDn, newParentDn );
+ PartitionViewer viewer = new PartitionViewer( this, searchEngine );
+ viewer.execute();
}
+ ////////////////////
+ // public abstract methods
+
+ // ------------------------------------------------------------------------
+ // Index Operations
+ // ------------------------------------------------------------------------
- public void move( Name oldChildDn, Name newParentDn, String newRdn,
- boolean deleteOldRdn ) throws NamingException
- {
- db.move( oldChildDn, newParentDn, newRdn, deleteOldRdn );
- }
+ public abstract void addIndexOn( AttributeType attribute ) throws NamingException;
+ public abstract boolean hasUserIndexOn( String attribute );
+ public abstract boolean hasSystemIndexOn( String attribute );
+ public abstract Index getExistanceIndex();
- public void sync() throws NamingException
- {
- db.sync();
- }
+ /**
+ * Gets the Index mapping the BigInteger primary keys of parents to the
+ * BigInteger primary keys of their children.
+ *
+ * @return the hierarchy Index
+ */
+ public abstract Index getHierarchyIndex();
+
+ /**
+ * Gets the Index mapping user provided distinguished names of entries as
+ * Strings to the BigInteger primary keys of entries.
+ *
+ * @return the user provided distinguished name Index
+ */
+ public abstract Index getUpdnIndex();
+ /**
+ * Gets the Index mapping the normalized distinguished names of entries as
+ * Strings to the BigInteger primary keys of entries.
+ *
+ * @return the normalized distinguished name Index
+ */
+ public abstract Index getNdnIndex();
- public void destroy() throws NamingException
- {
- db.close();
- }
+ /**
+ * Gets the alias index mapping parent entries with scope expanding aliases
+ * children one level below them; this system index is used to dereference
+ * aliases on one/single level scoped searches.
+ *
+ * @return the one alias index
+ */
+ public abstract Index getOneAliasIndex();
+ /**
+ * Gets the alias index mapping relative entries with scope expanding
+ * alias descendents; this system index is used to dereference aliases on
+ * subtree scoped searches.
+ *
+ * @return the sub alias index
+ */
+ public abstract Index getSubAliasIndex();
- public boolean isInitialized()
- {
- return db.isOpen();
- }
+ /**
+ * Gets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would
+ * be the aliasedObjectName and for X.500 would be aliasedEntryName.
+ *
+ * @return the index on the ALIAS_ATTRIBUTE
+ */
+ public abstract Index getAliasIndex();
+
+ /**
+ * Sets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would
+ * be the aliasedObjectName and for X.500 would be aliasedEntryName.
+ *
+ * @param attrType the index on the ALIAS_ATTRIBUTE
+ */
+ public abstract void setAliasIndexOn( AttributeType attrType ) throws NamingException;
+ /**
+ * Sets the attribute existance Index.
+ *
+ * @param attrType the attribute existance Index
+ */
+ public abstract void setExistanceIndexOn( AttributeType attrType ) throws NamingException;
- public void inspect() throws Exception
- {
- PartitionViewer viewer = new PartitionViewer( db, searchEngine );
- viewer.execute();
- }
+ /**
+ * Sets the hierarchy Index.
+ *
+ * @param attrType the hierarchy Index
+ */
+ public abstract void setHierarchyIndexOn( AttributeType attrType ) throws NamingException;
+
+ /**
+ * Sets the user provided distinguished name Index.
+ *
+ * @param attrType the updn Index
+ */
+ public abstract void setUpdnIndexOn( AttributeType attrType ) throws NamingException;
+
+ /**
+ * Sets the normalized distinguished name Index.
+ *
+ * @param attrType the ndn Index
+ */
+ public abstract void setNdnIndexOn( AttributeType attrType ) throws NamingException;
+
+ /**
+ * Sets the alias index mapping parent entries with scope expanding aliases
+ * children one level below them; this system index is used to dereference
+ * aliases on one/single level scoped searches.
+ *
+ * @param attrType a one level alias index
+ */
+ public abstract void setOneAliasIndexOn( AttributeType attrType ) throws NamingException;
+
+ /**
+ * Sets the alias index mapping relative entries with scope expanding
+ * alias descendents; this system index is used to dereference aliases on
+ * subtree scoped searches.
+ *
+ * @param attrType a subtree alias index
+ */
+ public abstract void setSubAliasIndexOn( AttributeType attrType ) throws NamingException;
+ public abstract Index getUserIndex( String attribute ) throws IndexNotFoundException;
+ public abstract Index getSystemIndex( String attribute ) throws IndexNotFoundException;
+ public abstract BigInteger getEntryId( String dn ) throws NamingException;
+ public abstract String getEntryDn( BigInteger id ) throws NamingException;
+ public abstract BigInteger getParentId( String dn ) throws NamingException;
+ public abstract BigInteger getParentId( BigInteger childId ) throws NamingException;
+
+ /**
+ * Gets the user provided distinguished name.
+ *
+ * @param id the entry id
+ * @return the user provided distinguished name
+ * @throws NamingException if the updn index cannot be accessed
+ */
+ public abstract String getEntryUpdn( BigInteger id ) throws NamingException;
+
+ /**
+ * Gets the user provided distinguished name.
+ *
+ * @param dn the normalized distinguished name
+ * @return the user provided distinguished name
+ * @throws NamingException if the updn and ndn indices cannot be accessed
+ */
+ public abstract String getEntryUpdn( String dn ) throws NamingException;
+ public abstract Attributes lookup( BigInteger id ) throws NamingException;
+ public abstract void delete( BigInteger id ) throws NamingException;
+ public abstract NamingEnumeration list( BigInteger id ) throws NamingException;
+ public abstract int getChildCount( BigInteger id ) throws NamingException;
+ public abstract Attributes getSuffixEntry() throws NamingException;
+ public abstract void setProperty( String key, String value ) throws NamingException;
+ public abstract String getProperty( String key ) throws NamingException;
+ public abstract Iterator getUserIndices();
+ public abstract Iterator getSystemIndices();
+ public abstract Attributes getIndices( BigInteger id ) throws NamingException;
+
+ /**
+ * Gets the count of the total number of entries in the database.
+ *
+ * TODO shouldn't this be a BigInteger instead of an int?
+ *
+ * @return the number of entries in the database
+ * @throws NamingException if there is a failure to read the count
+ */
+ public abstract int count() throws NamingException;
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultOptimizer.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultOptimizer.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultOptimizer.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultOptimizer.java Mon Jun 20 07:16:24 2005
@@ -43,7 +43,7 @@
/** the maximum size for a count Integer.MAX_VALUE as a BigInteger */
private static final BigInteger MAX = BigInteger.valueOf( Integer.MAX_VALUE );
/** the database this optimizer operates on */
- private PartitionStore db;
+ private BTreeContextPartition db;
/**
@@ -51,7 +51,7 @@
*
* @param db the database this optimizer works for.
*/
- public DefaultOptimizer( PartitionStore db )
+ public DefaultOptimizer( BTreeContextPartition db )
{
this.db = db;
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultSearchEngine.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultSearchEngine.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultSearchEngine.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/DefaultSearchEngine.java Mon Jun 20 07:16:24 2005
@@ -45,7 +45,7 @@
/** the Optimizer used by this DefaultSearchEngine */
private final Optimizer optimizer;
/** the Database this DefaultSearchEngine operates on */
- private PartitionStore db;
+ private BTreeContextPartition db;
/** Evaluator flyweight used for filter expression assertions */
private ExpressionEvaluator evaluator;
/** Enumerator flyweight that creates enumerations on filter expressions */
@@ -61,7 +61,7 @@
* Creates a DefaultSearchEngine for searching a Database without setting
* up the database.
*/
- public DefaultSearchEngine( PartitionStore db,
+ public DefaultSearchEngine( BTreeContextPartition db,
ExpressionEvaluator evaluator,
ExpressionEnumerator enumerator )
{
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEnumerator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEnumerator.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEnumerator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEnumerator.java Mon Jun 20 07:16:24 2005
@@ -43,7 +43,7 @@
public class ExpressionEnumerator implements Enumerator
{
/** The database used by this enumerator */
- private PartitionStore db = null;
+ private BTreeContextPartition db = null;
/** Enumerator flyweight for evaulating filter scope assertions */
private ScopeEnumerator scopeEnumerator;
/** Enumerator flyweight for evaulating filter substring assertions */
@@ -58,7 +58,7 @@
* @param db database used by this enumerator
* @param evaluator
*/
- public ExpressionEnumerator( PartitionStore db,
+ public ExpressionEnumerator( BTreeContextPartition db,
AttributeTypeRegistry attributeTypeRegistry,
ExpressionEvaluator evaluator )
{
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEvaluator.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEvaluator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ExpressionEvaluator.java Mon Jun 20 07:16:24 2005
@@ -64,7 +64,7 @@
* @param oidRegistry the oid reg used for attrID to oid resolution
* @param attributeTypeRegistry the attribtype reg used for value comparison
*/
- public ExpressionEvaluator( PartitionStore db,
+ public ExpressionEvaluator( BTreeContextPartition db,
OidRegistry oidRegistry,
AttributeTypeRegistry attributeTypeRegistry )
{
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/LeafEvaluator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/LeafEvaluator.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/LeafEvaluator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/LeafEvaluator.java Mon Jun 20 07:16:24 2005
@@ -55,7 +55,7 @@
/** Database used to evaluate leaf with */
- private PartitionStore db;
+ private BTreeContextPartition db;
/** Oid Registry used to translate attributeIds to OIDs */
private OidRegistry oidRegistry;
/** AttributeType registry needed for normalizing and comparing values */
@@ -73,7 +73,7 @@
* @param scopeEvaluator
* @param substringEvaluator
*/
- public LeafEvaluator( PartitionStore db, OidRegistry oidRegistry,
+ public LeafEvaluator( BTreeContextPartition db, OidRegistry oidRegistry,
AttributeTypeRegistry attributeTypeRegistry,
ScopeEvaluator scopeEvaluator,
SubstringEvaluator substringEvaluator )
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEnumerator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEnumerator.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEnumerator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEnumerator.java Mon Jun 20 07:16:24 2005
@@ -37,12 +37,12 @@
public class ScopeEnumerator implements Enumerator
{
/** Database used to enumerate based on scope */
- private PartitionStore db = null;
+ private BTreeContextPartition db = null;
/** Filter scope expression evaluator */
private ScopeEvaluator evaluator = null;
- public ScopeEnumerator( PartitionStore db, ScopeEvaluator evaluator )
+ public ScopeEnumerator( BTreeContextPartition db, ScopeEvaluator evaluator )
{
this.db = db;
this.evaluator = evaluator;
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEvaluator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEvaluator.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEvaluator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/ScopeEvaluator.java Mon Jun 20 07:16:24 2005
@@ -46,7 +46,7 @@
public class ScopeEvaluator implements Evaluator
{
/** Database used to evaluate scope with */
- private PartitionStore db;
+ private BTreeContextPartition db;
/**
@@ -54,7 +54,7 @@
*
* @param db the database used to evaluate scope node
*/
- public ScopeEvaluator( PartitionStore db )
+ public ScopeEvaluator( BTreeContextPartition db )
{
this.db = db;
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SearchResultEnumeration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SearchResultEnumeration.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SearchResultEnumeration.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SearchResultEnumeration.java Mon Jun 20 07:16:24 2005
@@ -39,7 +39,7 @@
public class SearchResultEnumeration implements NamingEnumeration
{
/** Database used to lookup entries from */
- private PartitionStore db = null;
+ private BTreeContextPartition partition = null;
/** base of search for relative names */
/** the attributes to return */
private final String [] attrIds;
@@ -56,9 +56,9 @@
*/
public SearchResultEnumeration( String [] attrIds,
NamingEnumeration underlying,
- PartitionStore db )
+ BTreeContextPartition db )
{
- this.db = db;
+ this.partition = db;
this.attrIds = attrIds;
this.underlying = underlying;
}
@@ -89,11 +89,11 @@
{
IndexRecord rec = ( IndexRecord ) underlying.next();
Attributes entry;
- String name = db.getEntryUpdn( rec.getEntryId() );
+ String name = partition.getEntryUpdn( rec.getEntryId() );
if ( null == rec.getAttributes() )
{
- rec.setAttributes( db.lookup( rec.getEntryId() ) );
+ rec.setAttributes( partition.lookup( rec.getEntryId() ) );
}
if ( attrIds == null )
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEnumerator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEnumerator.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEnumerator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEnumerator.java Mon Jun 20 07:16:24 2005
@@ -49,7 +49,7 @@
public class SubstringEnumerator implements Enumerator
{
/** Database used */
- private final PartitionStore db;
+ private final BTreeContextPartition db;
/** Evaluator used is an Avalon dependent object */
private final SubstringEvaluator evaluator;
/** the attribute type registry */
@@ -62,7 +62,7 @@
* @param db the database
* @param evaluator a substring evaluator
*/
- public SubstringEnumerator( PartitionStore db,
+ public SubstringEnumerator( BTreeContextPartition db,
AttributeTypeRegistry attributeTypeRegistry,
SubstringEvaluator evaluator )
{
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEvaluator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEvaluator.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEvaluator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/SubstringEvaluator.java Mon Jun 20 07:16:24 2005
@@ -41,7 +41,7 @@
public class SubstringEvaluator implements Evaluator
{
/** Database used while evaluating candidates */
- private PartitionStore db;
+ private BTreeContextPartition db;
/** Oid Registry used to translate attributeIds to OIDs */
private OidRegistry oidRegistry;
/** AttributeType registry needed for normalizing and comparing values */
@@ -55,7 +55,7 @@
* @param oidRegistry the OID registry for name to OID mapping
* @param attributeTypeRegistry the attributeType registry
*/
- public SubstringEvaluator( PartitionStore db, OidRegistry oidRegistry,
+ public SubstringEvaluator( BTreeContextPartition db, OidRegistry oidRegistry,
AttributeTypeRegistry attributeTypeRegistry )
{
this.db = db;
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/EntryNode.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/EntryNode.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/EntryNode.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/EntryNode.java Mon Jun 20 07:16:24 2005
@@ -31,8 +31,8 @@
import org.apache.ldap.common.filter.ExprNode;
import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
import org.apache.ldap.server.partition.store.impl.btree.IndexRecord;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStore;
import org.apache.ldap.server.partition.store.impl.btree.SearchEngine;
@@ -45,25 +45,25 @@
public class EntryNode
implements TreeNode
{
- private final PartitionStore db;
+ private final BTreeContextPartition partition;
private final EntryNode parent;
private final Attributes entry;
private final ArrayList children;
private final BigInteger id;
- public EntryNode( BigInteger id, EntryNode parent, PartitionStore db,
+ public EntryNode( BigInteger id, EntryNode parent, BTreeContextPartition partition,
Attributes entry, HashMap map )
{
- this( id, parent, db, entry, map, null, null );
+ this( id, parent, partition, entry, map, null, null );
}
- public EntryNode( BigInteger id, EntryNode parent, PartitionStore db,
+ public EntryNode( BigInteger id, EntryNode parent, BTreeContextPartition db,
Attributes entry, HashMap map, ExprNode exprNode,
SearchEngine engine )
{
- this.db = db;
+ this.partition = db;
this.id = id;
this.entry = entry;
this.children = new ArrayList();
@@ -182,7 +182,7 @@
public String getEntryDn()
throws NamingException
{
- return db.getEntryDn( id );
+ return partition.getEntryDn( id );
}
@@ -192,7 +192,7 @@
try
{
- LdapName dn = new LdapName( db.getEntryDn( id ) );
+ LdapName dn = new LdapName( partition.getEntryDn( id ) );
buf.append( "(" ).append( id ).append( ") " );
buf.append( dn.getRdn() );
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/MainFrame.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/MainFrame.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/MainFrame.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/MainFrame.java Mon Jun 20 07:16:24 2005
@@ -70,9 +70,9 @@
import org.apache.ldap.common.message.LockableAttributesImpl;
import org.apache.ldap.common.name.LdapName;
import org.apache.ldap.common.util.StringTools;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
import org.apache.ldap.server.partition.store.impl.btree.Index;
import org.apache.ldap.server.partition.store.impl.btree.IndexRecord;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStore;
import org.apache.ldap.server.partition.store.impl.btree.SearchEngine;
@@ -106,7 +106,7 @@
private JMenu indices = new JMenu();
// Non Swing Stuff
- private PartitionStore database = null;
+ private BTreeContextPartition partition = null;
private boolean doCleanUp = false;
private HashMap nodes = new HashMap();
private EntryNode root = null;
@@ -116,14 +116,14 @@
/**
* Creates new form JFrame
*/
- public MainFrame( PartitionStore db, SearchEngine eng )
+ public MainFrame( BTreeContextPartition db, SearchEngine eng )
throws NamingException
{
- database = db;
+ partition = db;
this.eng = eng;
initGUI();
- buildIndicesMenu( database );
+ buildIndicesMenu( partition );
pack();
load();
}
@@ -349,7 +349,7 @@
try
{
TreePath path = tree.getSelectionModel().getSelectionPath();
- String parentDn = database.getSuffix().toString();
+ String parentDn = partition.getSuffix( false ).toString();
if ( null != path )
{
@@ -394,7 +394,7 @@
if ( null == path )
{
- return database.getSuffix().toString();
+ return partition.getSuffix( false ).toString();
}
Object last = path.getLastPathComponent();
@@ -413,7 +413,7 @@
}
else
{
- base = database.getSuffix().toString();
+ base = partition.getSuffix( false ).toString();
}
return base;
@@ -449,9 +449,9 @@
new LdapName( StringTools.deepTrimToLower( updn ) );
attrs.remove( "dn" );
- if ( null == database.getEntryId( ndn.toString() ) )
+ if ( null == partition.getEntryId( ndn.toString() ) )
{
- database.add( updn, ndn, attrs );
+ partition.add( updn, ndn, attrs );
load();
}
}
@@ -492,12 +492,12 @@
setVisible( false );
dispose();
- if ( doCleanUp && database != null )
+ if ( doCleanUp && partition != null )
{
try
{
- database.sync();
- database.close();
+ partition.sync();
+ partition.destroy();
}
catch ( NamingException e )
{
@@ -559,7 +559,7 @@
}
else
{
- dialog.setBase( database.getSuffix().toString() );
+ dialog.setBase( partition.getSuffix( false ).toString() );
}
dialog.addActionListener( new ActionListener()
@@ -668,7 +668,7 @@
{
IndexRecord rec = ( IndexRecord ) cursor.next();
row[0] = rec.getEntryId();
- row[1] = database.getEntryDn( ( BigInteger ) row[0] );
+ row[1] = partition.getEntryDn( ( BigInteger ) row[0] );
tableModel.addRow( row );
count++;
}
@@ -795,15 +795,15 @@
throws Exception
{
Index index = null;
- boolean isSystem = database.hasSystemIndexOn( idxAttr );
+ boolean isSystem = partition.hasSystemIndexOn( idxAttr );
if ( isSystem )
{
- index = database.getSystemIndex( idxAttr );
+ index = partition.getSystemIndex( idxAttr );
}
else
{
- index = database.getUserIndex( idxAttr );
+ index = partition.getUserIndex( idxAttr );
}
if ( index != null )
@@ -816,7 +816,7 @@
}
- public void buildIndicesMenu( PartitionStore database )
+ public void buildIndicesMenu( BTreeContextPartition partition )
{
JMenuItem item = null;
@@ -835,7 +835,7 @@
}
};
- Iterator list = database.getSystemIndices();
+ Iterator list = partition.getSystemIndices();
while ( list.hasNext() )
{
String idx = ( String ) list.next();
@@ -848,7 +848,7 @@
}
indices.add( new JSeparator() );
- list = database.getUserIndices();
+ list = partition.getUserIndices();
while ( list.hasNext() )
{
String idx = ( String ) list.next();
@@ -865,13 +865,13 @@
void displayEntry( BigInteger id, Attributes entry )
throws Exception
{
- String dn = database.getEntryUpdn( id );
+ String dn = partition.getEntryUpdn( id );
AttributesTableModel model =
new AttributesTableModel( entry, id, dn, false );
entryTbl.setModel( model );
model = new AttributesTableModel(
- database.getIndices( id ), id, dn, false );
+ partition.getIndices( id ), id, dn, false );
idxTbl.setModel( model );
validate();
@@ -883,10 +883,10 @@
// boolean doFiltered = false;
nodes = new HashMap();
- Attributes suffix = database.getSuffixEntry();
- BigInteger id = database.getEntryId(
- database.getSuffix().toString() );
- root = new EntryNode( id, null, database, suffix, nodes );
+ Attributes suffix = partition.getSuffixEntry();
+ BigInteger id = partition.getEntryId(
+ partition.getSuffix( false ).toString() );
+ root = new EntryNode( id, null, partition, suffix, nodes );
/*
int option = JOptionPane.showConfirmDialog( null,
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/PartitionViewer.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/PartitionViewer.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/PartitionViewer.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/gui/PartitionViewer.java Mon Jun 20 07:16:24 2005
@@ -22,7 +22,7 @@
import javax.naming.NamingException;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStore;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
import org.apache.ldap.server.partition.store.impl.btree.SearchEngine;
@@ -35,13 +35,13 @@
public class PartitionViewer
{
/** A handle on the atomic partition */
- private PartitionStore db;
+ private BTreeContextPartition partition;
private SearchEngine eng;
- public PartitionViewer( PartitionStore db, SearchEngine eng )
+ public PartitionViewer( BTreeContextPartition db, SearchEngine eng )
{
- this.db = db;
+ this.partition = db;
this.eng = eng;
}
@@ -81,7 +81,7 @@
public void execute() throws NamingException
{
- MainFrame frame = new MainFrame( db, eng ) ;
+ MainFrame frame = new MainFrame( partition, eng ) ;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize() ;
Dimension frameSize = frame.getSize() ;
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/jdbm/JdbmPartitionStore.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/jdbm/JdbmPartitionStore.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/jdbm/JdbmPartitionStore.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/store/impl/btree/jdbm/JdbmPartitionStore.java Mon Jun 20 07:16:24 2005
@@ -53,7 +53,8 @@
import org.apache.ldap.server.partition.store.impl.btree.IndexAssertionEnumeration;
import org.apache.ldap.server.partition.store.impl.btree.IndexNotFoundException;
import org.apache.ldap.server.partition.store.impl.btree.IndexRecord;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStore;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition;
+import org.apache.ldap.server.partition.store.impl.btree.SearchEngine;
/**
@@ -62,7 +63,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class JdbmPartitionStore implements PartitionStore
+public class JdbmPartitionStore extends BTreeContextPartition
{
/** the JDBM record manager used by this database */
private RecordManager recMan;
@@ -80,7 +81,7 @@
private Map sysIndices;
/** true if open */
- private boolean open;
+ private boolean initialized;
/** the normalized distinguished name index */
private Index ndnIdx;
@@ -106,8 +107,9 @@
/**
* Creates a store based on JDBM B+Trees.
*/
- public JdbmPartitionStore ()
+ public JdbmPartitionStore( SearchEngine searchEngine, AttributeType[] indexedAttrs ) throws NamingException
{
+ super( searchEngine, indexedAttrs );
}
public File getWorkingDirectory()
@@ -120,7 +122,7 @@
this.wkdir = workingDirectory;
}
- public synchronized void open( Name userProviderSuffix, Name normalizedSuffix ) throws NamingException
+ public synchronized void init( Name userProviderSuffix, Name normalizedSuffix ) throws NamingException
{
this.upSuffix = userProviderSuffix;
this.normSuffix = normalizedSuffix;
@@ -143,13 +145,13 @@
master = new JdbmMasterTable( recMan );
indices = new HashMap();
sysIndices = new HashMap();
- open = true;
+ initialized = true;
}
- public synchronized void close() throws NamingException
+ public synchronized void destroy() throws NamingException
{
- if ( !open )
+ if ( !initialized )
{
return;
}
@@ -242,7 +244,7 @@
rootCause.addThrowable( t );
}
- open = false;
+ initialized = false;
if ( null != rootCause )
{
@@ -253,14 +255,19 @@
}
- public boolean isOpen()
+ public boolean isInitialized()
{
- return open;
+ return initialized;
}
- public void sync() throws NamingException
+ public synchronized void sync() throws NamingException
{
+ if( !initialized )
+ {
+ return;
+ }
+
ArrayList array = new ArrayList();
array.addAll( indices.values() );
array.add( ndnIdx );
@@ -325,9 +332,6 @@
// ------------------------------------------------------------------------
- /**
- * @see PartitionStore#addIndexOn(AttributeType)
- */
public void addIndexOn( AttributeType spec ) throws NamingException
{
Index idx = new JdbmIndex( spec, wkdir );
@@ -335,18 +339,12 @@
}
- /**
- * @see PartitionStore#getExistanceIndex()
- */
public Index getExistanceIndex()
{
return existanceIdx;
}
- /**
- * @see PartitionStore#setExistanceIndexOn(AttributeType)
- */
public void setExistanceIndexOn( AttributeType attrType ) throws NamingException
{
if ( existanceIdx != null )
@@ -360,18 +358,12 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getHierarchyIndex()
- */
public Index getHierarchyIndex()
{
return hierarchyIdx;
}
- /**
- * @see PartitionStore#setExistanceIndexOn(AttributeType)
- */
public void setHierarchyIndexOn( AttributeType attrType ) throws NamingException
{
if ( hierarchyIdx != null )
@@ -385,18 +377,12 @@
}
- /**
- * @see PartitionStore#getAliasIndex()
- */
public Index getAliasIndex()
{
return aliasIdx;
}
- /**
- * @see PartitionStore#setAliasIndexOn(AttributeType)
- */
public void setAliasIndexOn( AttributeType attrType ) throws NamingException
{
if ( aliasIdx != null )
@@ -410,18 +396,12 @@
}
- /**
- * @see PartitionStore#getOneAliasIndex()
- */
public Index getOneAliasIndex()
{
return oneAliasIdx;
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#setOneAliasIndexOn(AttributeType)
- */
public void setOneAliasIndexOn( AttributeType attrType ) throws NamingException
{
if ( oneAliasIdx != null )
@@ -435,18 +415,12 @@
}
- /**
- * @see PartitionStore#getSubAliasIndex()
- */
public Index getSubAliasIndex()
{
return subAliasIdx;
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#setSubAliasIndexOn(AttributeType)
- */
public void setSubAliasIndexOn( AttributeType attrType ) throws NamingException
{
if ( subAliasIdx != null )
@@ -460,18 +434,12 @@
}
- /**
- * @see PartitionStore#getUpdnIndex()
- */
public Index getUpdnIndex()
{
return updnIdx;
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#setUpdnIndexOn(AttributeType)
- */
public void setUpdnIndexOn( AttributeType attrType ) throws NamingException
{
if ( updnIdx != null )
@@ -485,18 +453,12 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getNdnIndex()
- */
public Index getNdnIndex()
{
return ndnIdx;
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#setNdnIndexOn(AttributeType)
- */
public void setNdnIndexOn( AttributeType attrType ) throws NamingException
{
if ( ndnIdx != null )
@@ -510,27 +472,18 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getUserIndices()
- */
public Iterator getUserIndices()
{
return indices.keySet().iterator();
}
- /**
- * @see PartitionStore#getSystemIndices()
- */
public Iterator getSystemIndices()
{
return sysIndices.keySet().iterator();
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#hasUserIndexOn(String)
- */
public boolean hasUserIndexOn( String attribute )
{
return indices.containsKey( attribute ) ||
@@ -538,9 +491,6 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#hasSystemIndexOn(String)
- */
public boolean hasSystemIndexOn( String attribute )
{
return sysIndices.containsKey( attribute ) ||
@@ -552,7 +502,7 @@
* @todo replace lookups to use the OID instead of the name. Also note
* that the OID registry can be used to go between names and oids.
*
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getUserIndex(String)
+ * @see org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartition#getUserIndex(String)
*/
public Index getUserIndex( String attribute ) throws IndexNotFoundException
{
@@ -578,7 +528,7 @@
* @todo replace lookups to use the OID instead of the name. Also note
* that the OID registry can be used to go between names and oids.
*
- * @see PartitionStore#getEntryId(String)
+ * @see BTreeContextPartition#getEntryId(String)
*/
public Index getSystemIndex( String indexName ) throws IndexNotFoundException
{
@@ -600,27 +550,18 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getEntryId(String)
- */
public BigInteger getEntryId( String dn ) throws NamingException
{
return ndnIdx.forwardLookup( dn );
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getEntryDn(java.math.BigInteger)
- */
public String getEntryDn( BigInteger id ) throws NamingException
{
return ( String ) ndnIdx.reverseLookup( id );
}
- /**
- * @see PartitionStore#getParentId(String)
- */
public BigInteger getParentId( String dn ) throws NamingException
{
BigInteger childId = ndnIdx.forwardLookup( dn );
@@ -628,27 +569,18 @@
}
- /**
- * @see PartitionStore#getParentId(BigInteger)
- */
public BigInteger getParentId( BigInteger childId ) throws NamingException
{
return ( BigInteger ) hierarchyIdx.reverseLookup( childId );
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getEntryUpdn(BigInteger)
- */
public String getEntryUpdn( BigInteger id ) throws NamingException
{
return ( String ) updnIdx.reverseLookup( id );
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getEntryUpdn(String)
- */
public String getEntryUpdn( String dn ) throws NamingException
{
BigInteger id = ndnIdx.forwardLookup( dn );
@@ -656,9 +588,6 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#count()
- */
public int count() throws NamingException
{
return master.count();
@@ -849,9 +778,6 @@
}
- /**
- * @see PartitionStore#add(String,Name,Attributes)
- */
public void add( String updn, Name dn, Attributes entry ) throws NamingException
{
BigInteger id;
@@ -926,18 +852,12 @@
}
- /**
- * @see PartitionStore#lookup(BigInteger)
- */
public Attributes lookup( BigInteger id ) throws NamingException
{
return master.get( id );
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#delete(BigInteger)
- */
public void delete( BigInteger id ) throws NamingException
{
Attributes entry = lookup( id );
@@ -981,36 +901,29 @@
}
- /**
- * @see PartitionStore#list(java.math.BigInteger)
- */
public NamingEnumeration list( BigInteger id ) throws NamingException
{
return hierarchyIdx.listIndices( id );
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getChildCount(java.math.BigInteger)
- */
public int getChildCount( BigInteger id ) throws NamingException
{
return hierarchyIdx.count( id );
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getSuffix()
- */
- public Name getSuffix()
+ public Name getSuffix( boolean normalized )
{
+ if ( normalized )
+ {
+ return normSuffix;
+ }
+
return upSuffix;
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getSuffixEntry()
- */
public Attributes getSuffixEntry() throws NamingException
{
BigInteger id = getEntryId( upSuffix.toString() );
@@ -1024,9 +937,6 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#setProperty(String, String)
- */
public void setProperty( String propertyName, String propertyValue )
throws NamingException
{
@@ -1034,18 +944,12 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#getProperty(String)
- */
public String getProperty( String propertyName ) throws NamingException
{
return master.getProperty( propertyName );
}
- /**
- * @see PartitionStore#getIndices(java.math.BigInteger)
- */
public Attributes getIndices( BigInteger id ) throws NamingException
{
Attributes attributes = new LockableAttributesImpl();
@@ -1243,10 +1147,6 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#modify(javax.naming.Name, int,
- * javax.naming.directory.Attributes)
- */
public void modify( Name dn, int modOp, Attributes mods ) throws NamingException
{
NamingEnumeration attrs = null;
@@ -1297,10 +1197,6 @@
}
- /**
- * @see PartitionStore#modify(javax.naming.Name,
- * javax.naming.directory.ModificationItem[])
- */
public void modify( Name dn, ModificationItem [] mods ) throws NamingException
{
BigInteger id = getEntryId( dn.toString() );
@@ -1347,10 +1243,8 @@
* @param deleteOldRdn whether or not to remove the old Rdn attr/val
* @throws NamingException if there are any errors propagating the name
* changes.
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#modifyRdn(javax.naming.Name,
- * String, boolean)
*/
- public void modifyRdn( Name dn, String newRdn, boolean deleteOldRdn )
+ public void modifyRn( Name dn, String newRdn, boolean deleteOldRdn )
throws NamingException
{
String newRdnAttr = NamespaceTools.getRdnAttribute( newRdn );
@@ -1510,14 +1404,10 @@
}
- /**
- * @see org.apache.ldap.server.partition.store.impl.btree.PartitionStore#move(javax.naming.Name,
- * javax.naming.Name, String, boolean)
- */
public void move( Name oldChildDn, Name newParentDn, String newRdn,
boolean deleteOldRdn ) throws NamingException
{
- modifyRdn( oldChildDn, newRdn, deleteOldRdn );
+ modifyRn( oldChildDn, newRdn, deleteOldRdn );
move( oldChildDn, newParentDn );
}
@@ -1534,9 +1424,6 @@
* @param oldChildDn the normalized dn of the child to be moved
* @param newParentDn the normalized dn of the new parent for the child
* @throws NamingException if something goes wrong
- *
- * @see PartitionStore#move(javax.naming.Name,
- * javax.naming.Name)
*/
public void move( Name oldChildDn, Name newParentDn ) throws NamingException
{
Modified: directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsAdminTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsAdminTest.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsAdminTest.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsAdminTest.java Mon Jun 20 07:16:24 2005
@@ -28,7 +28,7 @@
import org.apache.ldap.common.exception.LdapNoPermissionException;
import org.apache.ldap.common.message.LockableAttributesImpl;
import org.apache.ldap.server.AbstractAdminTestCase;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStoreSearchResult;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartitionSearchResult;
/**
@@ -110,7 +110,7 @@
while ( list.hasMore() )
{
- PartitionStoreSearchResult result = ( PartitionStoreSearchResult ) list.next();
+ BTreeContextPartitionSearchResult result = ( BTreeContextPartitionSearchResult ) list.next();
set.add( result.getName() );
}
Modified: directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsNonAdminTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsNonAdminTest.java?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsNonAdminTest.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/test/org/apache/ldap/server/authz/AuthorizationServiceAsNonAdminTest.java Mon Jun 20 07:16:24 2005
@@ -28,7 +28,7 @@
import org.apache.ldap.common.exception.LdapNoPermissionException;
import org.apache.ldap.common.message.LockableAttributesImpl;
import org.apache.ldap.server.AbstractNonAdminTestCase;
-import org.apache.ldap.server.partition.store.impl.btree.PartitionStoreSearchResult;
+import org.apache.ldap.server.partition.store.impl.btree.BTreeContextPartitionSearchResult;
/**
@@ -110,7 +110,7 @@
"(objectClass=*)", controls );
while ( list.hasMore() )
{
- PartitionStoreSearchResult result = ( PartitionStoreSearchResult ) list.next();
+ BTreeContextPartitionSearchResult result = ( BTreeContextPartitionSearchResult ) list.next();
set.add( result.getName() );
}