You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/08/27 09:26:51 UTC

svn commit: r689396 [1/2] - in /directory/apacheds/trunk: bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ btree-base/src/main/java/org/apache/directory/server/xdbm/ core-integ/src/test/java/org/apache/directory/server/...

Author: akarasulu
Date: Wed Aug 27 00:26:48 2008
New Revision: 689396

URL: http://svn.apache.org/viewvc?rev=689396&view=rev
Log:
DIRSERVER-1237: removing need to configure or have a contextEntry set on a partition

Modified:
    directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java
    directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
    directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/PasswordPolicyServiceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
    directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
    directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/IndexCommand.java
    directory/apacheds/trunk/server-xml/src/main/resources/server.xml
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
    directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/IndexDialog.java
    directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/IndexUtils.java
    directory/apacheds/trunk/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/StoreUtils.java

Modified: directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java (original)
+++ directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java Wed Aug 27 00:26:48 2008
@@ -661,14 +661,16 @@
 
         store.setUserIndices( userIndices );
 
-        ServerEntry rootEntry = new DefaultServerEntry( registries, new LdapDN( ServerDNConstants.OU_SCHEMA_DN ) );
-        rootEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_UNIT_OC );
-        rootEntry.put( SchemaConstants.OU_AT, "schema" );
-        store.setContextEntry( rootEntry );
-
         try
         {
             store.init( this.registries );
+            LdapDN dn = new LdapDN( ServerDNConstants.OU_SCHEMA_DN );
+            dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+            ServerEntry rootEntry = new DefaultServerEntry( registries, dn );
+            rootEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, 
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+            rootEntry.put( SchemaConstants.OU_AT, "schema" );
+            store.add( dn, rootEntry );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/Store.java Wed Aug 27 00:26:48 2008
@@ -117,15 +117,6 @@
     Set<Index<?,E>> getUserIndices();
 
 
-    void setContextEntry( ServerEntry contextEntry );
-
-
-    ServerEntry getContextEntry();
-
-    
-    Long getContextEntryId();
-
-    
     void setSuffixDn( String suffixDn );
 
 
@@ -314,9 +305,6 @@
     LdapDN getUpSuffix();
 
 
-    ServerEntry getSuffixEntry() throws Exception;
-
-
     void setProperty( String propertyName, String propertyValue ) throws Exception;
 
 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java Wed Aug 27 00:26:48 2008
@@ -25,6 +25,7 @@
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.CiRunner;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.jndi.CoreContextFactory;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
@@ -57,15 +58,17 @@
         partition.setId( "removable" );
         partition.setSuffix( "ou=removable" );
         
-        ServerEntry ctxEntry = new DefaultServerEntry( service.getRegistries(), new LdapDN( "ou=removable" ) );
+        // Test AddContextPartition
+        service.addPartition( partition );
+        
+        LdapDN suffixDn = new LdapDN( "ou=removable" );
+        suffixDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+        ServerEntry ctxEntry = new DefaultServerEntry( service.getRegistries(), suffixDn );
         ctxEntry.put( "objectClass", "top" );
         ctxEntry.get( "objectClass" ).add( "organizationalUnit" );
         ctxEntry.put( "ou", "removable" );
-        partition.setContextEntry( ctxEntry );
-
-        // Test AddContextPartition
-        service.addPartition( partition );
-
+        partition.add( new AddOperationContext( service.getAdminSession(), ctxEntry ) );
+        
         Hashtable<String,Object> env = new Hashtable<String,Object>();
         env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
         env.put( DirectoryService.JNDI_KEY, service );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java Wed Aug 27 00:26:48 2008
@@ -22,12 +22,12 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.CiRunner;
 import org.apache.directory.server.core.integ.DirectoryServiceFactory;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getContext;
 import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.annotations.Factory;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.core.partition.Partition;
@@ -45,6 +45,8 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
+
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -88,17 +90,11 @@
             partition.setSuffix( SUFFIX_DN );
 
             HashSet<Index<?, ServerEntry>> indexedAttributes = new HashSet<Index<?, ServerEntry>>();
-            indexedAttributes.add( new JdbmIndex( "objectClass" ) );
-            indexedAttributes.add( new JdbmIndex( "ou" ) );
-            indexedAttributes.add( new JdbmIndex( "uid" ) );
+            indexedAttributes.add( new JdbmIndex<String,ServerEntry>( "objectClass" ) );
+            indexedAttributes.add( new JdbmIndex<String,ServerEntry>( "ou" ) );
+            indexedAttributes.add( new JdbmIndex<String,ServerEntry>( "uid" ) );
             partition.setIndexedAttributes( indexedAttributes );
 
-            ServerEntry serverEntry = new DefaultServerEntry( service.getRegistries(), new LdapDN( SUFFIX_DN ) );
-            serverEntry.put( "objectClass", "top", "domain", "extensibleObject" );
-            serverEntry.put( "dc", "Apache" );
-
-            partition.setContextEntry( serverEntry );
-
             Set<Partition> partitions = new HashSet<Partition>();
             partitions.add( partition );
 
@@ -108,6 +104,17 @@
     }
 
     
+    @Before
+    public void setUp() throws Exception
+    {
+        LdapDN dn = new LdapDN( "dc=Apache,dc=Org" );
+        ServerEntry entry = service.newEntry( dn );
+        entry.add( "objectClass", "top", "domain", "extensibleObject" );
+        entry.add( "dc", "Apache" );
+        service.getAdminSession().add( entry );
+    }
+    
+    
     @Test
     public void testSearch() throws Exception
     {

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java Wed Aug 27 00:26:48 2008
@@ -22,7 +22,6 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.CiRunner;
 import org.apache.directory.server.core.integ.DirectoryServiceFactory;
@@ -37,7 +36,6 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -130,24 +128,11 @@
 
             JdbmPartition partition = new JdbmPartition();
             partition.setId( "system" );
-            
-            try
-            {
-                ServerEntry serverEntry = new DefaultServerEntry( service.getRegistries(), new LdapDN( "ou=system" ) );
-                serverEntry.put( "objectClass", "top", "organizationalUnit" );
-                serverEntry.put( "ou", "system" );
-                partition.setContextEntry( serverEntry );
-                partition.setSuffix( "ou=system" );
-
-            }
-            catch ( NamingException ne )
-            {
-                // Do nothing
-            }
+            partition.setSuffix( "ou=system" );
 
             Set<Index<?, ServerEntry>> indices = new HashSet<Index<?, ServerEntry>>();
             indices.addAll( partition.getIndexedAttributes() );
-            indices.add( new JdbmIndex( "gidNumber" ) );
+            indices.add( new JdbmIndex<String,ServerEntry>( "gidNumber" ) );
             partition.setIndexedAttributes( indices );
             service.setSystemPartition( partition );
 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java Wed Aug 27 00:26:48 2008
@@ -24,16 +24,14 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.CiRunner;
 import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.annotations.Factory;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 
 import static org.apache.directory.server.core.integ.IntegrationUtils.getRootContext;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNotNull;
@@ -57,6 +55,19 @@
  */
 @RunWith ( CiRunner.class )
 @Factory ( PartitionIT.Factory.class )
+@ApplyLdifs (
+    {
+        "dn: dc=foo,dc=com\n" +
+        "objectClass: top\n" +
+        "objectClass: domain\n" +
+        "dc: foo\n\n" +
+
+        "dn: dc=bar,dc=com\n" +
+        "objectClass: top\n" +
+        "objectClass: domain\n" +
+        "dc: bar\n\n"
+    }
+)
 public final class PartitionIT
 {
     private static final Logger LOG = LoggerFactory.getLogger( PartitionIT.class );
@@ -77,23 +88,11 @@
             Partition foo = new JdbmPartition();
             foo.setId( "foo" );
             foo.setSuffix( "dc=foo,dc=com" );
-            LdapDN contextDn = new LdapDN( "dc=foo,dc=com" );
-            contextDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
-            ServerEntry contextEntry = new DefaultServerEntry( service.getRegistries(), contextDn );
-            contextEntry.add( "objectClass", "top", "domain" );
-            contextEntry.add( "dc", "foo" );
-            foo.setContextEntry( contextEntry );
             service.addPartition( foo );
             
             Partition bar = new JdbmPartition();
             bar.setId( "bar" );
             bar.setSuffix( "dc=bar,dc=com" );
-            contextDn = new LdapDN( "dc=bar,dc=com" );
-            contextDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
-            contextEntry = new DefaultServerEntry( service.getRegistries(), contextDn );
-            contextEntry.add( "objectClass", "top", "domain" );
-            contextEntry.add( "dc", "bar" );
-            bar.setContextEntry( contextEntry );
             service.addPartition( bar );
             
             return service;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Wed Aug 27 00:26:48 2008
@@ -1315,13 +1315,6 @@
 
         schemaPartition.setIndexedAttributes( indexedAttributes );
         schemaPartition.setSuffix( ServerDNConstants.OU_SCHEMA_DN );
-        
-        ServerEntry entry = new DefaultServerEntry( registries, new LdapDN( ServerDNConstants.OU_SCHEMA_DN ) );
-        entry.put( SchemaConstants.OBJECT_CLASS_AT, 
-                SchemaConstants.TOP_OC, 
-                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
-        entry.put( SchemaConstants.OU_AT, "schema" );
-        schemaPartition.setContextEntry( entry );
         schemaPartition.init( this );
 
         // --------------------------------------------------------------------
@@ -1475,8 +1468,10 @@
         try
         {
             Attributes entry = readEntry( ldif );
+            LdapDN ldapDn = new LdapDN( dn );
             
-            ServerEntry serverEntry = ServerEntryUtils.toServerEntry( entry, new LdapDN( dn ), registries );
+            // TODO Let's get rid of this Attributes crap
+            ServerEntry serverEntry = ServerEntryUtils.toServerEntry( entry, ldapDn, registries );
             return serverEntry;
         }
         catch ( Exception e )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Aug 27 00:26:48 2008
@@ -34,6 +34,7 @@
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -78,7 +79,9 @@
 public class ExceptionInterceptor extends BaseInterceptor
 {
     private PartitionNexus nexus;
+    private DirectoryService directoryService;
     private LdapDN subschemSubentryDn;
+
     
     /**
      * The OIDs normalizer map
@@ -119,6 +122,7 @@
 
     public void init( DirectoryService directoryService ) throws Exception
     {
+        this.directoryService = directoryService;
         nexus = directoryService.getPartitionNexus();
         normalizerMap = directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
         Value<?> attr = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
@@ -153,10 +157,20 @@
             ne.setResolvedName( new LdapDN( name.getUpName() ) );
             throw ne;
         }
-
+        
+        LdapDN suffix = nexus.getSuffix( new GetSuffixOperationContext( this.directoryService.getAdminSession(), 
+            name ) );
+        
+        // we're adding the suffix entry so just ignore stuff to mess with the parent
+        if ( suffix.getNormName().equals( name.getNormName() ) )
+        {
+            nextInterceptor.add( opContext );
+            return;
+        }
+        
         LdapDN parentDn = ( LdapDN ) name.clone();
         parentDn.remove( name.size() - 1 );
-
+        
         // check if we're trying to add to a parent that is an alias
         boolean notAnAlias;
         

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=689396&r1=689395&r2=689396&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 Wed Aug 27 00:26:48 2008
@@ -230,28 +230,6 @@
 
 
     /**
-     * Returns root the rootDSE.
-     *
-     * @return the root entry for the DSA
-     */
-    public ClonedServerEntry getContextEntry()
-    {
-        return new ClonedServerEntry( rootDSE );
-    }
-
-
-    /**
-     * Sets root entry for this BTreePartition.
-     *
-     * @throws UnsupportedOperationException everytime
-     */
-    public void setContextEntry( ServerEntry rootEntry )
-    {
-        throw new UnsupportedOperationException( "Setting the RootDSE is not allowed." );
-    }
-
-
-    /**
      * Always returns the empty String "".
      * @return the empty String ""
      */
@@ -363,41 +341,6 @@
         
         if ( override != null )
         {
-            ServerEntry systemEntry = override.getContextEntry();
-            EntryAttribute objectClassAttr = systemEntry.get( SchemaConstants.OBJECT_CLASS_AT );
-            
-            if ( objectClassAttr == null )
-            {
-                systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, 
-                    SchemaConstants.TOP_OC,
-                    SchemaConstants.ORGANIZATIONAL_UNIT_OC,
-                    SchemaConstants.EXTENSIBLE_OBJECT_OC );
-            }
-            else
-            {
-                // Feed the contextEntry with the mandatory ObjectClass values, if they are missing.
-                if ( !objectClassAttr.contains( SchemaConstants.TOP_OC ) )
-                {
-                    objectClassAttr.add( SchemaConstants.TOP_OC );
-                }
-                
-                if ( !objectClassAttr.contains( SchemaConstants.ORGANIZATIONAL_UNIT_OC ) )
-                {
-                    objectClassAttr.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC );
-                }
-
-                if ( !objectClassAttr.contains( SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
-                {
-                    objectClassAttr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
-                }
-            }
-            
-            systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
-            systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-            systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ),
-                NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) );
-            
-            override.setContextEntry( systemEntry );
             
             // ---------------------------------------------------------------
             // check a few things to make sure users configured it properly
@@ -447,27 +390,35 @@
             Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();
             indexedAttrs.add( new JdbmIndex<Object,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT ) );
             ( ( JdbmPartition ) system ).setIndexedAttributes( indexedAttrs );
-    
-            // Add context entry for system partition
-            ServerEntry systemEntry = new DefaultServerEntry( registries, new LdapDN( ServerDNConstants.SYSTEM_DN ) );
-
-            // Add the ObjectClasses
-            systemEntry.put( SchemaConstants.OBJECT_CLASS_AT,
-                SchemaConstants.TOP_OC,
-                SchemaConstants.ORGANIZATIONAL_UNIT_OC,
-                SchemaConstants.EXTENSIBLE_OBJECT_OC
-                );
-            
-            // Add some operational attributes
-            systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
-            systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-            systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ),
-                NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) );
-
-            system.setContextEntry( systemEntry );
         }
 
         system.init( directoryService );
+        
+        
+        // Add root context entry for system partition
+        LdapDN systemSuffixDn = new LdapDN( ServerDNConstants.SYSTEM_DN );
+        systemSuffixDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+        ServerEntry systemEntry = new DefaultServerEntry( registries, systemSuffixDn );
+
+        // Add the ObjectClasses
+        systemEntry.put( SchemaConstants.OBJECT_CLASS_AT,
+            SchemaConstants.TOP_OC,
+            SchemaConstants.ORGANIZATIONAL_UNIT_OC,
+            SchemaConstants.EXTENSIBLE_OBJECT_OC
+            );
+        
+        // Add some operational attributes
+        systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
+        systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+        systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ),
+            NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) );
+        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+        adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+        CoreSession adminSession = new DefaultCoreSession( 
+            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
+        AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry );
+        system.add( addOperationContext );
+        
         String key = system.getSuffixDn().toString();
         
         if ( partitions.containsKey( key ) )
@@ -655,8 +606,6 @@
 
         if ( ! partition.isInitialized() )
         {
-            partition.setContextEntry( partition.getContextEntry() );
-            
             partition.init( directoryService );
         }
         

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Wed Aug 27 00:26:48 2008
@@ -22,7 +22,6 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -88,22 +87,6 @@
 
 
     /**
-     * Gets the root entry of the partition, the entry for the suffix.
-     *
-     * @return the entry for the suffix of this Partition.
-     */
-    ServerEntry getContextEntry();
-
-
-    /**
-     * Sets the root entry of the partition, the entry for the suffix.
-     *
-     * @param contextEntry the entry for the suffix of this Partition.
-     */
-    void setContextEntry( ServerEntry contextEntry );
-
-    
-    /**
      * Gets the non-normalized suffix for this Partition as a string.
      *
      * @return the suffix string for this Partition.

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Wed Aug 27 00:26:48 2008
@@ -134,46 +134,6 @@
 
 
     /**
-     * Returns root entry for this BTreePartition.
-     *
-     * @return the root suffix entry for this BTreePartition
-     */
-    public ServerEntry getContextEntry()
-    {
-        if ( contextEntry != null )
-        {
-            return new ClonedServerEntry( contextEntry );
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-
-    /**
-     * Sets root entry for this BTreePartition.
-     *
-     * @param rootEntry the root suffix entry of this BTreePartition
-     */
-    public void setContextEntry( ServerEntry rootEntry )
-    {
-        this.contextEntry = ( ServerEntry ) rootEntry.clone();
-    }
-
-    
-    /**
-     * Sets root entry for this BTreePartition.
-     *
-     * @param rootEntry the root suffix entry of this BTreePartition
-     */
-    public void setContextEntry( String rootEntry )
-    {
-        System.out.println( rootEntry );
-    }
-
-    
-    /**
      * Gets the unique identifier for this partition.
      *
      * @return the unique identifier for this partition
@@ -547,9 +507,6 @@
     public abstract int getChildCount( Long id ) throws Exception;
 
 
-    public abstract ServerEntry getSuffixEntry() throws Exception;
-
-
     public abstract void setProperty( String key, String value ) throws Exception;
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Wed Aug 27 00:26:48 2008
@@ -886,7 +886,7 @@
         // boolean doFiltered = false;
         nodes = new HashMap<Long, EntryNode>();
 
-        ServerEntry suffix = partition.getSuffixEntry();
+        ServerEntry suffix = partition.lookup( partition.getEntryId( partition.getSuffixDn().toNormName() ) );
         Long id = partition.getEntryId( partition.getSuffixDn().toString() );
         root = new EntryNode( id, null, partition, suffix, nodes );
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Wed Aug 27 00:26:48 2008
@@ -178,7 +178,6 @@
         
         // initialize the store
         store.setCacheSize( cacheSize );
-        store.setContextEntry( contextEntry );
         store.setName( id );
         store.setSuffixDn( suffix );
         store.setWorkingDirectory( new File( directoryService.getWorkingDirectory().getPath() + File.separator + id ) );
@@ -488,12 +487,6 @@
     }
 
 
-    public final ServerEntry getSuffixEntry() throws Exception
-    {
-        return store.getSuffixEntry();
-    }
-
-
     public final void setProperty( String propertyName, String propertyValue ) throws Exception
     {
         store.setProperty( propertyName, propertyValue );

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Wed Aug 27 00:26:48 2008
@@ -22,7 +22,6 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
@@ -38,7 +37,6 @@
 import org.apache.directory.server.schema.registries.DefaultOidRegistry;
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -141,16 +139,11 @@
         Set<Index<?, ServerEntry>> indexedAttributes = new HashSet<Index<?, ServerEntry>>();
         for ( String attributeId : extractor.getDbFileListing().getIndexedAttributes() )
         {
-            indexedAttributes.add( new JdbmIndex( attributeId ) );
+            indexedAttributes.add( new JdbmIndex<String,ServerEntry>( attributeId ) );
         }
 
         schemaPartition.setIndexedAttributes( indexedAttributes );
         schemaPartition.setSuffix( "ou=schema" );
-        
-        ServerEntry entry = new DefaultServerEntry( registries, new LdapDN( "ou=schema" ) );
-        entry.put( "objectClass", "top", "organizationalUnit" );
-        entry.put( "ou", "schema" );
-        schemaPartition.setContextEntry( entry );
         schemaPartition.init( directoryService );
     }
     

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Wed Aug 27 00:26:48 2008
@@ -461,30 +461,30 @@
     // ------------------------------------------------------------------------
 
 
+    @SuppressWarnings("unchecked")
     public IndexCursor<K, O> reverseCursor() throws Exception
     {
-        //noinspection unchecked
         return new IndexCursorAdaptor<K, O>( ( Cursor ) reverse.cursor(), false );
     }
 
 
+    @SuppressWarnings("unchecked")
     public IndexCursor<K, O> forwardCursor() throws Exception
     {
-        //noinspection unchecked
         return new IndexCursorAdaptor<K, O>( ( Cursor ) forward.cursor(), true );
     }
 
 
+    @SuppressWarnings("unchecked")
     public IndexCursor<K, O> reverseCursor( Long id ) throws Exception
     {
-        //noinspection unchecked
         return new IndexCursorAdaptor<K, O>( ( Cursor ) reverse.cursor( id ), false );
     }
 
 
+    @SuppressWarnings("unchecked")
     public IndexCursor<K, O> forwardCursor( K key ) throws Exception
     {
-        //noinspection unchecked
         return new IndexCursorAdaptor<K, O>( ( Cursor ) forward.cursor( key ), true );
     }
 
@@ -643,6 +643,7 @@
      * TODO I don't think the keyCache is required anymore since the normalizer
      * will cache values for us.
      */
+    @SuppressWarnings("unchecked")
     public K getNormalized( K attrVal ) throws Exception
     {
         if ( attrVal instanceof Long )
@@ -650,12 +651,10 @@
             return attrVal;
         }
 
-        //noinspection unchecked
         K normalized = ( K ) keyCache.get( attrVal );
 
         if ( null == normalized )
         {
-            //noinspection unchecked
             normalized = ( K ) attribute.getEquality().getNormalizer().normalize( attrVal );
 
             // Double map it so if we use an already normalized

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Wed Aug 27 00:26:48 2008
@@ -145,8 +145,6 @@
     // -----------------------------------------------------------------------
 
 
-    private ServerEntry contextEntry;
-    private Long contextEntryId;
     private String suffixDn;
     private int cacheSize = DEFAULT_CACHE_SIZE;
     private String name;
@@ -174,30 +172,6 @@
     }
 
 
-    public void setContextEntry( ServerEntry contextEntry )
-    {
-        protect( "contextEntry" );
-        this.contextEntry = contextEntry;
-    }
-
-
-    public ServerEntry getContextEntry()
-    {
-        return contextEntry;
-    }
-    
-    
-    public Long getContextEntryId()
-    {
-        if ( contextEntryId == null )
-        {
-            return 1L;
-        }
-        
-        return contextEntryId;
-    }
-
-
     public void setSuffixDn( String suffixDn )
     {
         protect( "suffixDn" );
@@ -300,14 +274,13 @@
 
         setupSystemIndices();
         setupUserIndices();
-
-        initSuffixEntry3( suffixDn, contextEntry );
         
         // We are done !
         initialized = true;
     }
 
 
+    @SuppressWarnings("unchecked")
     private void setupSystemIndices() throws Exception
     {
         if ( systemIndices.size() > 0 )
@@ -389,6 +362,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     private void setupUserIndices() throws Exception
     {
         if ( userIndices != null && userIndices.size() > 0 )
@@ -411,32 +385,6 @@
 
 
     /**
-     * Called last (4th) to check if the suffix entry has been created on disk,
-     * and if not it is created.
-     *  
-     * @param suffix the suffix for the store
-     * @param entry the root entry of the store
-     * @throws NamingException on failure to add the root entry
-     * @throws Exception failure to access btrees
-     */
-    protected void initSuffixEntry3( String suffix, ServerEntry entry ) throws Exception
-    {
-        // normalize then add entry for context, if it does not exist
-        contextEntry.getDn().normalize( attributeTypeRegistry.getNormalizerMapping() );
-        ServerEntry suffixOnDisk = getSuffixEntry();
-
-        if ( suffixOnDisk == null )
-        {
-            LdapDN dn = new LdapDN( suffix );
-            LdapDN normalizedSuffix = LdapDN.normalize( dn, attributeTypeRegistry.getNormalizerMapping() );
-            add( normalizedSuffix, entry );
-        }
-        
-        contextEntryId = ndnIdx.forwardLookup( contextEntry.getDn().getNormName() );
-    }
-
-
-    /**
      * Close the parttion : we have to close all the userIndices and the master table.
      * 
      * @throws Exception lazily thrown on any closer failures to avoid leaving
@@ -1007,6 +955,9 @@
     }
 
 
+    // TODO Change signature to not require the DN parameter since it is now
+    // in the ServerEntry  !!!
+    @SuppressWarnings("unchecked")
     public void add( LdapDN normName, ServerEntry entry ) throws Exception
     {
         if ( entry instanceof ClonedServerEntry )
@@ -1027,7 +978,7 @@
 
         LdapDN parentDn = null;
 
-        if ( normName.equals( normSuffix ) )
+        if ( normName.getNormName().equals( normSuffix.getNormName() ) )
         {
             parentId = 0L;
         }
@@ -1115,14 +1066,9 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void delete( Long id ) throws Exception
     {
-        if ( id == 1 )
-        {
-            throw new LdapOperationNotSupportedException(
-                "Deletion of the suffix entry is not permitted.", ResultCodeEnum.UNWILLING_TO_PERFORM );
-        }
-
         ServerEntry entry = lookup( id );
         Long parentId = getParentId( id );
 
@@ -1209,17 +1155,6 @@
     }
 
 
-    public ServerEntry getSuffixEntry() throws Exception
-    {
-        if ( null == contextEntryId )
-        {
-            return null;
-        }
-
-        return lookup( contextEntryId );
-    }
-
-
     public void setProperty( String propertyName, String propertyValue ) throws Exception
     {
         master.setProperty( propertyName, propertyValue );
@@ -1242,6 +1177,7 @@
      * @param mods the attribute and values to add 
      * @throws Exception if index alteration or attribute addition fails
      */
+    @SuppressWarnings("unchecked")
     private void add( Long id, ServerEntry entry, EntryAttribute mods ) throws Exception
     {
         if ( entry instanceof ClonedServerEntry )
@@ -1296,6 +1232,7 @@
      * @param mods the attribute and its values to delete
      * @throws Exception if index alteration or attribute modification fails.
      */
+    @SuppressWarnings("unchecked")
     private void remove( Long id, ServerEntry entry, EntryAttribute mods ) throws Exception
     {
         if ( entry instanceof ClonedServerEntry )
@@ -1378,6 +1315,7 @@
      * @throws Exception if index alteration or attribute modification 
      * fails.
      */
+    @SuppressWarnings("unchecked")
     private void replace( Long id, ServerEntry entry, EntryAttribute mods ) throws Exception
     {
         if ( entry instanceof ClonedServerEntry )
@@ -1534,6 +1472,7 @@
      * @param deleteOldRdn whether or not to remove the old Rdn attr/val
      * @throws Exception if there are any errors propagating the name changes
      */
+    @SuppressWarnings("unchecked")
     public void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn ) throws Exception
     {
         Long id = getEntryId( dn.getNormName() );

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Wed Aug 27 00:26:48 2008
@@ -99,13 +99,13 @@
      * using default Java serialization which could be very expensive
      * @throws IOException if the table's file cannot be created
      */
+    @SuppressWarnings("unchecked")
     public JdbmTable( String name, int numDupLimit, RecordManager manager,
         Comparator<K> keyComparator, Comparator<V> valueComparator,
         Serializer keySerializer, Serializer valueSerializer )
         throws IOException
     {
         // TODO make the size of the duplicate btree cache configurable via constructor
-        //noinspection unchecked
         duplicateBtrees = new SynchronizedLRUMap( 100 );
 
         if ( valueSerializer != null )
@@ -350,6 +350,7 @@
     // ------------------------------------------------------------------------
 
 
+    @SuppressWarnings("unchecked")
     public V get( K key ) throws Exception
     {
         if ( key == null )
@@ -359,14 +360,12 @@
 
         if ( ! allowsDuplicates )
         {
-            //noinspection unchecked
             return ( V ) bt.find( key );
         }                         
 
         DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
         if ( values.isAvlTree() )
         {
-            //noinspection unchecked
             AvlTree<V> set = values.getAvlTree();
 
             if ( set.getFirst() == null )
@@ -451,6 +450,7 @@
     /**
      * @see org.apache.directory.server.xdbm.Table#hasGreaterOrEqual(Object)
      */
+    @SuppressWarnings("unchecked")
     public boolean hasGreaterOrEqual( K key ) throws IOException
     {
         // See if we can find the border between keys greater than and less
@@ -458,7 +458,6 @@
         jdbm.helper.Tuple tuple = bt.findGreaterOrEqual( key );
 
         // Test for equality first since it satisfies both greater/less than
-        //noinspection unchecked
         if ( null != tuple && keyComparator.compare( ( K ) tuple.getKey(), key ) == 0 )
         {
             return true;
@@ -479,6 +478,7 @@
     /**
      * @see Table#hasLessOrEqual(Object)
      */
+    @SuppressWarnings("unchecked")
     public boolean hasLessOrEqual( K key ) throws IOException
     {
         // Can only find greater than or equal to with JDBM so we find that
@@ -486,7 +486,6 @@
         jdbm.helper.Tuple tuple = bt.findGreaterOrEqual( key );
 
         // Test for equality first since it satisfies equal to condition
-        //noinspection unchecked
         if ( null != tuple && keyComparator.compare( ( K ) tuple.getKey(), key ) == 0 )
         {
             return true;
@@ -526,6 +525,7 @@
      * @see org.apache.directory.server.xdbm.Table#has(java.lang.Object,
      * java.lang.Object)
      */
+    @SuppressWarnings("unchecked")
     public boolean has( K key, V value ) throws IOException
     {
         if ( key == null )
@@ -535,7 +535,6 @@
 
         if ( ! allowsDuplicates )
         {
-            //noinspection unchecked
             V stored = ( V ) bt.find( key );
             return null != stored && stored.equals( value );
         }
@@ -625,6 +624,7 @@
      * @see org.apache.directory.server.xdbm.Table#remove(java.lang.Object,
      * java.lang.Object)
      */
+    @SuppressWarnings("unchecked")
     public void remove( K key, V value ) throws IOException
     {
         if ( key == null )
@@ -634,7 +634,6 @@
 
         if ( ! allowsDuplicates )
         {
-            //noinspection unchecked
             V oldValue = ( V ) bt.find( key );
         
             // Remove the value only if it is the same as value.
@@ -743,6 +742,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public Cursor<org.apache.directory.server.xdbm.Tuple<K,V>> cursor( K key ) throws Exception
     {
         if ( key == null )
@@ -759,7 +759,6 @@
 
         if ( ! allowsDuplicates )
         {
-            //noinspection unchecked
             return new SingletonCursor<org.apache.directory.server.xdbm.Tuple<K,V>>( new org.apache.directory.server.xdbm.Tuple<K,V>( key, ( V ) raw ) );
         }
 
@@ -775,6 +774,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public Cursor<V> valueCursor( K key ) throws Exception
     {
         if ( key == null )
@@ -791,7 +791,6 @@
 
         if ( ! allowsDuplicates )
         {
-            //noinspection unchecked
             return new SingletonCursor<V>( ( V ) raw );
         }
 
@@ -883,6 +882,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     private boolean btreeHas( BTree tree, V key, boolean isGreaterThan ) throws IOException
     {
         jdbm.helper.Tuple tuple = new jdbm.helper.Tuple();
@@ -912,7 +912,6 @@
                  * smallest key we just need to check if it equals this key
                  * which is the only chance for returning true.
                  */
-                //noinspection unchecked
                 V firstKey = ( V ) tuple.getKey();
                 return valueComparator.compare( key, firstKey ) == 0;
             }
@@ -931,6 +930,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     private AvlTree<V> convertToAvlTree( BTree bTree ) throws IOException
     {
         AvlTree<V> avlTree = new AvlTree<V>( valueComparator );
@@ -938,7 +938,6 @@
         jdbm.helper.Tuple tuple = new jdbm.helper.Tuple();
         while ( browser.getNext( tuple ) )
         {
-            //noinspection unchecked
             avlTree.insert( ( V ) tuple.getKey() );
         }
 
@@ -967,24 +966,4 @@
         }
         return bTree;
     }
-    
-    
-    private V removeAll( BTree tree ) throws IOException
-    {
-        V first = null;
-        jdbm.helper.Tuple jdbmTuple = new jdbm.helper.Tuple();
-        TupleBrowser browser = tree.browse();
-
-        while( browser.getNext( jdbmTuple ) )
-        {
-            tree.remove( jdbmTuple.getKey() );
-            if ( first == null )
-            {
-                //noinspection unchecked
-                first = ( V ) jdbmTuple.getKey();
-            }
-        }
-
-        return first;
-    }
 }

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java Wed Aug 27 00:26:48 2008
@@ -82,6 +82,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void after( E element ) throws Exception
     {
         browser = btree.browse( element );
@@ -96,7 +97,6 @@
         while ( browser.getNext( tuple ) )
         {
             checkNotClosed( "after()" );
-            //noinspection unchecked
             E next = ( E ) tuple.getKey();
             int nextCompared = comparator.compare( next, element );
 
@@ -192,12 +192,12 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public E get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( valueAvailable )
         {
-            //noinspection unchecked
             return ( E ) tuple.getKey();
         }
 

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Wed Aug 27 00:26:48 2008
@@ -105,6 +105,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void afterValue( K key, V value ) throws Exception
     {
         if ( key != null && ! key.equals( this.key ) )
@@ -125,10 +126,8 @@
         {
             checkNotClosed( "afterValue" );
 
-            //noinspection unchecked
             V next = ( V ) valueTuple.getKey();
 
-            //noinspection unchecked
             int nextCompared = comparator.compare( next, value );
 
             if ( nextCompared <= 0 )
@@ -211,20 +210,19 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public boolean previous() throws Exception
     {
         checkNotClosed( "previous()" );
         if ( browser.getPrevious( valueTuple ) )
         {
             // work around to fix direction change problem with jdbm browser
-            //noinspection unchecked
             if ( returnedTuple.getValue() != null &&
                 comparator.compare( ( V ) valueTuple.getKey(), returnedTuple.getValue() ) == 0 )
             {
                 browser.getPrevious( valueTuple ) ;
             }
             returnedTuple.setKey( key );
-            //noinspection unchecked
             returnedTuple.setValue( ( V ) valueTuple.getKey() );
             return valueAvailable = true;
         }
@@ -236,20 +234,19 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public boolean next() throws Exception
     {
         checkNotClosed( "next()" );
         if ( browser.getNext( valueTuple ) )
         {
             // work around to fix direction change problem with jdbm browser
-            //noinspection unchecked
             if ( returnedTuple.getValue() != null &&
                  comparator.compare( ( V ) valueTuple.getKey(), returnedTuple.getValue() ) == 0 )
             {
                 browser.getNext( valueTuple ) ;
             }
             returnedTuple.setKey( key );
-            //noinspection unchecked
             returnedTuple.setValue( ( V ) valueTuple.getKey() );
             return valueAvailable = true;
         }
@@ -266,7 +263,6 @@
         checkNotClosed( "get()" );
         if ( valueAvailable )
         {
-            //noinspection unchecked
             return returnedTuple;
         }
 

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java Wed Aug 27 00:26:48 2008
@@ -26,13 +26,14 @@
 
 
 /**
- * A serializer for Longs
+ * A {@link Serializer} for Longs
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public class LongSerializer implements Serializer
 {
+    private static final long serialVersionUID = 237756689544852128L;
     public static final LongSerializer INSTANCE = new LongSerializer();
 
 

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Wed Aug 27 00:26:48 2008
@@ -75,7 +75,7 @@
     private static final Logger LOG = LoggerFactory.getLogger( JdbmStoreTest.class.getSimpleName() );
 
     File wkdir;
-    JdbmStore<Attributes> store;
+    JdbmStore<ServerEntry> store;
     Registries registries = null;
     AttributeTypeRegistry attributeRegistry;
 
@@ -111,7 +111,7 @@
         wkdir.mkdirs();
 
         // initialize the store
-        store = new JdbmStore<Attributes>();
+        store = new JdbmStore<ServerEntry>();
         store.setName( "example" );
         store.setCacheSize( 10 );
         store.setWorkingDirectory( wkdir );
@@ -157,10 +157,6 @@
         store.setCacheSize( 24 );
         assertEquals( 24, store.getCacheSize() );
 
-        assertNull( store.getContextEntry() );
-        store.setContextEntry( new DefaultServerEntry( registries, new LdapDN() ) );
-        assertNotNull( store.getContextEntry() );
-
         assertNull( store.getPresenceIndex() );
         store.setPresenceIndex( new JdbmIndex<String,Attributes>( "existence" ) );
         assertNotNull( store.getPresenceIndex() );
@@ -224,27 +220,23 @@
     public void testSimplePropertiesLocked() throws Exception
     {
         assertNotNull( store.getAliasIndex() );
-        try { store.setAliasIndex( new JdbmIndex<String,Attributes>( "alias" ) ); fail(); }
+        try { store.setAliasIndex( new JdbmIndex<String,ServerEntry>( "alias" ) ); fail(); }
         catch( IllegalStateException e ) {}
 
         assertEquals( 10, store.getCacheSize() );
         try { store.setCacheSize( 24 ); }
         catch( IllegalStateException e ) {}
 
-        assertNotNull( store.getContextEntry() );
-        try { store.setContextEntry( new DefaultServerEntry( registries, new LdapDN() ) ); fail(); }
-        catch( IllegalStateException e ) {}
-
         assertNotNull( store.getPresenceIndex() );
-        try { store.setPresenceIndex( new JdbmIndex<String,Attributes>( "existence" ) ); fail(); }
+        try { store.setPresenceIndex( new JdbmIndex<String,ServerEntry>( "existence" ) ); fail(); }
         catch( IllegalStateException e ) {}
 
         assertNotNull( store.getOneLevelIndex() );
-        try { store.setOneLevelIndex( new JdbmIndex<Long,Attributes>( "hierarchy" ) ); fail(); }
+        try { store.setOneLevelIndex( new JdbmIndex<Long,ServerEntry>( "hierarchy" ) ); fail(); }
         catch( IllegalStateException e ) {}
 
         assertNotNull( store.getSubLevelIndex() );
-        try { store.setSubLevelIndex( new JdbmIndex<Long,Attributes>( "sublevel" ) ); fail(); }
+        try { store.setSubLevelIndex( new JdbmIndex<Long,ServerEntry>( "sublevel" ) ); fail(); }
         catch( IllegalStateException e ) {}
         
         assertNotNull( store.getName() );
@@ -252,15 +244,15 @@
         catch( IllegalStateException e ) {}
 
         assertNotNull( store.getNdnIndex() );
-        try { store.setNdnIndex( new JdbmIndex<String,Attributes>( "ndn" ) ); fail(); }
+        try { store.setNdnIndex( new JdbmIndex<String,ServerEntry>( "ndn" ) ); fail(); }
         catch( IllegalStateException e ) {}
 
         assertNotNull( store.getOneAliasIndex() );
-        try { store.setOneAliasIndex( new JdbmIndex<Long,Attributes>( "oneAlias" ) ); fail(); }
+        try { store.setOneAliasIndex( new JdbmIndex<Long,ServerEntry>( "oneAlias" ) ); fail(); }
         catch( IllegalStateException e ) {}
 
         assertNotNull( store.getSubAliasIndex() );
-        try { store.setSubAliasIndex( new JdbmIndex<Long,Attributes>( "subAlias" ) ); fail(); }
+        try { store.setSubAliasIndex( new JdbmIndex<Long,ServerEntry>( "subAlias" ) ); fail(); }
         catch( IllegalStateException e ) {}
 
         assertNotNull( store.getSuffixDn() );
@@ -268,7 +260,7 @@
         catch( IllegalStateException e ) {}
 
         assertNotNull( store.getUpdnIndex() );
-        try { store.setUpdnIndex( new JdbmIndex<String,Attributes>( "updn" ) ); fail(); }
+        try { store.setUpdnIndex( new JdbmIndex<String,ServerEntry>( "updn" ) ); fail(); }
         catch( IllegalStateException e ) {}
         Iterator<String> systemIndices = store.systemIndices();
         for ( int ii = 0; ii < 8; ii++ )
@@ -332,17 +324,13 @@
         assertEquals( "o=Good Times Co.", store.getEntryUpdn( dn.toNormName() ) );
         assertEquals( dn.toNormName(), store.getEntryDn( 1L ) );
         assertEquals( dn.getUpName(), store.getEntryUpdn( 1L ) );
-        assertNotNull( store.getSuffixEntry() );
 
         // note that the suffix entry returns 0 for it's parent which does not exist
         assertEquals( 0L, ( long ) store.getParentId( dn.toNormName() ) );
         assertNull( store.getParentId( 0L ) );
 
-        // should not be allowed
-        try { store.delete( 1L ); fail(); } catch( LdapOperationNotSupportedException e )
-        {
-            assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getResultCode() );
-        }
+        // should NOW be allowed
+        store.delete( 1L ); 
     }
 
 
@@ -351,7 +339,7 @@
     {
         assertEquals( 3, store.getChildCount( 1L ) );
 
-        Cursor<IndexEntry<Long,Attributes>> cursor = store.list( 1L );
+        Cursor<IndexEntry<Long,ServerEntry>> cursor = store.list( 1L );
         assertNotNull( cursor );
         cursor.beforeFirst();
         assertTrue( cursor.next() );

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java (original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java Wed Aug 27 00:26:48 2008
@@ -26,7 +26,9 @@
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.Interceptor;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.jndi.CoreContextFactory;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -132,6 +134,11 @@
 
             service.startup();
             
+//            LdapDN dn = new LdapDN()
+//            ServerEntry entry = service.newEntry( dn )
+//            service.getPartitionNexus().add( new AddOperationContext( service.getAdminSession(), entry ) );
+//            
+            
             Hashtable<String,Object> env = new Hashtable<String,Object>();
             env.put( DirectoryService.JNDI_KEY, service );
             env.put( Context.SECURITY_PRINCIPAL, ServerDNConstants.ADMIN_SYSTEM_DN );

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java Wed Aug 27 00:26:48 2008
@@ -21,7 +21,6 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
@@ -94,12 +93,6 @@
 
         Attributes attrs;
 
-//        doDelete( directoryService.getWorkingDirectory() );
-//        port = AvailablePortFinder.getNextAvailable( 1024 );
-//        ldapServer.setIpPort( port );
-//        directoryService.setShutdownHookEnabled( false );
-
-
         setContexts( "uid=admin,ou=system", "secret" );
 
         // -------------------------------------------------------------------
@@ -122,6 +115,12 @@
                     {new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, disabled )};
             schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
         }
+        
+        LdapDN contextDn = new LdapDN( "dc=example,dc=com" );
+        ServerEntry entry = ldapServer.getDirectoryService().newEntry( contextDn );
+        entry.add( "objectClass", "top", "domain", "extensibleObject" );
+        entry.add( "dc", "example" );
+        ldapServer.getDirectoryService().getAdminSession().add( entry );
 
         // Get a context, create the ou=users subcontext, then create the 3 principals.
         Hashtable<String, Object> env = new Hashtable<String, Object>();
@@ -147,6 +146,7 @@
         users.createSubcontext( "uid=ldap", attrs );
     }
 
+    
     protected void configureDirectoryService() throws NamingException
     {
         directoryService.setAllowAnonymousAccess( false );
@@ -163,11 +163,6 @@
         indexedAttrs.add( new JdbmIndex<String,ServerEntry>( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        ServerEntry serverEntry = new DefaultServerEntry( directoryService.getRegistries(), new LdapDN( "dc=example, dc=com" ) );
-        serverEntry.put( "objectClass", "top", "domain" );
-        serverEntry.put( "dc", "example" );
-        partition.setContextEntry( serverEntry );
-
         partitions.add( partition );
         directoryService.setPartitions( partitions );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/KeyDerivationServiceIT.java Wed Aug 27 00:26:48 2008
@@ -22,10 +22,10 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.core.integ.annotations.Factory;
 import org.apache.directory.server.core.interceptor.Interceptor;
@@ -54,7 +54,6 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.Before;
 import org.junit.Test;
@@ -92,6 +91,14 @@
 @RunWith ( SiRunner.class ) 
 @CleanupLevel ( Level.CLASS )
 @Factory ( KeyDerivationServiceIT.Factory.class )
+@ApplyLdifs( {
+    // Entry #0
+    "dn: dc=example,dc=com\n" +
+    "dc: example\n" +
+    "objectClass: top\n" +
+    "objectClass: domain\n\n"
+    }
+)
 public class KeyDerivationServiceIT 
 {
     private static final String RDN = "uid=hnelson,ou=users,dc=example,dc=com";
@@ -121,11 +128,6 @@
              indexedAttrs.add( new JdbmIndex<String,ServerEntry>( "objectClass" ) );
              partition.setIndexedAttributes( indexedAttrs );
 
-             LdapDN exampleDn = new LdapDN( "dc=example,dc=com" );
-             ServerEntry serverEntry = new DefaultServerEntry( service.getRegistries(), exampleDn );
-             serverEntry.put( "objectClass", "top", "domain" );
-             serverEntry.put( "dc", "example" );
-             partition.setContextEntry( serverEntry );
              partitions.add( partition );
              service.setPartitions( partitions );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/PasswordPolicyServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/PasswordPolicyServiceIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/PasswordPolicyServiceIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/kerberos/PasswordPolicyServiceIT.java Wed Aug 27 00:26:48 2008
@@ -22,10 +22,10 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.core.integ.annotations.Factory;
 import org.apache.directory.server.core.interceptor.Interceptor;
@@ -48,7 +48,6 @@
 import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.After;
 import org.junit.Before;
@@ -81,6 +80,14 @@
 @RunWith ( SiRunner.class ) 
 @CleanupLevel ( Level.CLASS )
 @Factory ( PasswordPolicyServiceIT.Factory.class )
+@ApplyLdifs( {
+    // Entry #0
+    "dn: dc=example,dc=com\n" +
+    "dc: example\n" +
+    "objectClass: top\n" +
+    "objectClass: domain\n\n"
+    }
+)
 public class PasswordPolicyServiceIT 
 {
     private DirContext ctx;
@@ -111,11 +118,6 @@
             indexedAttrs.add( new JdbmIndex<String,ServerEntry>( "objectClass" ) );
             partition.setIndexedAttributes( indexedAttrs );
 
-            LdapDN exampleDn = new LdapDN( "dc=example,dc=com" );
-            ServerEntry serverEntry = new DefaultServerEntry( service.getRegistries(), exampleDn );
-            serverEntry.put( "objectClass", "top", "domain" );
-            serverEntry.put( "dc", "example" );
-            partition.setContextEntry( serverEntry );
             partitions.add( partition );
             service.setPartitions( partitions );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java Wed Aug 27 00:26:48 2008
@@ -39,10 +39,9 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.core.integ.annotations.Factory;
 import org.apache.directory.server.integ.LdapServerFactory;
@@ -62,7 +61,6 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.MutableControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.After;
@@ -86,6 +84,14 @@
 @RunWith ( SiRunner.class ) 
 @CleanupLevel ( Level.CLASS )
 @Factory ( MiscBindIT.Factory.class )
+@ApplyLdifs( {
+    // Entry #0
+    "dn: dc=aPache,dc=org\n" +
+    "dc: aPache\n" +
+    "objectClass: top\n" +
+    "objectClass: domain\n\n"
+    }
+)
 public class MiscBindIT
 {
     public static LdapServer ldapServer;
@@ -106,18 +112,8 @@
 
             // @TODO need to make this configurable for the system partition
             apache.setCacheSize( 500 );
-
             apache.setSuffix( "dc=aPache,dc=org" );
-
-
             apache.setId( "apache" );
-            
-            // Add context entry for system partition
-            LdapDN apacheDn = new LdapDN( "dc=aPache,dc=org" );
-            ServerEntry serverEntry = new DefaultServerEntry( service.getRegistries(), apacheDn );
-            serverEntry.put( "dc", "aPache" );
-            serverEntry.put( "objectClass", "top", "domain" );
-            apache.setContextEntry( serverEntry );
             service.addPartition( apache );
 
             // change the working directory to something that is unique

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java Wed Aug 27 00:26:48 2008
@@ -39,7 +39,6 @@
 import org.apache.commons.net.SocketClient;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.server.core.integ.Level;
@@ -94,6 +93,12 @@
 @CleanupLevel ( Level.CLASS )
 @Factory ( SaslBindIT.Factory.class )
 @ApplyLdifs( {
+    // Entry #0
+    "dn: dc=example,dc=com\n" +
+    "dc: example\n" +
+    "objectClass: top\n" +
+    "objectClass: domain\n\n" +
+    
     // Entry # 1
     "dn: ou=users,dc=example,dc=com\n" +
     "objectClass: organizationalUnit\n" +
@@ -138,13 +143,6 @@
              indexedAttrs.add( new JdbmIndex<String,ServerEntry>( "objectClass" ) );
              partition.setIndexedAttributes( indexedAttrs );
 
-             LdapDN exampleDn = new LdapDN( "dc=example,dc=com" );
-             ServerEntry serverEntry = new DefaultServerEntry( service.getRegistries(), exampleDn );
-             serverEntry.put( "objectClass", "top", "domain" );
-             serverEntry.put( "dc", "example" );
-
-             partition.setContextEntry( serverEntry );
-
              partitions.add( partition );
              service.setPartitions( partitions );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReplaceIT.java Wed Aug 27 00:26:48 2008
@@ -35,7 +35,6 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.server.core.integ.Level;
@@ -61,8 +60,6 @@
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -80,13 +77,14 @@
 @CleanupLevel ( Level.SUITE )
 @Factory ( ModifyReplaceIT.Factory.class )
 @ApplyLdifs( {
-    // Entry # 0
+    // Entry # 1
     "dn: cn=Kate Bush,ou=system\n" +
     "objectClass: top\n" +
     "objectClass: person\n" +
     "sn: Bush\n" +
     "cn: Kate Bush\n\n" +
-    // Entry # 1
+
+    // Entry # 2
     "dn: cn=Kim Wilde,ou=system\n" +
     "objectClass: top\n" +
     "objectClass: person\n" +
@@ -125,16 +123,6 @@
             indexedAttrs.add( new JdbmIndex<String,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT ) );
             indexedAttrs.add( new JdbmIndex<String,ServerEntry>( SchemaConstants.OU_AT ) );
             system.setIndexedAttributes( indexedAttrs );
-
-            // Add context entry for system partition
-            LdapDN systemDn = new LdapDN( "ou=system" );
-            ServerEntry systemEntry = new DefaultServerEntry( service.getRegistries(), systemDn );
-            systemEntry.put( "objectClass", "top", "organizationalUnit", "extensibleObject", "account" ); 
-            systemEntry.put( SchemaConstants.CREATORS_NAME_AT, "uid=admin, ou=system" );
-            systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-            systemEntry.put( "ou", "system" );
-            systemEntry.put( "uid", "testUid" );
-            system.setContextEntry( systemEntry );
             service.setSystemPartition( system );
 
             // change the working directory to something that is unique

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java Wed Aug 27 00:26:48 2008
@@ -30,7 +30,6 @@
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.integ.SiRunner;
 import org.apache.directory.server.ldap.LdapServer;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -38,8 +37,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
 
 
 /**

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/IndexedNegationSearchIT.java Wed Aug 27 00:26:48 2008
@@ -22,7 +22,6 @@
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.server.core.integ.Level;
@@ -48,8 +47,6 @@
 import org.apache.directory.server.protocol.shared.SocketAcceptor;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -177,16 +174,6 @@
             indexedAttrs.add( new JdbmIndex<String,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT ) );
             indexedAttrs.add( new JdbmIndex<String,ServerEntry>( SchemaConstants.OU_AT ) );
             system.setIndexedAttributes( indexedAttrs );
-
-            // Add context entry for system partition
-            LdapDN systemDn = new LdapDN( "ou=system" );
-            ServerEntry systemEntry = new DefaultServerEntry( service.getRegistries(), systemDn );
-            systemEntry.put( "objectClass", "top", "organizationalUnit", "extensibleObject", "account" ); 
-            systemEntry.put( SchemaConstants.CREATORS_NAME_AT, "uid=admin, ou=system" );
-            systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-            systemEntry.put( "ou", "system" );
-            systemEntry.put( "uid", "testUid" );
-            system.setContextEntry( systemEntry );
             service.setSystemPartition( system );
 
             // change the working directory to something that is unique

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java?rev=689396&r1=689395&r2=689396&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java Wed Aug 27 00:26:48 2008
@@ -29,7 +29,6 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchResult;
-import javax.naming.event.EventContext;
 import javax.naming.event.EventDirContext;
 import javax.naming.event.NamespaceChangeListener;
 import javax.naming.event.NamingEvent;
@@ -55,8 +54,6 @@
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.PersistentSearchControl;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;