You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/07/09 12:46:40 UTC
svn commit: r1144634 - in /directory/apacheds/trunk:
core-api/src/main/java/org/apache/directory/server/core/
core-api/src/main/java/org/apache/directory/server/core/filtering/
core-api/src/main/java/org/apache/directory/server/core/interceptor/context...
Author: elecharny
Date: Sat Jul 9 10:46:39 2011
New Revision: 1144634
URL: http://svn.apache.org/viewvc?rev=1144634&view=rev
Log:
o Revertd the change for DIRSERVER-1633 : we have to find a better fix, the JIRA remains opened
o Removed references to ClonedServerEntry whenever possible
o Moved the index setup from the inherited classes to the AbstractStore
o Removed the Store.hasUserIndexOn( String id ) and Store.hasSystemIndexOn() methods
o Removed the AbstractStore.isCheckHasEntryDuringAdd() method
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/EntryToResponseCursor.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperation.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperationManager.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java
directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/EntryToResponseCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/EntryToResponseCursor.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/EntryToResponseCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/EntryToResponseCursor.java Sat Jul 9 10:46:39 2011
@@ -122,7 +122,7 @@ public class EntryToResponseCursor imple
public Response get() throws Exception
{
- ClonedServerEntry entry = ( ClonedServerEntry ) wrapped.get();
+ Entry entry = ( ClonedServerEntry ) wrapped.get();
SearchResultEntry se = new SearchResultEntryImpl( messageId );
se.setEntry( entry );
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java Sat Jul 9 10:46:39 2011
@@ -495,7 +495,7 @@ public class BaseEntryFilteringCursor im
if ( tempEntry instanceof ClonedServerEntry )
{
- tempResult = ( ClonedServerEntry ) tempEntry;
+ tempResult = tempEntry;
}
else
{
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java Sat Jul 9 10:46:39 2011
@@ -21,7 +21,7 @@ package org.apache.directory.server.core
import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.message.DeleteRequest;
import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
@@ -93,7 +93,7 @@ public class DeleteOperationContext exte
/**
* @param entry the entry to set
*/
- public void setEntry( ClonedServerEntry entry )
+ public void setEntry( Entry entry )
{
this.entry = entry;
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperation.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperation.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperation.java Sat Jul 9 10:46:39 2011
@@ -22,7 +22,6 @@ package org.apache.directory.server.core
import java.util.Collection;
import java.util.List;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
@@ -168,13 +167,13 @@ public class MockOperation implements Op
}
- public ClonedServerEntry lookup( Dn dn, Collection<String> bypass ) throws LdapException
+ public Entry lookup( Dn dn, Collection<String> bypass ) throws LdapException
{
return null;
}
- public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws LdapException
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
return null;
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperationManager.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperationManager.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockOperationManager.java Sat Jul 9 10:46:39 2011
@@ -19,7 +19,6 @@
*/
package org.apache.directory.server.core;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -83,7 +82,7 @@ public class MockOperationManager implem
return null;
}
- public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws LdapException
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
return null;
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ClonedServerEntryTest.java Sat Jul 9 10:46:39 2011
@@ -42,13 +42,13 @@ import com.mycila.junit.concurrent.Concu
@Concurrency()
public class ClonedServerEntryTest
{
- private static ClonedServerEntry clonedServerEntryA;
- private static ClonedServerEntry clonedServerEntryACopy;
- private static ClonedServerEntry clonedServerEntryB;
- private static ClonedServerEntry clonedServerEntryA1;
- private static ClonedServerEntry clonedServerEntryACopy1;
- private static ClonedServerEntry clonedServerEntryB1;
- private static ClonedServerEntry clonedServerEntryC1;
+ private static Entry clonedServerEntryA;
+ private static Entry clonedServerEntryACopy;
+ private static Entry clonedServerEntryB;
+ private static Entry clonedServerEntryA1;
+ private static Entry clonedServerEntryACopy1;
+ private static Entry clonedServerEntryB1;
+ private static Entry clonedServerEntryC1;
/**
* Initialize name instances
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java Sat Jul 9 10:46:39 2011
@@ -46,12 +46,12 @@ public class BackupUtilitiesSP
* @param deletedEntry the entry that was deleted
* @throws Exception if there are failures
*/
- public static void backupDeleted( CoreSession session, ClonedServerEntry deletedEntry ) throws Exception
+ public static void backupDeleted( CoreSession session, Entry deletedEntry ) throws Exception
{
LOG.info( "User \"" + session.getEffectivePrincipal() + "\" has deleted entry \"" + deletedEntry + "\"" );
Dn backupDn = new Dn( "ou=backupContext,ou=system" );
String deletedEntryRdn = deletedEntry.getDn().getRdn().getName();
- Entry entry = ( Entry ) deletedEntry.getOriginalEntry().clone();
+ Entry entry = (( ClonedServerEntry ) deletedEntry).getOriginalEntry().clone();
backupDn = backupDn.add( deletedEntryRdn );
entry.setDn( backupDn );
session.add( deletedEntry );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Sat Jul 9 10:46:39 2011
@@ -1304,7 +1304,7 @@ public class AciAuthorizationInterceptor
}
- private boolean filter( OperationContext opContext, Dn normName, ClonedServerEntry clonedEntry ) throws Exception
+ private boolean filter( OperationContext opContext, Dn normName, Entry clonedEntry ) throws Exception
{
/*
* First call hasPermission() for entry level "Browse" and "ReturnDN" perm
@@ -1317,8 +1317,8 @@ public class AciAuthorizationInterceptor
Set<Dn> userGroups = groupCache.getGroups( userDn.getNormName() );
Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( opContext, tuples, normName, clonedEntry );
- addEntryAciTuples( tuples, clonedEntry.getOriginalEntry() );
- addSubentryAciTuples( opContext, tuples, normName, clonedEntry.getOriginalEntry() );
+ addEntryAciTuples( tuples, ((ClonedServerEntry)clonedEntry).getOriginalEntry() );
+ addSubentryAciTuples( opContext, tuples, normName, ((ClonedServerEntry)clonedEntry).getOriginalEntry() );
AciContext aciContext = new AciContext( schemaManager, opContext );
aciContext.setUserGroupNames( userGroups );
@@ -1327,7 +1327,7 @@ public class AciAuthorizationInterceptor
aciContext.setEntryDn( normName );
aciContext.setMicroOperations( SEARCH_ENTRY_PERMS );
aciContext.setAciTuples( tuples );
- aciContext.setEntry( clonedEntry.getOriginalEntry() );
+ aciContext.setEntry( ((ClonedServerEntry)clonedEntry).getOriginalEntry() );
if ( !engine.hasPermission( aciContext ) )
{
@@ -1416,7 +1416,7 @@ public class AciAuthorizationInterceptor
{
Dn normName = entry.getDn().apply( schemaManager );
- return filter( searchContext, normName, (ClonedServerEntry)entry );
+ return filter( searchContext, normName, entry );
}
}
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Sat Jul 9 10:46:39 2011
@@ -599,7 +599,7 @@ public class DefaultPartitionNexus exten
// This is for the case we do a lookup on the rootDSE
if ( dn.size() == 0 )
{
- ClonedServerEntry retval = new ClonedServerEntry( rootDSE );
+ Entry retval = new ClonedServerEntry( rootDSE );
Set<AttributeType> attributeTypes = rootDSE.getAttributeTypes();
if ( lookupContext.getAttrsId() != null && !lookupContext.getAttrsId().isEmpty() )
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Sat Jul 9 10:46:39 2011
@@ -112,8 +112,6 @@ public class JdbmStore<E> extends Abstra
*/
public synchronized void init( SchemaManager schemaManager ) throws Exception
{
- super.init( schemaManager );
-
getPartitionDir().mkdirs();
// First, check if the file storing the data exists
@@ -137,18 +135,14 @@ public class JdbmStore<E> extends Abstra
// Create the master table (the table containing all the entries)
master = new JdbmMasterTable<Entry>( recMan, schemaManager );
- // -------------------------------------------------------------------
- // Initializes the user and system indices
- // -------------------------------------------------------------------
-
// get all index db files first
File[] allIndexDbFiles = getPartitionDir().listFiles( DB_FILTER );
// get the names of the db files also
List<String> indexDbFileNameList = Arrays.asList( getPartitionDir().list( DB_FILTER ) );
- setupSystemIndices();
- setupUserIndices();
+ // Initialize the index now
+ super.init( schemaManager );
// then add all index objects to a list
List<String> allIndices = new ArrayList<String>();
@@ -171,7 +165,7 @@ public class JdbmStore<E> extends Abstra
// if the name doesn't exist in the list of index DB files
// this is a new index and we need to build it
- if( !indexDbFileNameList.contains( name ) )
+ if ( !indexDbFileNameList.contains( name ) )
{
buildUserIndex( i );
}
@@ -385,7 +379,8 @@ public class JdbmStore<E> extends Abstra
Entry entry = tuple.getValue();
Attribute entryAttr = entry.get( atType );
- if( entryAttr != null )
+
+ if ( entryAttr != null )
{
for ( Value<?> value : entryAttr )
{
Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Sat Jul 9 10:46:39 2011
@@ -435,7 +435,7 @@ public class JdbmStoreTest
assertNotNull( store.getSuffixDn() );
assertEquals( 2, store.getUserIndices().size() );
- assertFalse( store.hasUserIndexOn( "dc" ) );
+ assertFalse( store.hasUserIndexOn( DC_AT ) );
assertTrue( store.hasUserIndexOn( OU_AT ) );
assertTrue( store.hasSystemIndexOn( APACHE_ALIAS_AT ) );
Iterator<String> userIndices = store.userIndices();
Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java Sat Jul 9 10:46:39 2011
@@ -360,15 +360,6 @@ public abstract class AbstractLdifPartit
}
/**
- * @see AbstractStore#isCheckHasEntryDuringAdd()
- */
- public boolean isCheckHasEntryDuringAdd()
- {
- return wrappedPartition.getStore().isCheckHasEntryDuringAdd();
- }
-
-
- /**
* @see AbstractStore#setCheckHasEntryDuringAdd(boolean)
*/
public void setCheckHasEntryDuringAdd( boolean checkHasEntryDuringAdd )
Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java Sat Jul 9 10:46:39 2011
@@ -151,14 +151,14 @@ public class LdifPartitionTest
}
- private ClonedServerEntry createEntry( String dn ) throws Exception
+ private Entry createEntry( String dn ) throws Exception
{
Entry entry = new DefaultEntry( schemaManager );
entry.setDn( new Dn( schemaManager, dn ) );
entry.put( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString() );
entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
- ClonedServerEntry clonedEntry = new ClonedServerEntry( entry );
+ Entry clonedEntry = new ClonedServerEntry( entry );
return clonedEntry;
}
@@ -180,21 +180,21 @@ public class LdifPartitionTest
new MockDirectoryService( 1 ) );
AddOperationContext addCtx = new AddOperationContext( session );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
+ Entry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
entryMvrdn.put( "ObjectClass", "top", "domain" );
entryMvrdn.put( "dc", "mvrdn" );
addCtx.setEntry( entryMvrdn );
@@ -225,21 +225,21 @@ public class LdifPartitionTest
new MockDirectoryService( 1 ) );
AddOperationContext addCtx = new AddOperationContext( session );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entry3 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
+ Entry entry3 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
entry3.put( "ObjectClass", "top", "domain" );
entry3.put( "dc", "test" );
addCtx.setEntry( entry3 );
@@ -279,28 +279,28 @@ public class LdifPartitionTest
new MockDirectoryService( 1 ) );
AddOperationContext addCtx = new AddOperationContext( session );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test1" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
+ Entry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
entry3.put( "ObjectClass", "top", "domain" );
entry3.put( "dc", "test2" );
addCtx.setEntry( entry3 );
partition.add( addCtx );
- ClonedServerEntry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
+ Entry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
entryMvrdn.put( "ObjectClass", "top", "domain" );
entryMvrdn.put( "dc", "mvrdn" );
addCtx.setEntry( entryMvrdn );
@@ -365,21 +365,21 @@ public class LdifPartitionTest
new MockDirectoryService( 1 ) );
AddOperationContext addCtx = new AddOperationContext( session );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test1" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
+ Entry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
entry3.put( "ObjectClass", "top", "domain" );
entry3.put( "dc", "test2" );
addCtx.setEntry( entry3 );
@@ -592,7 +592,7 @@ public class LdifPartitionTest
String rdnWithForbiddenChars = "dc=- -\\\"-%-&-(-)-*-\\+-/-:-\\;-\\<-\\>-?-[-\\5C-]-|-";
String rdnWithEscapedChars = "dc=-%20-%22-%25-%26-%28-%29-%2a-%2b-%2f-%3a-%3b-%3c-%3e-%3f-%5b-%5c-%5d-%7c-";
- ClonedServerEntry entry1 = createEntry( rdnWithForbiddenChars + ",ou=test,ou=system" );
+ Entry entry1 = createEntry( rdnWithForbiddenChars + ",ou=test,ou=system" );
entry1.put( "objectClass", "top", "domain" );
addCtx.setEntry( entry1 );
@@ -626,7 +626,7 @@ public class LdifPartitionTest
String rdnWithEscapedChars = "userpassword=-%00-%01-%02-%03-%04-%05-%06-%07-%08-%09-%0a-%0b-%0c-%0d-%0e-%0f" +
"-%10-%11-%12-%13-%14-%15-%16-%17-%18-%19-%1a-%1b-%1c-%1d-%1e-%1f-%7f";
- ClonedServerEntry entry1 = createEntry( rdnWithControlChars + ",ou=test,ou=system" );
+ Entry entry1 = createEntry( rdnWithControlChars + ",ou=test,ou=system" );
entry1.put( "objectClass", "top", "person" );
entry1.put( "cn", "test" );
entry1.put( "sn", "test" );
@@ -648,35 +648,35 @@ public class LdifPartitionTest
new MockDirectoryService( 1 ) );
AddOperationContext addCtx = new AddOperationContext( session );
- ClonedServerEntry childEntry1 = createEntry( "dc=child1,ou=test,ou=system" );
+ Entry childEntry1 = createEntry( "dc=child1,ou=test,ou=system" );
childEntry1.put( "ObjectClass", "top", "domain" );
childEntry1.put( "dc", "child1" );
addCtx.setEntry( childEntry1 );
partition.add( addCtx );
- ClonedServerEntry childEntry2 = createEntry( "dc=child2,ou=test,ou=system" );
+ Entry childEntry2 = createEntry( "dc=child2,ou=test,ou=system" );
childEntry2.put( "ObjectClass", "top", "domain" );
childEntry2.put( "dc", "child2" );
addCtx.setEntry( childEntry2 );
partition.add( addCtx );
- ClonedServerEntry grandChild11 = createEntry( "dc=grandChild11,dc=child1,ou=test,ou=system" );
+ Entry grandChild11 = createEntry( "dc=grandChild11,dc=child1,ou=test,ou=system" );
grandChild11.put( "ObjectClass", "top", "domain" );
grandChild11.put( "dc", "grandChild11" );
addCtx.setEntry( grandChild11 );
partition.add( addCtx );
- ClonedServerEntry grandChild12 = createEntry( "dc=grandChild12,dc=child1,ou=test,ou=system" );
+ Entry grandChild12 = createEntry( "dc=grandChild12,dc=child1,ou=test,ou=system" );
grandChild12.put( "ObjectClass", "top", "domain" );
grandChild12.put( "dc", "grandChild12" );
addCtx.setEntry( grandChild12 );
partition.add( addCtx );
- ClonedServerEntry greatGrandChild111 = createEntry( "dc=greatGrandChild111,dc=grandChild11,dc=child1,ou=test,ou=system" );
+ Entry greatGrandChild111 = createEntry( "dc=greatGrandChild111,dc=grandChild11,dc=child1,ou=test,ou=system" );
greatGrandChild111.put( "ObjectClass", "top", "domain" );
greatGrandChild111.put( "dc", "greatGrandChild111" );
addCtx.setEntry( greatGrandChild111 );
Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java Sat Jul 9 10:46:39 2011
@@ -102,7 +102,7 @@ public class SingleFileLdifPartitionTest
private static CoreSession mockSession;
- private static ClonedServerEntry contextEntry;
+ private static Entry contextEntry;
private static LdifReader reader = new LdifReader();
@@ -165,14 +165,15 @@ public class SingleFileLdifPartitionTest
}
- private ClonedServerEntry createEntry( String dn ) throws Exception
+ private Entry createEntry( String dn ) throws Exception
{
Entry entry = new DefaultEntry( schemaManager );
entry.setDn( new Dn( schemaManager, dn ) );
entry.put( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString() );
entry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
- ClonedServerEntry clonedEntry = new ClonedServerEntry( entry );
+ Entry clonedEntry = new ClonedServerEntry( entry );
+
return clonedEntry;
}
@@ -304,21 +305,21 @@ public class SingleFileLdifPartitionTest
partition.add( addCtx );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
+ Entry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
entryMvrdn.put( "ObjectClass", "top", "domain" );
entryMvrdn.put( "dc", "mvrdn" );
addCtx.setEntry( entryMvrdn );
@@ -392,14 +393,14 @@ public class SingleFileLdifPartitionTest
partition.modify( modOpCtx );
assertEquals( getEntryLdifLen( modOpCtx.getAlteredEntry() ), file.length() );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test" );
addCtx.setEntry( entry2 );
@@ -495,21 +496,21 @@ public class SingleFileLdifPartitionTest
partition.add( addCtx );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entry3 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
+ Entry entry3 = createEntry( "dc=test,dc=test,ou=test,ou=system" );
entry3.put( "ObjectClass", "top", "domain" );
entry3.put( "dc", "test" );
addCtx.setEntry( entry3 );
@@ -562,28 +563,28 @@ public class SingleFileLdifPartitionTest
partition.add( addCtx );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test1" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
+ Entry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
entry3.put( "ObjectClass", "top", "domain" );
entry3.put( "dc", "test2" );
addCtx.setEntry( entry3 );
partition.add( addCtx );
- ClonedServerEntry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
+ Entry entryMvrdn = createEntry( "dc=mvrdn+objectClass=domain,dc=test,ou=test,ou=system" );
entryMvrdn.put( "ObjectClass", "top", "domain" );
entryMvrdn.put( "dc", "mvrdn" );
addCtx.setEntry( entryMvrdn );
@@ -620,21 +621,21 @@ public class SingleFileLdifPartitionTest
partition.add( addCtx );
- ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
+ Entry entry1 = createEntry( "dc=test,ou=test,ou=system" );
entry1.put( "ObjectClass", "top", "domain" );
entry1.put( "dc", "test" );
addCtx.setEntry( entry1 );
partition.add( addCtx );
- ClonedServerEntry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
+ Entry entry2 = createEntry( "dc=test1,dc=test,ou=test,ou=system" );
entry2.put( "ObjectClass", "top", "domain" );
entry2.put( "dc", "test1" );
addCtx.setEntry( entry2 );
partition.add( addCtx );
- ClonedServerEntry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
+ Entry entry3 = createEntry( "dc=test2,dc=test,ou=test,ou=system" );
entry3.put( "ObjectClass", "top", "domain" );
entry3.put( "dc", "test2" );
addCtx.setEntry( entry3 );
@@ -923,7 +924,7 @@ public class SingleFileLdifPartitionTest
{
AddOperationContext addCtx = new AddOperationContext( mockSession );
- ClonedServerEntry childEntry1 = createEntry( "dc=threadDoModify,ou=test,ou=system" );
+ Entry childEntry1 = createEntry( "dc=threadDoModify,ou=test,ou=system" );
childEntry1.put( "ObjectClass", "top", "domain" );
childEntry1.put( "dc", "threadDoModify" );
addCtx.setEntry( childEntry1 );
@@ -986,7 +987,7 @@ public class SingleFileLdifPartitionTest
for ( ; i < 1000; i++ )
{
- ClonedServerEntry entry = createEntry( "dc=threadDoAddAndDelete,ou=test,ou=system" );
+ Entry entry = createEntry( "dc=threadDoAddAndDelete,ou=test,ou=system" );
entry.put( "ObjectClass", "top", "domain" );
entry.put( "dc", "threadDoAddAndDelete" );
addCtx.setEntry( entry );
@@ -1126,35 +1127,35 @@ public class SingleFileLdifPartitionTest
partition.add( addCtx );
- ClonedServerEntry childEntry1 = createEntry( "dc=child1,ou=test,ou=system" );
+ Entry childEntry1 = createEntry( "dc=child1,ou=test,ou=system" );
childEntry1.put( "ObjectClass", "top", "domain" );
childEntry1.put( "dc", "child1" );
addCtx.setEntry( childEntry1 );
partition.add( addCtx );
- ClonedServerEntry childEntry2 = createEntry( "dc=child2,ou=test,ou=system" );
+ Entry childEntry2 = createEntry( "dc=child2,ou=test,ou=system" );
childEntry2.put( "ObjectClass", "top", "domain" );
childEntry2.put( "dc", "child2" );
addCtx.setEntry( childEntry2 );
partition.add( addCtx );
- ClonedServerEntry grandChild11 = createEntry( "dc=grandChild11,dc=child1,ou=test,ou=system" );
+ Entry grandChild11 = createEntry( "dc=grandChild11,dc=child1,ou=test,ou=system" );
grandChild11.put( "ObjectClass", "top", "domain" );
grandChild11.put( "dc", "grandChild11" );
addCtx.setEntry( grandChild11 );
partition.add( addCtx );
- ClonedServerEntry grandChild12 = createEntry( "dc=grandChild12,dc=child1,ou=test,ou=system" );
+ Entry grandChild12 = createEntry( "dc=grandChild12,dc=child1,ou=test,ou=system" );
grandChild12.put( "ObjectClass", "top", "domain" );
grandChild12.put( "dc", "grandChild12" );
addCtx.setEntry( grandChild12 );
partition.add( addCtx );
- ClonedServerEntry greatGrandChild111 = createEntry( "dc=greatGrandChild111,dc=grandChild11,dc=child1,ou=test,ou=system" );
+ Entry greatGrandChild111 = createEntry( "dc=greatGrandChild111,dc=grandChild11,dc=child1,ou=test,ou=system" );
greatGrandChild111.put( "ObjectClass", "top", "domain" );
greatGrandChild111.put( "dc", "greatGrandChild111" );
addCtx.setEntry( greatGrandChild111 );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Sat Jul 9 10:46:39 2011
@@ -1198,8 +1198,7 @@ public class SearchHandler extends LdapR
// if we get here then we have a valid referral ancestor
try
{
- Referral referral = getReferralOnAncestorForSearch( session, req,
- ( ( ClonedServerEntry ) referralAncestor ) );
+ Referral referral = getReferralOnAncestorForSearch( session, req, referralAncestor );
result.setResultCode( ResultCodeEnum.REFERRAL );
result.setReferral( referral );
@@ -1223,7 +1222,7 @@ public class SearchHandler extends LdapR
* @param req the request
* @param entry the entry associated with the request
*/
- private void handleReferralEntryForSearch( LdapSession session, SearchRequest req, ClonedServerEntry entry )
+ private void handleReferralEntryForSearch( LdapSession session, SearchRequest req, Entry entry )
throws Exception
{
LdapResult result = req.getResultResponse().getLdapResult();
@@ -1233,7 +1232,7 @@ public class SearchHandler extends LdapR
result.setDiagnosticMessage( "Encountered referral attempting to handle request." );
result.setMatchedDn( req.getBase() );
- Attribute refAttr = entry.getOriginalEntry().get( SchemaConstants.REF_AT );
+ Attribute refAttr = ((ClonedServerEntry)entry).getOriginalEntry().get( SchemaConstants.REF_AT );
for ( Value<?> refval : refAttr )
{
@@ -1356,11 +1355,11 @@ public class SearchHandler extends LdapR
* entry
*/
public Referral getReferralOnAncestorForSearch( LdapSession session, SearchRequest req,
- ClonedServerEntry referralAncestor ) throws Exception
+ Entry referralAncestor ) throws Exception
{
LOG.debug( "Inside getReferralOnAncestor()" );
- Attribute refAttr = referralAncestor.getOriginalEntry().get( SchemaConstants.REF_AT );
+ Attribute refAttr = ((ClonedServerEntry)referralAncestor).getOriginalEntry().get( SchemaConstants.REF_AT );
Referral referral = new ReferralImpl();
for ( Value<?> value : refAttr )
@@ -1429,11 +1428,11 @@ public class SearchHandler extends LdapR
* entry
*/
public Referral getReferralOnAncestor( LdapSession session, Dn reqTargetDn, SearchRequest req,
- ClonedServerEntry referralAncestor ) throws Exception
+ Entry referralAncestor ) throws Exception
{
LOG.debug( "Inside getReferralOnAncestor()" );
- Attribute refAttr = referralAncestor.getOriginalEntry().get( SchemaConstants.REF_AT );
+ Attribute refAttr = ((ClonedServerEntry)referralAncestor).getOriginalEntry().get( SchemaConstants.REF_AT );
Referral referral = new ReferralImpl();
for ( Value<?> value : refAttr )
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/DITUtilitiesSP.java Sat Jul 9 10:46:39 2011
@@ -52,7 +52,7 @@ public class DITUtilitiesSP
while ( results.next() )
{
- ClonedServerEntry result = results.get();
+ Entry result = results.get();
Dn childRdn = result.getDn();
childRdn = childRdn.getParent();
deleteSubtree( session, childRdn );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java Sat Jul 9 10:46:39 2011
@@ -274,7 +274,7 @@ public abstract class AbstractXdbmPartit
{
try
{
- store.add( ( Entry ) ( ( ClonedServerEntry ) addContext.getEntry() ).getClonedEntry() );
+ store.add( ( ( ClonedServerEntry ) addContext.getEntry() ).getClonedEntry() );
}
catch ( LdapException le )
{
@@ -290,7 +290,7 @@ public abstract class AbstractXdbmPartit
/**
* {@inheritDoc}
*/
- public final ClonedServerEntry lookup( ID id ) throws LdapException
+ public final Entry lookup( ID id ) throws LdapException
{
try
{
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Sat Jul 9 10:46:39 2011
@@ -148,6 +148,9 @@ public abstract class AbstractStore<E, I
*/
private boolean checkHasEntryDuringAdd = false;
+ /**
+ * {@inheritDoc}
+ */
public void init( SchemaManager schemaManager ) throws Exception
{
this.schemaManager = schemaManager;
@@ -157,6 +160,12 @@ public abstract class AbstractStore<E, I
ALIASED_OBJECT_NAME_AT = schemaManager.getAttributeType( SchemaConstants.ALIASED_OBJECT_NAME_AT );
ENTRY_CSN_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
ENTRY_UUID_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_UUID_AT );
+
+ // -------------------------------------------------------------------
+ // Initializes the user and system indices
+ // -------------------------------------------------------------------
+ setupSystemIndices();
+ setupUserIndices();
}
@@ -169,6 +178,9 @@ public abstract class AbstractStore<E, I
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isInitialized()
{
return initialized;
@@ -195,6 +207,9 @@ public abstract class AbstractStore<E, I
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isSyncOnWrite()
{
return isSyncOnWrite.get();
@@ -292,7 +307,7 @@ public abstract class AbstractStore<E, I
* Sets up the system indices.
*/
@SuppressWarnings("unchecked")
- protected void setupSystemIndices() throws Exception
+ private void setupSystemIndices() throws Exception
{
// add missing system indices
if ( getPresenceIndex() == null )
@@ -427,15 +442,6 @@ public abstract class AbstractStore<E, I
/**
* {@inheritDoc}
*/
- public boolean hasUserIndexOn( String id ) throws LdapException
- {
- return userIndices.containsKey( schemaManager.getAttributeTypeRegistry().getOidByName( id ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
public boolean hasUserIndexOn( AttributeType attributeType ) throws LdapException
{
return userIndices.containsKey( attributeType.getOid() );
@@ -445,15 +451,6 @@ public abstract class AbstractStore<E, I
/**
* {@inheritDoc}
*/
- public boolean hasSystemIndexOn( String id ) throws LdapException
- {
- return systemIndices.containsKey( schemaManager.getAttributeTypeRegistry().getOidByName( id ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
public boolean hasSystemIndexOn( AttributeType attributeType ) throws LdapException
{
return systemIndices.containsKey( attributeType.getOid() );
@@ -740,7 +737,6 @@ public abstract class AbstractStore<E, I
//------------------------------------------------------------------------
// Operations
//------------------------------------------------------------------------
-
/**
* {@inheritDoc}
*/
@@ -764,6 +760,8 @@ public abstract class AbstractStore<E, I
*/
public IndexCursor<ID, E, ID> list( ID id ) throws Exception
{
+ // We use the OneLevl index to get all the entries from a starting point
+ // and below
IndexCursor<ID, E, ID> cursor = oneLevelIdx.forwardCursor( id );
cursor.beforeValue( id, null );
@@ -774,7 +772,7 @@ public abstract class AbstractStore<E, I
/**
* {@inheritDoc}
*
- * Adding an entry involves may steps :
+ * Adding an entry involves many steps :
* - first we must check if the entry exists or not
* - then we must get a new ID for the added entry
* - update the RDN index
@@ -794,15 +792,12 @@ public abstract class AbstractStore<E, I
{
Dn entryDn = entry.getDn();
- if ( checkHasEntryDuringAdd )
+ // check if the entry already exists
+ if ( getEntryId( entryDn ) != null )
{
- // check if the entry already exists
- if ( getEntryId( entryDn ) != null )
- {
- LdapEntryAlreadyExistsException ne = new LdapEntryAlreadyExistsException(
- I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, entryDn.getName() ) );
- throw ne;
- }
+ LdapEntryAlreadyExistsException ne = new LdapEntryAlreadyExistsException(
+ I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, entryDn.getName() ) );
+ throw ne;
}
ID parentId = null;
@@ -1132,7 +1127,7 @@ public abstract class AbstractStore<E, I
entry.add( newRdnAttrType, newAtav.getNormValue() );
- if ( hasUserIndexOn( newNormType ) )
+ if ( hasUserIndexOn( newRdnAttrType ) )
{
Index<?, E, ID> index = getUserIndex( newRdnAttrType );
( ( Index ) index ).add( newNormValue, id );
@@ -1188,7 +1183,7 @@ public abstract class AbstractStore<E, I
AttributeType oldRdnAttrType = schemaManager.lookupAttributeTypeRegistry( oldNormType );
entry.remove( oldRdnAttrType, oldNormValue );
- if ( hasUserIndexOn( oldNormType ) )
+ if ( hasUserIndexOn( oldRdnAttrType ) )
{
Index<?, E, ID> index = getUserIndex( oldRdnAttrType );
( ( Index ) index ).drop( oldNormValue, id );
@@ -2076,15 +2071,6 @@ public abstract class AbstractStore<E, I
/**
- * @return true if the hasEntry check is performed before adding a entry, false otherwise
- */
- public boolean isCheckHasEntryDuringAdd()
- {
- return checkHasEntryDuringAdd;
- }
-
-
- /**
* set the flag to nable/disable checking of entry existence before actually adding it
* @param checkHasEntryDuringAdd
*/
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java Sat Jul 9 10:46:39 2011
@@ -204,7 +204,7 @@ public interface Store<E, ID extends Com
/**
- * Initialize the JDBM storage system.
+ * Initialize the storage system.
*
* @param schemaManager the schema schemaManager
* @throws Exception on failure to lookup elements in schemaManager
@@ -336,16 +336,6 @@ public interface Store<E, ID extends Com
/**
* Tells if an index is already present in the User's index list
- * @param id The index we are looking for
- * @return <code>true</code> if the index is already present in the
- * User's index list
- * @throws Exception If something went wrong
- */
- boolean hasUserIndexOn( String id ) throws Exception;
-
-
- /**
- * Tells if an index is already present in the User's index list
* @param attributeType The attributeType index we are looking for
* @return <code>true</code> if the index is already present in the
* User's index list
@@ -356,16 +346,6 @@ public interface Store<E, ID extends Com
/**
* Tells if an index is already present in the System's index list
- * @param id The index we are looking for
- * @return <code>true</code> if the index is already present in the
- * System's index list
- * @throws Exception If something went wrong
- */
- boolean hasSystemIndexOn( String id ) throws Exception;
-
-
- /**
- * Tells if an index is already present in the System's index list
* @param attributeType The index we are looking for
* @return <code>true</code> if the index is already present in the
* System's index list
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlStore.java Sat Jul 9 10:46:39 2011
@@ -52,18 +52,11 @@ public class AvlStore<E> extends Abstrac
*/
public void init( SchemaManager schemaManager ) throws Exception
{
- super.init( schemaManager );
-
// Create the master table (the table containing all the entries)
master = new AvlMasterTable<Entry>( id, new LongComparator(), null, false );
- // -------------------------------------------------------------------
- // Initializes the user and system indices
- // -------------------------------------------------------------------
- setupSystemIndices();
- setupUserIndices();
+ super.init( schemaManager );
- // We are done !
initialized = true;
}
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java?rev=1144634&r1=1144633&r2=1144634&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java Sat Jul 9 10:46:39 2011
@@ -358,9 +358,9 @@ public class AvlStoreTest
assertNotNull( store.getSuffixDn() );
assertEquals( 2, store.getUserIndices().size() );
- assertFalse( store.hasUserIndexOn( "dc" ) );
- assertTrue( store.hasUserIndexOn( "ou" ) );
- assertTrue( store.hasSystemIndexOn( "apacheAlias" ) );
+ assertFalse( store.hasUserIndexOn( DC_AT ) );
+ assertTrue( store.hasUserIndexOn( OU_AT ) );
+ assertTrue( store.hasSystemIndexOn( APACHE_ALIAS_AT ) );
Iterator<String> userIndices = store.userIndices();
assertTrue( userIndices.hasNext() );
assertNotNull( userIndices.next() );