You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2011/11/18 14:22:39 UTC
svn commit: r1203640 [2/2] - in /directory/apacheds/branches/apacheds-txns:
core-api/src/main/java/org/apache/directory/server/core/api/partition/
core-api/src/main/java/org/apache/directory/server/core/api/txn/
core-api/src/main/java/org/apache/direct...
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java Fri Nov 18 13:22:37 2011
@@ -23,9 +23,14 @@ package org.apache.directory.server.xdbm
import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
+import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
@@ -44,7 +49,7 @@ public class OneLevelScopeCursor extends
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
/** The entry database/store */
- private final Store db;
+ private final Partition db;
/** A onelevel ScopeNode Evaluator */
@SuppressWarnings("unchecked")
@@ -58,6 +63,9 @@ public class OneLevelScopeCursor extends
/** Currently active Cursor: we switch between two cursors */
private Cursor<IndexEntry<UUID>> cursor;
+
+ /** Alias idx set if dereferencing aliases */
+ private Index<String> aliasIdx;
/**
@@ -67,17 +75,26 @@ public class OneLevelScopeCursor extends
* @param evaluator an IndexEntry (candidate) evaluator
* @throws Exception on db access failures
*/
- //@SuppressWarnings("unchecked")
- public OneLevelScopeCursor( Store db, OneLevelScopeEvaluator evaluator )
+ @SuppressWarnings("unchecked")
+ public OneLevelScopeCursor( Partition db, OneLevelScopeEvaluator evaluator )
throws Exception
{
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
this.db = db;
this.evaluator = evaluator;
- scopeCursor = db.getOneLevelIndex().forwardCursor( evaluator.getBaseId() );
+
+ Index<?> oneLevelIdx = db.getSystemIndex( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
+ oneLevelIdx = txnLogManager.wrap( db.getSuffixDn(), oneLevelIdx );
+ scopeCursor = ( ( Index<UUID> ) oneLevelIdx ).forwardCursor( evaluator.getBaseId() );
if ( evaluator.isDereferencing() )
{
- dereferencedCursor = db.getOneAliasIndex().forwardCursor( evaluator.getBaseId() );
+ Index<?> oneAliasIdx = db.getSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+ oneAliasIdx = txnLogManager.wrap( db.getSuffixDn(), oneAliasIdx );
+ dereferencedCursor = ( ( Index<UUID> )oneAliasIdx ).forwardCursor( evaluator.getBaseId() );
+
+ aliasIdx = ( Index<String> )db.getSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ aliasIdx = ( Index<String> )txnLogManager.wrap( db.getSuffixDn(), aliasIdx );
}
else
{
@@ -159,7 +176,7 @@ public class OneLevelScopeCursor extends
checkNotClosed( "previous()" );
setAvailable( cursor.previous() );
- if ( available() && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
+ if ( available() && aliasIdx.reverseLookup( cursor.get().getId() ) == null )
{
break;
}
@@ -193,7 +210,7 @@ public class OneLevelScopeCursor extends
checkNotClosed( "previous()" );
setAvailable( cursor.previous() );
- if ( available() && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
+ if ( available() && aliasIdx.reverseLookup( cursor.get().getId() ) == null )
{
break;
}
@@ -228,7 +245,7 @@ public class OneLevelScopeCursor extends
checkNotClosed( "next()" );
setAvailable( cursor.next() );
- if ( available() && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
+ if ( available() && aliasIdx.reverseLookup( cursor.get().getId() ) == null )
{
break;
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java Fri Nov 18 13:22:37 2011
@@ -23,7 +23,13 @@ package org.apache.directory.server.xdbm
import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -48,8 +54,16 @@ public class OneLevelScopeEvaluator impl
private final boolean dereferencing;
/** the entry db storing entries */
- private final Store db;
-
+ private final Partition db;
+
+ /** One level idx */
+ private Index<UUID> oneLevelIdx;
+
+ /** One level alias idx. Set if dereferencing aliases */
+ private Index<UUID> oneAliasIdx;
+
+ /** Alias idx. Set if dereferencing aliases */
+ private Index<String> aliasIdx;
/**
* Creates a one level scope node Evaluator for search expressions.
@@ -58,7 +72,8 @@ public class OneLevelScopeEvaluator impl
* @param db the database used to evaluate scope node
* @throws Exception on db access failure
*/
- public OneLevelScopeEvaluator( Store db, ScopeNode node ) throws Exception
+ @SuppressWarnings("unchecked")
+ public OneLevelScopeEvaluator( Partition db, ScopeNode node ) throws Exception
{
this.node = node;
@@ -68,8 +83,21 @@ public class OneLevelScopeEvaluator impl
}
this.db = db;
- baseId = db.getEntryId( node.getBaseDn() );
+ baseId = OperationExecutionManagerFactory.instance().getEntryId( db, node.getBaseDn() );
dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
+
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+ oneLevelIdx = ( Index<UUID> )db.getSystemIndex( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
+ oneLevelIdx = ( Index<UUID> )txnLogManager.wrap( db.getSuffixDn(), oneLevelIdx );
+
+ if ( dereferencing )
+ {
+ oneAliasIdx = ( Index<UUID> )db.getSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID );
+ oneAliasIdx = ( Index<UUID> )txnLogManager.wrap( db.getSuffixDn(), oneAliasIdx );
+
+ aliasIdx = ( Index<String> )db.getSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ aliasIdx = ( Index<String> )txnLogManager.wrap( db.getSuffixDn(), aliasIdx );
+ }
}
@@ -84,7 +112,7 @@ public class OneLevelScopeEvaluator impl
*/
public boolean evaluateId( UUID candidate ) throws Exception
{
- boolean isChild = db.getOneLevelIndex().forward( baseId, candidate );
+ boolean isChild = oneLevelIdx.forward( baseId, candidate );
/*
* The candidate id could be any entry in the db. If search
@@ -101,7 +129,7 @@ public class OneLevelScopeEvaluator impl
* candidate id is an alias, if so we reject it since aliases should
* not be returned.
*/
- if ( null != db.getAliasIndex().reverseLookup( candidate ) )
+ if ( null != aliasIdx.reverseLookup( candidate ) )
{
return false;
}
@@ -125,7 +153,7 @@ public class OneLevelScopeEvaluator impl
* the lookup returns true accepting the candidate. Otherwise the
* candidate is rejected with a false return because it is not in scope.
*/
- return db.getOneAliasIndex().forward( baseId, candidate );
+ return oneAliasIdx.forward( baseId, candidate );
}
@@ -155,7 +183,7 @@ public class OneLevelScopeEvaluator impl
*/
public boolean evaluate( IndexEntry<?> candidate ) throws Exception
{
- boolean isChild = db.getOneLevelIndex().forward( baseId, candidate.getId() );
+ boolean isChild = oneLevelIdx.forward( baseId, candidate.getId() );
/*
* The candidate id could be any entry in the db. If search
@@ -172,7 +200,7 @@ public class OneLevelScopeEvaluator impl
* candidate id is an alias, if so we reject it since aliases should
* not be returned.
*/
- if ( null != db.getAliasIndex().reverseLookup( candidate.getId() ) )
+ if ( null != aliasIdx.reverseLookup( candidate.getId() ) )
{
return false;
}
@@ -196,7 +224,7 @@ public class OneLevelScopeEvaluator impl
* the lookup returns true accepting the candidate. Otherwise the
* candidate is rejected with a false return because it is not in scope.
*/
- return db.getOneAliasIndex().forward( baseId, candidate.getId() );
+ return oneAliasIdx.forward( baseId, candidate.getId() );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Fri Nov 18 13:22:37 2011
@@ -23,10 +23,16 @@ package org.apache.directory.server.xdbm
import java.util.UUID;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
+import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
@@ -44,9 +50,10 @@ public class PresenceCursor extends Abst
private final IndexCursor<String> presenceCursor;
private final PresenceEvaluator presenceEvaluator;
-
- public PresenceCursor( Store store, PresenceEvaluator presenceEvaluator ) throws Exception
+ @SuppressWarnings("unchecked")
+ public PresenceCursor( Partition store, PresenceEvaluator presenceEvaluator ) throws Exception
{
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
this.presenceEvaluator = presenceEvaluator;
AttributeType type = presenceEvaluator.getAttributeType();
@@ -55,13 +62,18 @@ public class PresenceCursor extends Abst
// instead for those attributes and all un-indexed attributes we use the ndn index
if ( store.hasUserIndexOn( type ) )
{
- presenceCursor = store.getPresenceIndex().forwardCursor( type.getOid() );
+ Index<?> presenceIdx;
+ presenceIdx = store.getSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
+ presenceIdx = txnLogManager.wrap( store.getSuffixDn(), presenceIdx );
+ presenceCursor = ( ( Index<String> )presenceIdx ).forwardCursor( type.getOid() );
uuidCursor = null;
}
else
{
presenceCursor = null;
- uuidCursor = store.getEntryUuidIndex().forwardCursor();
+ Index<?> entryUuidIdx = store.getSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID );
+ entryUuidIdx = txnLogManager.wrap( store.getSuffixDn(), entryUuidIdx );
+ uuidCursor = ( ( Index<String> ) entryUuidIdx).forwardCursor();
}
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Fri Nov 18 13:22:37 2011
@@ -23,8 +23,13 @@ package org.apache.directory.server.xdbm
import java.util.Iterator;
import java.util.UUID;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.api.partition.index.MasterTable;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.entry.Attribute;
@@ -46,7 +51,7 @@ public class PresenceEvaluator implement
private final PresenceNode node;
/** The backend */
- private final Store db;
+ private final Partition db;
/** The AttributeType we will use for the evaluation */
private final AttributeType attributeType;
@@ -56,11 +61,15 @@ public class PresenceEvaluator implement
/** The index to use if any */
private final Index<String> idx;
+
+ /** Master table */
+ private final MasterTable masterTable;
-
- public PresenceEvaluator( PresenceNode node, Store db, SchemaManager schemaManager )
+ @SuppressWarnings("unchecked")
+ public PresenceEvaluator( PresenceNode node, Partition db, SchemaManager schemaManager )
throws Exception
{
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
this.db = db;
this.node = node;
this.schemaManager = schemaManager;
@@ -68,12 +77,15 @@ public class PresenceEvaluator implement
if ( db.hasUserIndexOn( attributeType ) )
{
- idx = db.getPresenceIndex();
+ Index<?> presenceIdx = db.getSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
+ idx = ( Index<String> )txnLogManager.wrap( db.getSuffixDn(), presenceIdx );
}
else
{
idx = null;
}
+
+ masterTable = txnLogManager.wrap( db.getSuffixDn(), db.getMasterTable() );
}
@@ -103,7 +115,7 @@ public class PresenceEvaluator implement
// resuscitate the entry if it has not been and set entry in IndexEntry
if ( null == entry )
{
- entry = db.lookup( indexEntry.getId() );
+ entry = masterTable.get( indexEntry.getId() );
indexEntry.setEntry( entry );
}
@@ -120,7 +132,7 @@ public class PresenceEvaluator implement
return idx.forward( attributeType.getOid(), id );
}
- return evaluateEntry( db.lookup( id ) );
+ return evaluateEntry( masterTable.get( id ) );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Fri Nov 18 13:22:37 2011
@@ -21,12 +21,16 @@ package org.apache.directory.server.xdbm
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -46,16 +50,18 @@ public class SubstringCursor extends Abs
@SuppressWarnings("unchecked")
- public SubstringCursor( Store store, final SubstringEvaluator substringEvaluator )
+ public SubstringCursor( Partition store, final SubstringEvaluator substringEvaluator )
throws Exception
{
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
evaluator = substringEvaluator;
hasIndex = store.hasIndexOn( evaluator.getExpression().getAttributeType() );
if ( hasIndex )
{
- wrapped = ( ( Index<String> ) store.getIndex( evaluator.getExpression().getAttributeType() ) )
- .forwardCursor();
+ Index<?> index = store.getIndex( evaluator.getExpression().getAttributeType() );
+ index = txnLogManager.wrap( store.getSuffixDn(), index );
+ wrapped = ( ( Index<String> ) index ).forwardCursor();
}
else
{
@@ -70,7 +76,9 @@ public class SubstringCursor extends Abs
* knows to use it, when it itself detects the lack of an index on
* the node's attribute.
*/
- wrapped = store.getEntryUuidIndex().forwardCursor();
+ Index<?> entryUuidIdx = store.getSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID );
+ entryUuidIdx = txnLogManager.wrap( store.getSuffixDn(), entryUuidIdx );
+ wrapped = ( ( Index<String> )entryUuidIdx ).forwardCursor();
}
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Fri Nov 18 13:22:37 2011
@@ -25,9 +25,12 @@ import java.util.UUID;
import java.util.regex.Pattern;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
-import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.core.api.partition.index.MasterTable;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.entry.Attribute;
@@ -49,7 +52,7 @@ import org.apache.directory.shared.ldap.
public class SubstringEvaluator implements Evaluator<SubstringNode>
{
/** Database used while evaluating candidates */
- private final Store db;
+ private final Partition db;
/** Reference to the SchemaManager */
private final SchemaManager schemaManager;
@@ -68,6 +71,9 @@ public class SubstringEvaluator implemen
/** The index to use if any */
private final Index<String> idx;
+
+ /** Master table */
+ private final MasterTable masterTable;
/**
@@ -79,7 +85,7 @@ public class SubstringEvaluator implemen
* @throws Exception if there are failures accessing resources and the db
*/
@SuppressWarnings("unchecked")
- public SubstringEvaluator( SubstringNode node, Store db, SchemaManager schemaManager )
+ public SubstringEvaluator( SubstringNode node, Partition db, SchemaManager schemaManager )
throws Exception
{
this.db = db;
@@ -114,14 +120,18 @@ public class SubstringEvaluator implemen
regex = null;
}
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
if ( db.hasIndexOn( attributeType ) )
{
- idx = ( Index<String> ) db.getIndex( attributeType );
+ Index<?> index = db.getIndex( attributeType );
+ idx = ( Index<String> )txnLogManager.wrap( db.getSuffixDn(), index );
}
else
{
idx = null;
}
+
+ masterTable = txnLogManager.wrap( db.getSuffixDn(), db.getMasterTable() );
}
@@ -251,7 +261,7 @@ public class SubstringEvaluator implemen
// wrapper or the raw normalized value
private boolean evaluateWithoutIndex( UUID id ) throws Exception
{
- return evaluateWithoutIndex( db.lookup( id ) );
+ return evaluateWithoutIndex( masterTable.get( id ) );
}
@@ -338,7 +348,7 @@ public class SubstringEvaluator implemen
// resuscitate the entry if it has not been and set entry in IndexEntry
if ( null == entry )
{
- entry = db.lookup( indexEntry.getId() );
+ entry = masterTable.get( indexEntry.getId() );
indexEntry.setEntry( entry );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Fri Nov 18 13:22:37 2011
@@ -22,11 +22,17 @@ package org.apache.directory.server.xdbm
import java.util.UUID;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
+import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.api.partition.index.MasterTable;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -43,7 +49,7 @@ public class SubtreeScopeCursor extends
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_719 );
/** The Entry database/store */
- private final Store db;
+ private final Partition db;
/** A ScopeNode Evaluator */
private final SubtreeScopeEvaluator evaluator;
@@ -58,6 +64,10 @@ public class SubtreeScopeCursor extends
private IndexCursor<UUID> cursor;
private UUID contextEntryId;
+
+ /** Alias idx if dereferencing aliases */
+ private Index<String> aliasIdx;
+
/**
@@ -67,9 +77,11 @@ public class SubtreeScopeCursor extends
* @param evaluator an IndexEntry (candidate) evaluator
* @throws Exception on db access failures
*/
- public SubtreeScopeCursor( Store db, SubtreeScopeEvaluator evaluator )
+ @SuppressWarnings("unchecked")
+ public SubtreeScopeCursor( Partition db, SubtreeScopeEvaluator evaluator )
throws Exception
{
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
this.db = db;
this.evaluator = evaluator;
@@ -79,12 +91,19 @@ public class SubtreeScopeCursor extends
}
else
{
- scopeCursor = db.getSubLevelIndex().forwardCursor( evaluator.getBaseId() );
+ Index<?> subLevelIdx = db.getSystemIndex( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
+ subLevelIdx = txnLogManager.wrap( db.getSuffixDn(), subLevelIdx );
+ scopeCursor = ( ( Index<UUID> ) subLevelIdx ).forwardCursor( evaluator.getBaseId() );
}
if ( evaluator.isDereferencing() )
- {
- dereferencedCursor = db.getSubAliasIndex().forwardCursor( evaluator.getBaseId() );
+ {
+ Index<?> subAliasIdx = db.getSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+ subAliasIdx = txnLogManager.wrap( db.getSuffixDn(), subAliasIdx );
+ dereferencedCursor = ( ( Index<UUID> )subAliasIdx ).forwardCursor( evaluator.getBaseId() );
+
+ aliasIdx = ( Index<String> )db.getSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ aliasIdx = ( Index<String> )txnLogManager.wrap( db.getSuffixDn(), aliasIdx );
}
else
{
@@ -109,7 +128,7 @@ public class SubtreeScopeCursor extends
{
try
{
- this.contextEntryId = db.getEntryId( ((Partition)db).getSuffixDn() );
+ this.contextEntryId = OperationExecutionManagerFactory.instance().getEntryId( db, db.getSuffixDn() );
}
catch ( Exception e )
{
@@ -120,7 +139,7 @@ public class SubtreeScopeCursor extends
if ( contextEntryId == null )
{
- return db.getDefaultId();
+ return Partition.defaultID;
}
return contextEntryId;
@@ -191,7 +210,7 @@ public class SubtreeScopeCursor extends
checkNotClosed( "previous()" );
setAvailable( cursor.previous() );
- if ( available() && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
+ if ( available() && aliasIdx.reverseLookup( cursor.get().getId() ) == null )
{
break;
}
@@ -225,7 +244,7 @@ public class SubtreeScopeCursor extends
checkNotClosed( "previous()" );
setAvailable( cursor.previous() );
- if ( available() && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
+ if ( available() && aliasIdx.reverseLookup( cursor.get().getId() ) == null )
{
break;
}
@@ -260,7 +279,7 @@ public class SubtreeScopeCursor extends
checkNotClosed( "next()" );
setAvailable( cursor.next() );
- if ( available() && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
+ if ( available() && aliasIdx.reverseLookup( cursor.get().getId() ) == null )
{
break;
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java Fri Nov 18 13:22:37 2011
@@ -22,9 +22,14 @@ package org.apache.directory.server.xdbm
import java.util.UUID;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -62,7 +67,16 @@ public class SubtreeScopeEvaluator imple
private final boolean dereferencing;
/** The entry database/store */
- private final Store db;
+ private final Partition db;
+
+ /** One level idx */
+ private final Index<UUID> subLevelIdx;
+
+ /** One level alias idx. Set if dereferencing aliases */
+ private final Index<UUID> subAliasIdx;
+
+ /** Alias idx. Set if dereferencing aliases */
+ private final Index<String> aliasIdx;
/**
@@ -72,7 +86,8 @@ public class SubtreeScopeEvaluator imple
* @param db the database used to evaluate scope node
* @throws Exception on db access failure
*/
- public SubtreeScopeEvaluator( Store db, ScopeNode node ) throws Exception
+ @SuppressWarnings("unchecked")
+ public SubtreeScopeEvaluator( Partition db, ScopeNode node ) throws Exception
{
this.db = db;
this.node = node;
@@ -82,9 +97,29 @@ public class SubtreeScopeEvaluator imple
throw new IllegalStateException( I18n.err( I18n.ERR_727 ) );
}
- baseId = db.getEntryId( node.getBaseDn() );
+ baseId = OperationExecutionManagerFactory.instance().getEntryId( db, node.getBaseDn() );
baseIsContextEntry = ( getContextEntryId().compareTo( baseId ) == 0 );
dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
+
+ Index<?> index;
+
+ TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+ index = db.getSystemIndex( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
+ subLevelIdx = ( Index<UUID> )txnLogManager.wrap( db.getSuffixDn(), index );
+
+ if ( dereferencing )
+ {
+ index = db.getSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
+ subAliasIdx = ( Index<UUID> )txnLogManager.wrap( db.getSuffixDn(), index );
+
+ index = db.getSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
+ aliasIdx = ( Index<String> )txnLogManager.wrap( db.getSuffixDn(), index );
+ }
+ else
+ {
+ subAliasIdx = null;
+ aliasIdx = null;
+ }
}
private UUID contextEntryId;
@@ -98,7 +133,7 @@ public class SubtreeScopeEvaluator imple
{
try
{
- this.contextEntryId = db.getEntryId( ((Partition)db).getSuffixDn() );
+ this.contextEntryId = OperationExecutionManagerFactory.instance().getEntryId( db, db.getSuffixDn() );
}
catch ( Exception e )
{
@@ -109,7 +144,7 @@ public class SubtreeScopeEvaluator imple
if ( contextEntryId == null )
{
- return db.getDefaultId();
+ return Partition.defaultID;
}
return contextEntryId;
@@ -137,7 +172,7 @@ public class SubtreeScopeEvaluator imple
* to all it's subordinates since that would be the entire set of
* entries in the db.
*/
- boolean isDescendant = baseIsContextEntry || baseId.equals( id ) || db.getSubLevelIndex().forward( baseId, id );
+ boolean isDescendant = baseIsContextEntry || baseId.equals( id ) || subLevelIdx.forward( baseId, id );
/*
* The candidate id could be any entry in the db. If search
@@ -154,7 +189,7 @@ public class SubtreeScopeEvaluator imple
* candidate id is an alias, if so we reject it since aliases should
* not be returned.
*/
- if ( null != db.getAliasIndex().reverseLookup( id ) )
+ if ( null != aliasIdx.reverseLookup( id ) )
{
return false;
}
@@ -181,7 +216,7 @@ public class SubtreeScopeEvaluator imple
* the lookup returns true accepting the candidate. Otherwise the
* candidate is rejected with a false return because it is not in scope.
*/
- return db.getSubAliasIndex().forward( baseId, id );
+ return subAliasIdx.forward( baseId, id );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Fri Nov 18 13:22:37 2011
@@ -26,12 +26,15 @@ import static org.junit.Assert.assertTru
import static org.junit.Assert.fail;
import java.io.File;
+import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.xdbm.Store;
@@ -127,6 +130,11 @@ public class AndCursorTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
@@ -144,8 +152,8 @@ public class AndCursorTest
XdbmStoreUtils.loadExampleData( store, schemaManager );
- evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
- cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
+ evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
+ cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );
LOG.debug( "Created new store" );
}
@@ -212,8 +220,8 @@ public class AndCursorTest
Evaluator<? extends ExprNode> eval;
ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
- eval = new SubstringEvaluator( (SubstringNode) exprNode, store, schemaManager );
- IndexCursor<?> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
+ eval = new SubstringEvaluator( (SubstringNode) exprNode, ( Partition )store, schemaManager );
+ IndexCursor<?> wrapped = new SubstringCursor( ( Partition )store, ( SubstringEvaluator ) eval );
/* adding this results in NPE adding Presence evaluator not
Substring evaluator but adding Substring cursor as wrapped cursor */
@@ -222,7 +230,7 @@ public class AndCursorTest
andNode.addNode( exprNode );
exprNode = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- eval = new PresenceEvaluator( (PresenceNode) exprNode, store, schemaManager );
+ eval = new PresenceEvaluator( (PresenceNode) exprNode, ( Partition )store, schemaManager );
evaluators.add( eval );
andNode.addNode( exprNode );
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Fri Nov 18 13:22:37 2011
@@ -37,6 +37,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.XdbmStoreUtils;
@@ -80,7 +82,7 @@ public class GreaterEqTest
public static final Logger LOG = LoggerFactory.getLogger( GreaterEqTest.class );
File wkdir;
- Store store;
+ Partition store;
static SchemaManager schemaManager = null;
@@ -127,21 +129,26 @@ public class GreaterEqTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
- ((Partition)store).setId( "example" );
- store.setCacheSize( 10 );
- store.setPartitionPath( wkdir.toURI() );
- store.setSyncOnWrite( false );
-
- store.addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
- store.addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
- store.addIndex( new AvlIndex( SchemaConstants.POSTALCODE_AT_OID ) );
+ store.setId( "example" );
+ ( ( Store ) store ).setCacheSize( 10 );
+ ( ( Store ) store ).setPartitionPath( wkdir.toURI() );
+ ( ( Store ) store ).setSyncOnWrite( false );
+
+ ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
+ ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
+ ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.POSTALCODE_AT_OID ) );
((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
((Partition)store).initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Store ) store, schemaManager );
LOG.debug( "Created new store" );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java Fri Nov 18 13:22:37 2011
@@ -37,6 +37,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.XdbmStoreUtils;
@@ -80,7 +82,7 @@ public class LessEqTest
public static final Logger LOG = LoggerFactory.getLogger( LessEqTest.class );
File wkdir;
- Store store;
+ Partition store;
static SchemaManager schemaManager = null;
@@ -127,23 +129,28 @@ public class LessEqTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
((Partition)store).setId( "example" );
- store.setCacheSize( 10 );
- store.setPartitionPath( wkdir.toURI() );
- store.setSyncOnWrite( false );
-
- store.addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
- store.addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
- store.addIndex( new AvlIndex( SchemaConstants.POSTALCODE_AT_OID ) );
- ((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
- ((Partition)store).initialize();
+ ( ( Store ) store ).setCacheSize( 10 );
+ ( ( Store ) store ).setPartitionPath( wkdir.toURI() );
+ ( ( Store ) store ).setSyncOnWrite( false );
+
+ ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
+ ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
+ ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.POSTALCODE_AT_OID ) );
+ store.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
+ store.initialize();
- ((Partition)store).initialize();
+ store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
LOG.debug( "Created new store" );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java Fri Nov 18 13:22:37 2011
@@ -33,6 +33,8 @@ import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.XdbmStoreUtils;
@@ -126,6 +128,11 @@ public class NestedFilterTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
@@ -141,9 +148,9 @@ public class NestedFilterTest
XdbmStoreUtils.loadExampleData( store, schemaManager );
- evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
- cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
- optimizer = new DefaultOptimizer( store );
+ evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
+ cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );
+ optimizer = new DefaultOptimizer( ( Partition )store );
LOG.debug( "Created new store" );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java Fri Nov 18 13:22:37 2011
@@ -33,6 +33,8 @@ import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.xdbm.Store;
@@ -125,6 +127,11 @@ public class NotCursorTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
@@ -142,8 +149,8 @@ public class NotCursorTest
XdbmStoreUtils.loadExampleData( store, schemaManager );
- evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
- cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
+ evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
+ cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );
LOG.debug( "Created new store" );
}
@@ -209,11 +216,11 @@ public class NotCursorTest
NotNode notNode = new NotNode();
ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
- Evaluator<? extends ExprNode> eval = new SubstringEvaluator( (SubstringNode) exprNode, store,
+ Evaluator<? extends ExprNode> eval = new SubstringEvaluator( (SubstringNode) exprNode, ( Partition )store,
schemaManager );
notNode.addNode( exprNode );
- NotCursor<String> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
+ NotCursor<String> cursor = new NotCursor( ( Partition )store, eval ); //cursorBuilder.build( andNode );
cursor.beforeFirst();
Set<UUID> set = new HashSet<UUID>();
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java Fri Nov 18 13:22:37 2011
@@ -33,6 +33,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
import org.apache.directory.server.xdbm.Store;
@@ -72,7 +74,7 @@ public class OneLevelScopeTest
public static final Logger LOG = LoggerFactory.getLogger( OneLevelScopeTest.class );
File wkdir;
- Store store;
+ Partition store;
static SchemaManager schemaManager = null;
@@ -119,22 +121,27 @@ public class OneLevelScopeTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
- ((Partition)store).setId( "example" );
- store.setCacheSize( 10 );
- store.setPartitionPath( wkdir.toURI() );
- store.setSyncOnWrite( true );
-
- store.addIndex( new AvlIndex<String>( SchemaConstants.OU_AT_OID ) );
- store.addIndex( new AvlIndex<String>( SchemaConstants.CN_AT_OID ) );
- ((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
- ((Partition)store).initialize();
+ store.setId( "example" );
+ ( ( Store )store).setCacheSize( 10 );
+ ( ( Store )store).setPartitionPath( wkdir.toURI() );
+ ( ( Store )store).setSyncOnWrite( true );
+
+ ( ( Store )store).addIndex( new AvlIndex<String>( SchemaConstants.OU_AT_OID ) );
+ ( ( Store )store).addIndex( new AvlIndex<String>( SchemaConstants.CN_AT_OID ) );
+ store.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
+ store.initialize();
- ((Partition)store).initialize();
+ store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
LOG.debug( "Created new store" );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java Fri Nov 18 13:22:37 2011
@@ -32,6 +32,8 @@ import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.core.api.partition.index.IndexCursor;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
@@ -78,7 +80,7 @@ public class OrCursorTest
private static final Logger LOG = LoggerFactory.getLogger( OrCursorTest.class.getSimpleName() );
File wkdir;
- Store store;
+ Partition store;
static SchemaManager schemaManager = null;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
@@ -126,22 +128,27 @@ public class OrCursorTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
- ((Partition)store).setId( "example" );
- store.setCacheSize( 10 );
- store.setPartitionPath( wkdir.toURI() );
- store.setSyncOnWrite( false );
-
- store.addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
- store.addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
- ((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
- ((Partition)store).initialize();
+ store.setId( "example" );
+ ( ( Store )store).setCacheSize( 10 );
+ ( ( Store )store).setPartitionPath( wkdir.toURI() );
+ ( ( Store )store).setSyncOnWrite( false );
+
+ ( ( Store )store).addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
+ ( ( Store )store).addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
+ store.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
+ store.initialize();
- ((Partition)store).initialize();
+ store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java Fri Nov 18 13:22:37 2011
@@ -35,6 +35,8 @@ import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.XdbmStoreUtils;
@@ -69,7 +71,7 @@ public class PresenceTest
private static final Logger LOG = LoggerFactory.getLogger( PresenceTest.class.getSimpleName() );
File wkdir;
- Store store;
+ Partition store;
static SchemaManager schemaManager = null;
@@ -115,22 +117,27 @@ public class PresenceTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
- ((Partition)store).setId( "example" );
- store.setCacheSize( 10 );
- store.setPartitionPath( wkdir.toURI() );
- store.setSyncOnWrite( false );
-
- store.addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
- store.addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
- ((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
- ((Partition)store).initialize();
+ store.setId( "example" );
+ ( ( Store )store).setCacheSize( 10 );
+ ( ( Store )store).setPartitionPath( wkdir.toURI() );
+ ( ( Store )store).setSyncOnWrite( false );
+
+ ( ( Store )store).addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
+ ( ( Store )store).addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
+ store.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
+ store.initialize();
- ((Partition)store).initialize();
+ store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -441,7 +448,7 @@ public class PresenceTest
entry = new ForwardIndexEntry<String>();
entry.setValue( SchemaConstants.SEARCHGUIDE_AT_OID );
entry.setId( Strings.getUUIDString( 5 ) );
- entry.setEntry( store.lookup( Strings.getUUIDString( 5 ) ) );
+ entry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 5 ) ) );
assertFalse( evaluator.evaluate( entry ) );
node = new PresenceNode( schemaManager.getAttributeType( "st" ) );
@@ -453,7 +460,7 @@ public class PresenceTest
entry = new ForwardIndexEntry<String>();
entry.setValue( SchemaConstants.ST_AT_OID );
entry.setId( Strings.getUUIDString( 5 ) );
- entry.setEntry( store.lookup( Strings.getUUIDString(53 ) ) );
+ entry.setEntry( store.getMasterTable().get( Strings.getUUIDString(53 ) ) );
assertFalse( evaluator.evaluate( entry ) );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java Fri Nov 18 13:22:37 2011
@@ -30,6 +30,8 @@ import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.XdbmStoreUtils;
@@ -64,7 +66,7 @@ public class SubstringTest
private static final Logger LOG = LoggerFactory.getLogger( SubstringTest.class.getSimpleName() );
File wkdir;
- Store store;
+ Partition store;
static SchemaManager schemaManager = null;
@@ -111,22 +113,27 @@ public class SubstringTest
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
+
// initialize the store
store = new AvlPartition( schemaManager );
- ((Partition)store).setId( "example" );
- store.setCacheSize( 10 );
- store.setPartitionPath( wkdir.toURI() );
- store.setSyncOnWrite( false );
+ store.setId( "example" );
+ ( (Store )store ).setCacheSize( 10 );
+ ( (Store )store ).setPartitionPath( wkdir.toURI() );
+ ( (Store )store ).setSyncOnWrite( false );
- store.addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
- store.addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
+ ( (Store )store ).addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
+ ( (Store )store ).addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
Dn suffixDn = new Dn( schemaManager, "o=Good Times Co." );
- ((Partition)store).setSuffixDn( suffixDn );
+ store.setSuffixDn( suffixDn );
- ((Partition)store).initialize();
+ store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -623,35 +630,35 @@ public class SubstringTest
evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setId( Strings.getUUIDString( 5 ) );
- indexEntry.setEntry( store.lookup( Strings.getUUIDString( 5 ) ) );
+ indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 5 ) ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "searchGuide" ), "j", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setId( Strings.getUUIDString( 6 ) );
- indexEntry.setEntry( store.lookup( Strings.getUUIDString( 6 ) ) );
+ indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "st" ), "j", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setId( Strings.getUUIDString( 6 ) );
- indexEntry.setEntry( store.lookup( Strings.getUUIDString( 6 ) ) );
+ indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "name" ), "j", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setId( Strings.getUUIDString( 6 ) );
- indexEntry.setEntry( store.lookup( Strings.getUUIDString( 6 ) ) );
+ indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "name" ), "s", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setId( Strings.getUUIDString( 6 ) );
- indexEntry.setEntry( store.lookup( Strings.getUUIDString( 6 ) ) );
+ indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
assertTrue( evaluator.evaluate( indexEntry ) );
}
@@ -672,14 +679,14 @@ public class SubstringTest
evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setId( Strings.getUUIDString( 6 ) );
- indexEntry.setEntry( store.lookup( Strings.getUUIDString( 6 ) ) );
+ indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "s", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setId( Strings.getUUIDString( 6 ) );
- indexEntry.setEntry( store.lookup( Strings.getUUIDString( 6 ) ) );
+ indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
assertFalse( evaluator.evaluate( indexEntry ) );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java?rev=1203640&r1=1203639&r2=1203640&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java Fri Nov 18 13:22:37 2011
@@ -34,6 +34,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
import org.apache.directory.server.xdbm.Store;
@@ -73,7 +75,7 @@ public class SubtreeScopeTest
public static final Logger LOG = LoggerFactory.getLogger( SubtreeScopeTest.class );
File wkdir;
- Store store;
+ Partition store;
static SchemaManager schemaManager = null;
@@ -119,22 +121,27 @@ public class SubtreeScopeTest
wkdir.delete();
wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
wkdir.mkdirs();
+
+ File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar );
+ logDir.mkdirs();
+ TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+ OperationExecutionManagerFactory.init();
// initialize the store
store = new AvlPartition( schemaManager );
- ((Partition)store).setId( "example" );
- store.setCacheSize( 10 );
- store.setPartitionPath( wkdir.toURI() );
- store.setSyncOnWrite( true );
-
- store.addIndex( new AvlIndex<String>( SchemaConstants.OU_AT_OID ) );
- store.addIndex( new AvlIndex<String>( SchemaConstants.CN_AT_OID ) );
- ((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
- ((Partition)store).initialize();
+ store.setId( "example" );
+ ( ( Store )store ).setCacheSize( 10 );
+ ( ( Store )store ).setPartitionPath( wkdir.toURI() );
+ ( ( Store )store ).setSyncOnWrite( true );
+
+ ( ( Store )store ).addIndex( new AvlIndex<String>( SchemaConstants.OU_AT_OID ) );
+ ( ( Store )store ).addIndex( new AvlIndex<String>( SchemaConstants.CN_AT_OID ) );
+ store.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
+ store.initialize();
- ((Partition)store).initialize();
+ store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
LOG.debug( "Created new store" );
}