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 2007/10/06 08:48:45 UTC

svn commit: r582462 [4/10] - in /directory: apacheds/branches/bigbang/ apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/ apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/ apacheds...

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Fri Oct  5 23:48:35 2007
@@ -20,38 +20,8 @@
 package org.apache.directory.server.core.interceptor;
 
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-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.GetRootDSEOperationContext;
-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.ListSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -60,6 +30,13 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.ConfigurationException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
+import java.util.*;
+
 
 /**
  * Manages the chain of {@link Interceptor}s.
@@ -69,10 +46,10 @@
  */
 public class InterceptorChain
 {
-    private static final Logger log = LoggerFactory.getLogger( InterceptorChain.class );
+    private static final Logger LOG = LoggerFactory.getLogger( InterceptorChain.class );
 
     /** Speedup for logs */
-    private static final boolean IS_DEBUG = log.isDebugEnabled();
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     private final Interceptor FINAL_INTERCEPTOR = new Interceptor()
     {
@@ -84,9 +61,9 @@
             return "FINAL";
         }
 
-        public void init( DirectoryServiceConfiguration factoryCfg )
+        public void init( DirectoryService directoryService )
         {
-            this.nexus = factoryCfg.getPartitionNexus();
+            this.nexus = directoryService.getPartitionNexus();
         }
 
 
@@ -219,7 +196,8 @@
 
     private Entry head;
 
-    private DirectoryServiceConfiguration factoryCfg;
+    @SuppressWarnings ( { "UnusedDeclaration" } )
+    private DirectoryService directoryService;
 
 
     /**
@@ -234,25 +212,24 @@
 
     /**
      * Initializes and registers all interceptors according to the specified
-     * {@link DirectoryServiceConfiguration}.
-     * @param factoryCfg Configuration to initialize with
+     * {@link DirectoryService}.
      * @throws javax.naming.NamingException if an interceptor cannot be initialized.
+     * @param directoryService the directory core
      */
-    public synchronized void init( DirectoryServiceConfiguration factoryCfg ) throws NamingException
+    public synchronized void init( DirectoryService directoryService ) throws NamingException
     {
-        this.factoryCfg = factoryCfg;
-
         // Initialize tail first.
-        FINAL_INTERCEPTOR.init( factoryCfg);
+        this.directoryService = directoryService;
+        FINAL_INTERCEPTOR.init( directoryService );
 
         // And register and initialize all interceptors
         try
         {
-            for (Interceptor interceptor: factoryCfg.getStartupConfiguration().getInterceptors() )
+            for ( Interceptor interceptor: directoryService.getInterceptors() )
             {
                 if ( IS_DEBUG )
                 {
-                    log.debug( "Adding interceptor " + interceptor.getName() );
+                    LOG.debug( "Adding interceptor " + interceptor.getName() );
                 }
 
                 register( interceptor );
@@ -300,7 +277,7 @@
                 }
                 catch ( Throwable t )
                 {
-                    log.warn( "Failed to deregister an interceptor: " + entry.getName(), t );
+                    LOG.warn( "Failed to deregister an interceptor: " + entry.getName(), t );
                 }
             }
         }
@@ -437,8 +414,8 @@
     private void register0( Interceptor interceptor, Entry nextEntry ) throws NamingException
     {
         String name = interceptor.getName();
-        interceptor.init( factoryCfg);
 
+        interceptor.init( directoryService );
         Entry newEntry;
         if ( nextEntry == head )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Fri Oct  5 23:48:35 2007
@@ -43,7 +43,7 @@
 public class ModifyOperationContext extends AbstractOperationContext
 {
     /** The modification items */
-    private List<ModificationItem> modItems;
+    private List<ModificationItemImpl> modItems;
     
     /**
      * 
@@ -60,7 +60,7 @@
      * Creates a new instance of ModifyOperationContext.
      *
      */
-    public ModifyOperationContext( LdapDN dn, List<ModificationItem> modItems )
+    public ModifyOperationContext( LdapDN dn, List<ModificationItemImpl> modItems )
     {
         super( dn );
         this.modItems = modItems;
@@ -70,7 +70,7 @@
      * Set the modified attributes
      * @param modItems The modified attributes
      */
-    public void setModItems( List<ModificationItem> modItems ) 
+    public void setModItems( List<ModificationItemImpl> modItems )
     {
         this.modItems = modItems;
     }
@@ -78,16 +78,16 @@
     /**
      * @return The modifications
      */
-    public List<ModificationItem> getModItems() 
+    public List<ModificationItemImpl> getModItems() 
     {
         return modItems;
     }
     
     @SuppressWarnings( value = "unchecked" )
-    public static List<ModificationItem> createModItems( Attributes attributes, int modOp ) throws NamingException
+    public static List<ModificationItemImpl> createModItems( Attributes attributes, int modOp ) throws NamingException
     {
-        List<ModificationItem> items = new ArrayList<ModificationItem>( attributes.size() );
-        NamingEnumeration<Attribute> e = (NamingEnumeration<Attribute>)attributes.getAll();
+        List<ModificationItemImpl> items = new ArrayList<ModificationItemImpl>( attributes.size() );
+        NamingEnumeration<Attribute> e = ( NamingEnumeration<Attribute> ) attributes.getAll();
         
         while ( e.hasMore() )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/AbstractContextFactory.java Fri Oct  5 23:48:35 2007
@@ -20,28 +20,22 @@
 package org.apache.directory.server.core.jndi;
 
 
-import java.util.Hashtable;
-
-import javax.naming.ConfigurationException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.DirectoryServiceListener;
-import org.apache.directory.server.core.configuration.AddPartitionConfiguration;
-import org.apache.directory.server.core.configuration.Configuration;
-import org.apache.directory.server.core.configuration.RemovePartitionConfiguration;
-import org.apache.directory.server.core.configuration.ShutdownConfiguration;
-import org.apache.directory.server.core.configuration.StartupConfiguration;
-import org.apache.directory.server.core.configuration.SyncConfiguration;
+import org.apache.directory.server.core.configuration.*;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
 import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
+import javax.naming.ConfigurationException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
+import javax.naming.spi.InitialContextFactory;
+import java.util.Hashtable;
+
 
 /**
  * A server-side JNDI provider implementation of {@link InitialContextFactory}.
@@ -62,184 +56,11 @@
  * Please note that you'll also have to maintain any stateful information
  * as using singleton pattern if you're going to extend this factory.
  * <p>
- * This class implements {@link DirectoryServiceListener}.  This means that
- * you can listen to the changes occurs to {@link DirectoryService}, and
- * react to it (e.g. executing additional business logic).
- * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  * 
  * @see javax.naming.spi.InitialContextFactory
  */
-public abstract class AbstractContextFactory implements InitialContextFactory, DirectoryServiceListener
+public abstract class AbstractContextFactory implements InitialContextFactory
 {
-    //TM private static long cumul = 0L;
-    //TM private static long count = 0;
-    // ------------------------------------------------------------------------
-    // Members
-    // ------------------------------------------------------------------------
-
-    /**
-     * Creates a new instance.
-     */
-    protected AbstractContextFactory()
-    {
-    }
-
-
-    @SuppressWarnings(value={"unchecked"})
-    public final synchronized Context getInitialContext( Hashtable env ) throws NamingException
-    {
-        //TM long t0 = System.nanoTime();
-        Configuration cfg = Configuration.toConfiguration( env );
-        
-        env = ( Hashtable<String, Object> ) env.clone();
-        
-        LdapDN principalDn = null;
-        if ( env.containsKey( Context.SECURITY_PRINCIPAL ) )
-        {
-            if ( env.get( Context.SECURITY_PRINCIPAL ) instanceof LdapDN )
-            {
-                principalDn = ( LdapDN ) env.get( Context.SECURITY_PRINCIPAL );
-            }
-        }
-        
-        String principal = getPrincipal( env );
-        byte[] credential = getCredential( env );
-        String authentication = getAuthentication( env );
-        String providerUrl = getProviderUrl( env );
-
-        DirectoryService service = DirectoryService.getInstance( cfg.getInstanceId() );
-
-        // Execute configuration
-        if ( cfg instanceof ShutdownConfiguration )
-        {
-            service.shutdown();
-            return new DeadContext();
-        }
-        else if ( cfg instanceof SyncConfiguration )
-        {
-            service.sync();
-        }
-        else if ( cfg instanceof StartupConfiguration )
-        {
-            service.startup( this, env );
-        }
-        else if ( cfg instanceof AddPartitionConfiguration )
-        {
-            AddContextPartitionOperationContext ctxPartition = 
-                new AddContextPartitionOperationContext( ( ( AddPartitionConfiguration ) cfg ).getPartition() );
-            
-            Context ctx = service.getJndiContext( principalDn, principal, credential, authentication, "" ); 
-            
-            new PartitionNexusProxy( ctx, service ).addContextPartition( ctxPartition );
-        }
-        else if ( cfg instanceof RemovePartitionConfiguration )
-        {
-            Context ctx = service.getJndiContext( principalDn, principal, credential, authentication, "" );
-            PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, service );
-            proxy.removeContextPartition( 
-                new RemoveContextPartitionOperationContext( ( ( RemovePartitionConfiguration ) cfg ).getSuffix() ) );
-        }
-        else if ( service == null )
-        {
-            throw new NamingException( "Unknown configuration: " + cfg );
-        }
-
-        Context context = service.getJndiContext( principalDn, principal, credential, authentication, providerUrl );
-        //TM long t1 = System.nanoTime();
-        //TM cumul += (t1 - t0)/1000;
-        //TM count++;
-        
-        //TM if ( count % 1000 == 0)
-        //TM {
-        //TM     System.out.println( "getInitialContext cost : " + (cumul/count) );
-        //TM }
-        
-        return context;
-    }
-
-
-    public static String getProviderUrl( Hashtable<String, Object> env )
-    {
-        String providerUrl;
-        Object value;
-        value = env.get( Context.PROVIDER_URL );
-        if ( value == null )
-        {
-            value = "";
-        }
-        providerUrl = value.toString();
-
-        env.put( Context.PROVIDER_URL, providerUrl );
-
-        return providerUrl;
-    }
-
-
-    public static String getAuthentication( Hashtable<String, Object> env )
-    {
-        String authentication;
-        Object value = env.get( Context.SECURITY_AUTHENTICATION );
-        if ( value == null )
-        {
-            authentication = "none";
-        }
-        else
-        {
-            authentication = value.toString();
-        }
-
-        env.put( Context.SECURITY_AUTHENTICATION, authentication );
-
-        return authentication;
-    }
-
-
-    public static byte[] getCredential( Hashtable<String, Object> env ) throws ConfigurationException
-    {
-        byte[] credential;
-        Object value = env.get( Context.SECURITY_CREDENTIALS );
-        if ( value == null )
-        {
-            credential = null;
-        }
-        else if ( value instanceof String )
-        {
-            credential = StringTools.getBytesUtf8( (String)value );
-        }
-        else if ( value instanceof byte[] )
-        {
-            credential = ( byte[] ) value;
-        }
-        else
-        {
-            throw new ConfigurationException( "Can't convert '" + Context.SECURITY_CREDENTIALS + "' to byte[]." );
-        }
-
-        if ( credential != null )
-        {
-            env.put( Context.SECURITY_CREDENTIALS, credential );
-        }
-
-        return credential;
-    }
-
-
-    public static String getPrincipal( Hashtable env )
-    {
-        String principal;
-        Object value = env.get( Context.SECURITY_PRINCIPAL );
-        if ( value == null )
-        {
-            principal = null;
-        }
-        else
-        {
-            principal = value.toString();
-            env.put( Context.SECURITY_PRINCIPAL, principal );
-        }
-
-        return principal;
-    }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java Fri Oct  5 23:48:35 2007
@@ -20,10 +20,18 @@
 package org.apache.directory.server.core.jndi;
 
 
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-
+import org.apache.directory.server.core.configuration.*;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
+import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import javax.naming.spi.InitialContextFactory;
+import javax.naming.*;
+import javax.naming.ConfigurationException;
+import java.util.Hashtable;
 
 
 /**
@@ -34,60 +42,126 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class CoreContextFactory extends AbstractContextFactory implements InitialContextFactory
+public class CoreContextFactory implements InitialContextFactory
 {
-    /**
-     * Creates a new instance.
-     */
-    public CoreContextFactory()
+    public synchronized Context getInitialContext( Hashtable env ) throws NamingException
     {
-    }
+        env = ( Hashtable<String, Object> ) env.clone();
+        LdapDN principalDn = null;
+        if ( env.containsKey( Context.SECURITY_PRINCIPAL ) )
+        {
+            if ( env.get( Context.SECURITY_PRINCIPAL ) instanceof LdapDN )
+            {
+                principalDn = ( LdapDN ) env.get( Context.SECURITY_PRINCIPAL );
+            }
+        }
 
+        String principal = getPrincipal( env );
+        byte[] credential = getCredential( env );
+        String authentication = getAuthentication( env );
+        String providerUrl = getProviderUrl( env );
 
-    /**
-     * Does nothing by default.
-     */
-    public void beforeStartup( DirectoryService service ) throws NamingException
-    {
-    }
+        DirectoryService service = ( DirectoryService ) env.get( DirectoryService.JNDI_KEY );
 
+        if ( service == null )
+        {
+            throw new ConfigurationException( "Cannot find directory service in environment: " + env );
+        }
 
-    /**
-     * Does nothing by default.
-     */
-    public void afterStartup( DirectoryService service ) throws NamingException
-    {
+        if ( ! service.isStarted() )
+        {
+            return new DeadContext();
+        }
+
+        ServerLdapContext ctx = ( ServerLdapContext ) service.getJndiContext( principalDn, principal, credential,
+                authentication, providerUrl );
+
+        // check to make sure we have access to the specified dn in provider URL
+        ctx.lookup( "" );
+        return ctx;        
     }
 
 
-    /**
-     * Does nothing by default.
-     */
-    public void beforeShutdown( DirectoryService service ) throws NamingException
+    public static String getProviderUrl( Hashtable<String, Object> env )
     {
+        String providerUrl;
+        Object value;
+        value = env.get( Context.PROVIDER_URL );
+        if ( value == null )
+        {
+            value = "";
+        }
+        providerUrl = value.toString();
+
+        env.put( Context.PROVIDER_URL, providerUrl );
+
+        return providerUrl;
     }
 
 
-    /**
-     * Does nothing by default.
-     */
-    public void afterShutdown( DirectoryService service ) throws NamingException
+    public static String getAuthentication( Hashtable<String, Object> env )
     {
+        String authentication;
+        Object value = env.get( Context.SECURITY_AUTHENTICATION );
+        if ( value == null )
+        {
+            authentication = "none";
+        }
+        else
+        {
+            authentication = value.toString();
+        }
+
+        env.put( Context.SECURITY_AUTHENTICATION, authentication );
+
+        return authentication;
     }
 
 
-    /**
-     * Does nothing by default.
-     */
-    public void beforeSync( DirectoryService service ) throws NamingException
+    public static byte[] getCredential( Hashtable<String, Object> env ) throws javax.naming.ConfigurationException
     {
+        byte[] credential;
+        Object value = env.get( Context.SECURITY_CREDENTIALS );
+        if ( value == null )
+        {
+            credential = null;
+        }
+        else if ( value instanceof String )
+        {
+            credential = StringTools.getBytesUtf8( (String)value );
+        }
+        else if ( value instanceof byte[] )
+        {
+            credential = ( byte[] ) value;
+        }
+        else
+        {
+            throw new javax.naming.ConfigurationException( "Can't convert '" + Context.SECURITY_CREDENTIALS + "' to byte[]." );
+        }
+
+        if ( credential != null )
+        {
+            env.put( Context.SECURITY_CREDENTIALS, credential );
+        }
+
+        return credential;
     }
 
 
-    /**
-     * Does nothing by default.
-     */
-    public void afterSync( DirectoryService service ) throws NamingException
+    public static String getPrincipal( Hashtable<String,Object> env )
     {
+        String principal;
+        Object value = env.get( Context.SECURITY_PRINCIPAL );
+        if ( value == null )
+        {
+            principal = null;
+        }
+        else
+        {
+            principal = value.toString();
+            env.put( Context.SECURITY_PRINCIPAL, principal );
+        }
+
+        return principal;
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java Fri Oct  5 23:48:35 2007
@@ -40,7 +40,6 @@
 import javax.naming.ldap.ExtendedResponse;
 import javax.naming.ldap.LdapContext;
 
-import org.apache.directory.server.core.configuration.SyncConfiguration;
 import org.apache.directory.shared.ldap.exception.LdapServiceUnavailableException;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -49,10 +48,11 @@
 
 
 /**
- * A do nothing placeholder context whose methods throw ConfigurationExceptions.
- * JNDI provider returns this context when your specify {@link SyncConfiguration}
- * in JNDI environment.  By returning a non-null Context we prevent an unnecessary
- * exception being thrown by {@link InitialContext} and any one of its subclasses.
+ * A do nothing placeholder context whose methods throw ServiceUnavailableExceptions.
+ * JNDI provider returns this context when you perform JNDI operations against the
+ * core directory service that has been shutdown or not started.  By returning a
+ * non-null Context we prevent an unnecessary exception being thrown by
+ * {@link InitialContext} and any one of its subclasses.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -60,7 +60,7 @@
 public class DeadContext implements LdapContext, EventDirContext
 {
     private final String EXCEPTION_MSG = "Context operation unavailable when "
-        + "invoked after Eve provider has been shutdown";
+        + "invoked after directory service core provider has been shutdown";
 
 
     public Control[] getConnectControls() throws NamingException

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java Fri Oct  5 23:48:35 2007
@@ -179,11 +179,11 @@
             {
                 props.level = AuthenticationLevel.STRONG;
                 String[] mechList = ( ( String ) authentication ).trim().split( " " );
-                for ( int ii = 0; ii < mechList.length; ii++ )
+                for ( String mech : mechList )
                 {
-                    if ( !mechList[ii].trim().equals( "" ) )
+                    if ( !mech.trim().equals( "" ) )
                     {
-                        props.mechanisms.add( mechList[ii] );
+                        props.mechanisms.add( mech );
                     }
                 }
             }
@@ -193,18 +193,20 @@
         // Figure out and set the security principal bindDn and saslAuthId
         // -------------------------------------------------------------------
 
-        if ( principal == null )
+        if ( principal == null && props.level == AuthenticationLevel.SIMPLE )
         {
             throw new LdapConfigurationException( Context.SECURITY_PRINCIPAL + " cannot be null." );
         }
-        
-        if ( !( principal instanceof String ) )
+        else if ( principal == null && props.level == AuthenticationLevel.NONE )
+        {
+            props.bindDn = LdapDN.EMPTY_LDAPDN;
+        }
+        else if ( !( principal instanceof String ) )
         {
             throw new LdapConfigurationException( "Don't know how to interpret " + principal.getClass()
                 + " objects for environment property " + Context.SECURITY_PRINCIPAL );
         }
-        
-        if ( ( ( String ) principal ).trim().equals( "" ) )
+        else if ( ( ( String ) principal ).trim().equals( "" ) )
         {
             props.bindDn = LdapDN.EMPTY_LDAPDN;
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Fri Oct  5 23:48:35 2007
@@ -50,7 +50,6 @@
 import javax.naming.spi.DirectoryManager;
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.authn.AuthenticationService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -145,15 +144,14 @@
      * correctly.
      */
     @SuppressWarnings(value={"unchecked"})
-    protected ServerContext(DirectoryService service, Hashtable<String, Object> env) throws NamingException
+    protected ServerContext( DirectoryService service, Hashtable<String, Object> env ) throws NamingException
     {
         this.service = service;
 
         // set references to cloned env and the proxy
         this.nexusProxy = new PartitionNexusProxy( this, service );
 
-        DirectoryServiceConfiguration cfg = service.getConfiguration();
-        this.env = ( Hashtable<String, Object> ) cfg.getEnvironment().clone();
+        this.env = ( Hashtable<String, Object> ) service.getEnvironment().clone();
         this.env.putAll( env );
         LdapJndiProperties props = LdapJndiProperties.getLdapJndiProperties( this.env );
         dn = props.getProviderDn();
@@ -183,7 +181,7 @@
         this.service = service;
         this.dn = ( LdapDN ) dn.clone();
 
-        this.env = ( Hashtable<String, Object> ) service.getConfiguration().getEnvironment().clone();
+        this.env = ( Hashtable<String, Object> ) service.getEnvironment().clone();
         this.env.put( PROVIDER_URL, dn.toString() );
         this.nexusProxy = new PartitionNexusProxy( this, service );
 
@@ -376,7 +374,7 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after modify operations.
      */
-    protected void doModifyOperation( LdapDN dn, List<ModificationItem> modItems ) throws NamingException
+    protected void doModifyOperation( LdapDN dn, List<ModificationItemImpl> modItems ) throws NamingException
     {
         // setup the op context and populate with request controls
         ModifyOperationContext opCtx = new ModifyOperationContext( dn, modItems );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Fri Oct  5 23:48:35 2007
@@ -161,11 +161,11 @@
      */
     public void modifyAttributes( Name name, int modOp, Attributes attrs ) throws NamingException
     {
-        List<ModificationItem> modItems = null;
+        List<ModificationItemImpl> modItems = null;
         
         if ( attrs != null )
         {
-            modItems = new ArrayList<ModificationItem>( attrs.size() );
+            modItems = new ArrayList<ModificationItemImpl>( attrs.size() );
             NamingEnumeration<Attribute> e = (NamingEnumeration<Attribute>)attrs.getAll();
             int i = 0;
             
@@ -218,7 +218,7 @@
      */
     public void modifyAttributes( Name name, ModificationItem[] mods ) throws NamingException
     {
-        List<ModificationItem> newMods = new ArrayList<ModificationItem>( mods.length );
+        List<ModificationItemImpl> newMods = new ArrayList<ModificationItemImpl>( mods.length );
         
         for ( ModificationItem mod:mods )
         {
@@ -233,7 +233,7 @@
      * @see javax.naming.directory.DirContext#modifyAttributes(
      * javax.naming.Name, javax.naming.directory.ModificationItem[])
      */
-    public void modifyAttributes( Name name, List<ModificationItem> mods ) throws NamingException
+    public void modifyAttributes( Name name, List<ModificationItemImpl> mods ) throws NamingException
     {
         doModifyOperation( buildTarget( new LdapDN( name ) ), mods );
     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Fri Oct  5 23:48:35 2007
@@ -31,7 +31,6 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
-import org.apache.directory.server.core.configuration.StartupConfiguration;
 import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.core.referral.ReferralService;
@@ -48,7 +47,7 @@
 public class ServerLdapContext extends ServerDirContext implements LdapContext
 {
     /** A reference to the RTeferralService interceptor */
-    private transient ReferralService refService = null; 
+    private transient ReferralService refService; 
     
 
     /**
@@ -61,8 +60,7 @@
     public ServerLdapContext( DirectoryService service, Hashtable<String, Object> env ) throws NamingException
     {
         super( service, env );
-        refService = (( ReferralService )service.getConfiguration()
-            .getInterceptorChain().get( ReferralService.class.getName() ) );        
+        refService = ( ( ReferralService ) service.getInterceptorChain().get( ReferralService.class.getName() ) );
     }
 
 
@@ -72,12 +70,13 @@
      *
      * @param principal the directory user principal that is propagated
      * @param dn the distinguished name of this context
+     * @param service the directory service core
+     * @throws NamingException if there are problems instantiating 
      */
-    ServerLdapContext( DirectoryService service, LdapPrincipal principal, LdapDN dn ) throws NamingException
+    public ServerLdapContext( DirectoryService service, LdapPrincipal principal, LdapDN dn ) throws NamingException
     {
         super( service, principal, dn );
-        refService = (( ReferralService )service.getConfiguration()
-            .getInterceptorChain().get( ReferralService.class.getName() ) );        
+        refService = ( ( ReferralService ) service.getInterceptorChain().get( ReferralService.class.getName() ) );
     }
 
 
@@ -188,11 +187,11 @@
      * called when you create a new initial context for a new connection (on wire) or 
      * (programatic) caller.
      * 
-     * @throws NamingException
+     * @throws NamingException if there are failures encountered while unbinding
      */
     public void ldapUnbind() throws NamingException
     {
-        LdapDN principalDn = null;
+        LdapDN principalDn;
         Object principalDnValue = getEnvironment().get( Context.SECURITY_PRINCIPAL );
         
         if ( principalDnValue instanceof LdapDN )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java Fri Oct  5 23:48:35 2007
@@ -20,32 +20,10 @@
 package org.apache.directory.server.core.normalization;
 
 
-import java.util.Map;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-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;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -58,6 +36,12 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
+import java.util.Map;
+
 
 /**
  * A name normalization service.  This service makes sure all relative and distinuished
@@ -72,24 +56,21 @@
 public class NormalizationService extends BaseInterceptor
 {
     /** logger used by this class */
-    private static final Logger log = LoggerFactory.getLogger( NormalizationService.class );
+    private static final Logger LOG = LoggerFactory.getLogger( NormalizationService.class );
 
     /** a filter node value normalizer and undefined node remover */
     private NormalizingVisitor normVisitor;
-    
-    /** the attributeType registry used for normalization and determining if some filter nodes are undefined */
-    private AttributeTypeRegistry attributeRegistry;
-    
+
     /** The association between attributeTypes and their normalizers */
     private Map<String, OidNormalizer> attrNormalizers; 
 
     /**
      * Initialize the registries, normalizers. 
      */
-    public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+    public void init( DirectoryService directoryService ) throws NamingException
     {
-        OidRegistry oidRegistry = factoryCfg.getRegistries().getOidRegistry();
-        attributeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+        OidRegistry oidRegistry = directoryService.getRegistries().getOidRegistry();
+        AttributeTypeRegistry attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
         normVisitor = new NormalizingVisitor( ncn, oidRegistry );
         //expVisitor = new ExpandingVisitor( attributeRegistry );
@@ -165,7 +146,7 @@
         
         if ( result == null )
         {
-            log.warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
+            LOG.warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
             return new EmptyEnumeration<SearchResult>();
         }
         else
@@ -188,7 +169,7 @@
                 buf.append( "undefined filter based on undefined attributeType '" );
                 buf.append( ln.getAttribute() );
                 buf.append( "' not evaluted at all.  Returning empty enumeration." );
-                log.warn( buf.toString() );
+                LOG.warn( buf.toString() );
                 return new EmptyEnumeration<SearchResult>();
             }
         }
@@ -209,7 +190,7 @@
                         buf.append( "undefined filter based on undefined attributeType '" );
                         buf.append( ln.getAttribute() );
                         buf.append( "' not evaluted at all.  Returning empty enumeration." );
-                        log.warn( buf.toString() );
+                        LOG.warn( buf.toString() );
                         return new EmptyEnumeration<SearchResult>();
                     }
                 }
@@ -222,9 +203,9 @@
             {
                 isFailure = true;
                 
-                if ( log.isWarnEnabled() )
+                if ( LOG.isWarnEnabled() )
                 {
-                    log.warn( "An undefined attribute was found within the supplied search filter.  " +
+                    LOG.warn( "An undefined attribute was found within the supplied search filter.  " +
                             "The node associated with the filter has been removed.", e.getCause() );
                 }
 
@@ -259,7 +240,7 @@
             // if the remaining filter branch node has no children return an empty enumeration
             if ( child.getChildren().size() == 0 || child.get( "undefined" ) == Boolean.TRUE )
             {
-                log.warn( "Undefined branchnode filter without child nodes not " +
+                LOG.warn( "Undefined branchnode filter without child nodes not " +
                         "evaluted at all.  Returning empty enumeration." );
                 return new EmptyEnumeration<SearchResult>();
             }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Fri Oct  5 23:48:35 2007
@@ -19,37 +19,14 @@
  */
 package org.apache.directory.server.core.operational;
 
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
 import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-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;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -66,6 +43,11 @@
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.DateUtils;
 
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.util.*;
+
 
 /**
  * An {@link Interceptor} that adds or modifies the default attributes
@@ -85,12 +67,8 @@
         public boolean accept( Invocation invocation, SearchResult result, SearchControls controls ) 
             throws NamingException
         {
-            if ( controls.getReturningAttributes() != null )
-            {
-                return filterDenormalized( result.getAttributes() );
-            }
-            
-            return true;
+            return controls.getReturningAttributes() == null || filterDenormalized( result.getAttributes() );
+
         }
     };
 
@@ -102,12 +80,8 @@
         public boolean accept( Invocation invocation, SearchResult result, SearchControls controls )
             throws NamingException
         {
-            if ( controls.getReturningAttributes() == null )
-            {
-                return filter( result.getAttributes() );
-            }
+            return controls.getReturningAttributes() != null || filter( result.getAttributes() );
 
-            return true;
         }
     };
 
@@ -119,12 +93,9 @@
     private AttributeTypeRegistry registry;
 
     private boolean isDenormalizeOpAttrsEnabled;
-
-    /**
-     * subschemaSubentry attribute's value from Root DSE
-     */
     private LdapDN subschemaSubentryDn;
 
+
     /**
      * Creates the operational attribute management service interceptor.
      */
@@ -133,16 +104,16 @@
     }
 
 
-    public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+    public void init( DirectoryService directoryService ) throws NamingException
     {
-        nexus = factoryCfg.getPartitionNexus();
-        registry = factoryCfg.getRegistries().getAttributeTypeRegistry();
-        isDenormalizeOpAttrsEnabled = factoryCfg.getStartupConfiguration().isDenormalizeOpAttrsEnabled();
+        nexus = directoryService.getPartitionNexus();
+        registry = directoryService.getRegistries().getAttributeTypeRegistry();
+        isDenormalizeOpAttrsEnabled = directoryService.isDenormalizeOpAttrsEnabled();
 
         // stuff for dealing with subentries (garbage for now)
         String subschemaSubentry = ( String ) nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
         subschemaSubentryDn = new LdapDN( subschemaSubentry );
-        subschemaSubentryDn.normalize( factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+        subschemaSubentryDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
     }
 
 
@@ -170,7 +141,8 @@
 
         nextInterceptor.add( opContext );
     }
-    
+
+
     public void modify( NextInterceptor nextInterceptor, ModifyOperationContext opContext )
         throws NamingException
     {
@@ -185,7 +157,7 @@
         // Add the operational attributes for the modifier first
         // -------------------------------------------------------------------
         
-        List<ModificationItem> modItemList = new ArrayList<ModificationItem>(2);
+        List<ModificationItemImpl> modItemList = new ArrayList<ModificationItemImpl>(2);
         
         Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
         attribute.add( getPrincipal().getName() );
@@ -228,7 +200,7 @@
         newDn.add( opContext.getNewRdn() );
         newDn.normalize( registry.getNormalizerMapping() );
         
-        List<ModificationItem> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
 
         ModifyOperationContext newModify = new ModifyOperationContext( newDn, items );
         
@@ -250,7 +222,7 @@
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        List<ModificationItem> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
 
 
         ModifyOperationContext newModify = 
@@ -275,7 +247,7 @@
         attribute.add( DateUtils.getGeneralizedTime() );
         attributes.put( attribute );
 
-        List<ModificationItem> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
 
         ModifyOperationContext newModify = 
             new ModifyOperationContext( 
@@ -342,6 +314,7 @@
      *
      * @param attributes the resultant attributes to filter
      * @return true always
+     * @throws NamingException if there are failures in evaluation
      */
     private boolean filter( Attributes attributes ) throws NamingException
     {
@@ -425,9 +398,7 @@
                 attr.add( denormalizeTypes( creatorsName ).getUpName() );
             }
             
-            type = null;
             type = registry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
-            attr = null;
             attr = AttributeUtils.getAttribute( entry, type );
             
             if ( attr != null )
@@ -438,9 +409,7 @@
                 attr.add( denormalizeTypes( modifiersName ).getUpName() );
             }
 
-            type = null;
             type = registry.lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
-            attr = null;
             attr = AttributeUtils.getAttribute( entry, type );
             
             if ( attr != null )
@@ -457,6 +426,10 @@
     /**
      * Does not create a new DN but alters existing DN by using the first
      * short name for an attributeType definition.
+     * 
+     * @param dn the normalized distinguished name
+     * @return the distinuished name denormalized
+     * @throws NamingException if there are problems denormalizing
      */
     public LdapDN denormalizeTypes( LdapDN dn ) throws NamingException
     {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Fri Oct  5 23:48:35 2007
@@ -20,14 +20,14 @@
 package org.apache.directory.server.core.partition;
 
 
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-
 
 /**
  * A {@link Partition} that helps users to implement their own partition.
@@ -39,8 +39,8 @@
  */
 public abstract class AbstractPartition implements Partition
 {
-    /** {@link DirectoryServiceConfiguration} specified at {@link #init(DirectoryServiceConfiguration)}. */
-    protected DirectoryServiceConfiguration factoryCfg;
+    /** {@link DirectoryService} specified at {@link #init(DirectoryService)}. */
+    protected DirectoryService directoryService;
     /** <tt>true</tt> if and only if this partition is initialized. */
     protected boolean initialized;
 
@@ -51,13 +51,12 @@
 
 
     /**
-     * Sets up default properties(<tt>factoryConfiguration</tt> and <tt>configuration</tt>) and
-     * calls {@link #doInit()} where you have to put your initialization code in.
-     * {@link #isInitialized()} will return <tt>true</tt> if {@link #doInit()} returns
-     * without any errors.  {@link #destroy()} is called automatically as a clean-up process
-     * if {@link #doInit()} throws an exception.
+     * Sets up (<tt>directoryService</tt> and calls {@link #doInit()} where you have to put your
+     * initialization code in.  {@link #isInitialized()} will return <tt>true</tt> if
+     * {@link #doInit()} returns without any errors.  {@link #destroy()} is called automatically
+     * as a clean-up process if {@link #doInit()} throws an exception.
      */
-    public final void init( DirectoryServiceConfiguration factoryCfg ) throws NamingException
+    public final void init( DirectoryService directoryService ) throws NamingException
     {
         if ( initialized )
         {
@@ -65,7 +64,7 @@
             return;
         }
 
-        this.factoryCfg = factoryCfg;
+        this.directoryService = directoryService;
         try
         {
             doInit();
@@ -103,7 +102,7 @@
         finally
         {
             initialized = false;
-            factoryCfg = null;
+            directoryService = null;
         }
     }
 
@@ -126,13 +125,13 @@
 
 
     /**
-     * Returns {@link DirectoryServiceConfiguration} that is provided from
-     * {@link #init(DirectoryServiceConfiguration)}.
-     * @return return the directory service
+     * Returns {@link DirectoryService} that is provided from
+     * {@link #init(DirectoryService)}.
+     * @return return the directory service core
      */
-    public final DirectoryServiceConfiguration getFactoryConfiguration()
+    public final DirectoryService getDirectoryService()
     {
-        return factoryCfg;
+        return directoryService;
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Fri Oct  5 23:48:35 2007
@@ -20,7 +20,7 @@
 package org.apache.directory.server.core.partition;
 
 
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
@@ -94,7 +94,7 @@
     /** the closed state of this partition */
     private boolean initialized;
 
-    private DirectoryServiceConfiguration factoryCfg;
+    private DirectoryService directoryService;
 
     /** the system partition */
     private Partition system;
@@ -275,7 +275,7 @@
 
 
 
-    public void init( DirectoryServiceConfiguration factoryCfg )
+    public void init( DirectoryService directoryService )
         throws NamingException
     {
         // NOTE: We ignore ContextPartitionConfiguration parameter here.
@@ -284,17 +284,16 @@
             return;
         }
 
-        this.factoryCfg = factoryCfg;
-        this.attrRegistry = this.factoryCfg.getRegistries().getAttributeTypeRegistry();
-        this.oidRegistry = this.factoryCfg.getRegistries().getOidRegistry();
+        this.directoryService = directoryService;
+        this.attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+        this.oidRegistry = directoryService.getRegistries().getOidRegistry();
         
         initializeSystemPartition();
         List<Partition> initializedPartitions = new ArrayList<Partition>();
         initializedPartitions.add( 0, this.system );
 
         //noinspection unchecked
-        Iterator<Partition> partitions =
-                ( Iterator<Partition> ) factoryCfg.getStartupConfiguration().getPartitions().iterator();
+        Iterator<Partition> partitions = ( Iterator<Partition> ) directoryService.getPartitions().iterator();
         try
         {
             while ( partitions.hasNext() )
@@ -336,7 +335,7 @@
     private Partition initializeSystemPartition() throws NamingException
     {
         // initialize system partition first
-        Partition override = factoryCfg.getStartupConfiguration().getSystemPartition();
+        Partition override = directoryService.getSystemPartition();
         if ( override != null )
         {
             Attributes systemEntry = override.getContextEntry();
@@ -370,7 +369,7 @@
             {
                 Set<Index> indices = ( ( JdbmPartition ) override ).getIndexedAttributes();
                 Set<String> indexOids = new HashSet<String>();
-                OidRegistry registry = factoryCfg.getRegistries().getOidRegistry();
+                OidRegistry registry = directoryService.getRegistries().getOidRegistry();
 
                 for ( Index index : indices )
                 {
@@ -389,7 +388,7 @@
 
                 ( ( JdbmPartition ) override ).setIndexedAttributes( indices );
 
-                system = ( JdbmPartition ) override;
+                system = override;
             }
         }
         else
@@ -418,7 +417,7 @@
             system.setContextEntry( systemEntry );
         }
 
-        system.init( factoryCfg );
+        system.init( directoryService );
         String key = system.getSuffixDn().toString();
         
         if ( partitions.containsKey( key ) )
@@ -451,14 +450,10 @@
             return;
         }
 
-        Iterator<String> suffixes = new HashSet<String>( this.partitions.keySet() ).iterator();
-
         // make sure this loop is not fail fast so all backing stores can
         // have an attempt at closing down and synching their cached entries
-        while ( suffixes.hasNext() )
+        for ( String suffix : new HashSet<String>( this.partitions.keySet() ) )
         {
-            String suffix = suffixes.next();
-            
             try
             {
                 removeContextPartition( new RemoveContextPartitionOperationContext( new LdapDN( suffix ) ) );
@@ -491,6 +486,7 @@
                 LOG.warn( "Failed to flush partition data out.", e );
                 if ( error == null )
                 {
+                    //noinspection ThrowableInstanceNeverThrown
                     error = new MultiException( "Grouping many exceptions on root nexus sync()" );
                 }
 
@@ -502,6 +498,7 @@
         if ( error != null )
         {
             String msg = "Encountered failures while performing a sync() operation on backing stores";
+            //noinspection ThrowableInstanceNeverThrown
             NamingException total = new NamingException( msg );
             total.setRootCause( error );
         }
@@ -515,7 +512,7 @@
     public boolean compare( CompareOperationContext compareContext ) throws NamingException
     {
         Partition partition = getPartition( compareContext.getDn() );
-        AttributeTypeRegistry registry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+        AttributeTypeRegistry registry = directoryService.getRegistries().getAttributeTypeRegistry();
         
         // complain if we do not recognize the attribute being compared
         if ( !registry.hasAttributeType( compareContext.getOid() ) )
@@ -594,7 +591,7 @@
 
         if ( ! partition.isInitialized() )
         {
-            partition.init( factoryCfg );
+            partition.init( directoryService );
         }
         
         synchronized ( partitionLookupTree )
@@ -610,14 +607,8 @@
             partitionLookupTree.recursivelyAddPartition( partitionLookupTree, partition.getSuffixDn(), 0, partition );
 
             Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
-            
-        	if ( partitionSuffix == null )
-        	{
-        		throw new ConfigurationException( "The current partition does not have any suffix: " + partition.getId() );
-        	}
-        	
-        	LdapDN partitionUpSuffix = partition.getUpSuffixDn();
 
+        	LdapDN partitionUpSuffix = partition.getUpSuffixDn();
         	if ( partitionUpSuffix == null )
         	{
         		throw new ConfigurationException( "The current partition does not have any user provided suffix: " + partition.getId() );
@@ -744,6 +735,7 @@
      *
      * @param partition ContextPartition component to unregister with this
      * BackendNexus.
+     * @throws NamingException if there are problems unregistering the partition
      */
     private void unregister( Partition partition ) throws NamingException
     {
@@ -1074,7 +1066,7 @@
                 {
                     break;
                 }
-                
+
                 if ( currentNode instanceof LeafNode )
                 {
                     return ( ( LeafNode ) currentNode ).getPartition();

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Fri Oct  5 23:48:35 2007
@@ -20,27 +20,16 @@
 package org.apache.directory.server.core.partition;
 
 
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.interceptor.context.*;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchResult;
 
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-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.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
 
 /**
  * An interfaces that bridges between underlying JNDI entries and JNDI
@@ -144,10 +133,10 @@
     /**
      * Initializes this partition.
      *
-     * @param factoryCfg the configuration for the server.
+     * @param core the directory core for the server.
      * @throws NamingException if initialization fails in any way
      */
-    void init( DirectoryServiceConfiguration factoryCfg ) throws NamingException;
+    void init( DirectoryService core ) throws NamingException;
 
 
     /**

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Fri Oct  5 23:48:35 2007
@@ -40,7 +40,6 @@
 import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.authn.AuthenticationService;
 import org.apache.directory.server.core.authz.AuthorizationService;
 import org.apache.directory.server.core.authz.DefaultAuthorizationService;
@@ -141,7 +140,6 @@
 
     private final Context caller;
     private final DirectoryService service;
-    private final DirectoryServiceConfiguration configuration;
 
     static
     {
@@ -202,13 +200,12 @@
     {
         this.caller = caller;
         this.service = service;
-        this.configuration = service.getConfiguration();
     }
 
 
     public LdapContext getLdapContext()
     {
-        return this.configuration.getPartitionNexus().getLdapContext();
+        return service.getPartitionNexus().getLdapContext();
     }
 
 
@@ -260,7 +257,7 @@
     }
 
 
-    public void init( DirectoryServiceConfiguration factoryCfg ) throws NamingException
+    public void init( DirectoryService core ) throws NamingException
     {
     }
 
@@ -272,24 +269,24 @@
 
     public Partition getSystemPartition()
     {
-        return this.configuration.getPartitionNexus().getSystemPartition();
+        return service.getPartitionNexus().getSystemPartition();
     }
 
 
     public Partition getPartition( LdapDN dn ) throws NamingException
     {
-        return this.configuration.getPartitionNexus().getPartition( dn );
+        return service.getPartitionNexus().getPartition( dn );
     }
 
 
     public LdapDN getSuffixDn() throws NamingException
     {
-        return this.configuration.getPartitionNexus().getSuffixDn();
+        return service.getPartitionNexus().getSuffixDn();
     }
 
     public LdapDN getUpSuffixDn() throws NamingException
     {
-        return this.configuration.getPartitionNexus().getUpSuffixDn();
+        return service.getPartitionNexus().getUpSuffixDn();
     }
 
 
@@ -326,7 +323,7 @@
 
         try
         {
-            return this.configuration.getInterceptorChain().getMatchedName( opContext );
+            return service.getInterceptorChain().getMatchedName( opContext );
         }
         finally
         {
@@ -349,7 +346,7 @@
         stack.push( new Invocation( this, caller, "getSuffixDn", args, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().getSuffix( opContext );
+            return service.getInterceptorChain().getSuffix( opContext );
         }
         finally
         {
@@ -372,7 +369,7 @@
         stack.push( new Invocation( this, caller, "listSuffixes", args, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().listSuffixes( opContext );
+            return service.getInterceptorChain().listSuffixes( opContext );
         }
         finally
         {
@@ -395,7 +392,7 @@
                 {opContext}, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().compare( opContext );
+            return service.getInterceptorChain().compare( opContext );
         }
         finally
         {
@@ -418,7 +415,7 @@
                 {opContext}, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().delete( opContext );
+            service.getInterceptorChain().delete( opContext );
         }
         finally
         {
@@ -441,7 +438,7 @@
                 {opContext}, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().add( opContext );
+            service.getInterceptorChain().add( opContext );
         }
         finally
         {
@@ -465,7 +462,7 @@
 
         try
         {
-            this.configuration.getInterceptorChain().modify( opContext );
+            service.getInterceptorChain().modify( opContext );
         }
         finally
         {
@@ -489,7 +486,7 @@
                 {opContext}, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().list( opContext );
+            return service.getInterceptorChain().list( opContext );
         }
         finally
         {
@@ -559,7 +556,7 @@
                 {opContext}, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().search( opContext );
+            return service.getInterceptorChain().search( opContext );
         }
         finally
         {
@@ -580,7 +577,7 @@
                 {
                     if ( ROOT_DSE_NO_OPERATIONNAL == null )
                     {
-                        ROOT_DSE_NO_OPERATIONNAL = lookup( opContext, ( Collection<String> ) null );
+                        ROOT_DSE_NO_OPERATIONNAL = lookup( opContext, null );
                     }
                 }
 
@@ -591,7 +588,7 @@
                 {
                     if ( ROOT_DSE_ALL == null )
                     {
-                        ROOT_DSE_ALL = lookup( opContext, ( Collection<String> ) null );
+                        ROOT_DSE_ALL = lookup( opContext, null );
                     }
                 }
 
@@ -600,7 +597,7 @@
 
         }
 
-        return lookup( opContext, ( Collection<String> ) null );
+        return lookup( opContext, null );
     }
 
 
@@ -612,7 +609,7 @@
                 {opContext}, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().lookup( opContext );
+            return service.getInterceptorChain().lookup( opContext );
         }
         finally
         {
@@ -634,7 +631,7 @@
                 {opContext}, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().hasEntry( opContext );
+            return service.getInterceptorChain().hasEntry( opContext );
         }
         finally
         {
@@ -658,7 +655,7 @@
         stack.push( new Invocation( this, caller, "rename", args, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().rename( opContext );
+            service.getInterceptorChain().rename( opContext );
         }
         finally
         {
@@ -681,7 +678,7 @@
                 {opContext}, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().move( opContext );
+            service.getInterceptorChain().move( opContext );
         }
         finally
         {
@@ -706,7 +703,7 @@
         stack.push( new Invocation( this, caller, "moveAndRename", args, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().moveAndRename( opContext );
+            service.getInterceptorChain().moveAndRename( opContext );
         }
         finally
         {
@@ -718,8 +715,8 @@
      * TODO : check if we can find another way to procect ourselves from recursion.
      *
      * @param opContext The operation context
-     * @param bypass
-     * @throws NamingException
+     * @param bypass bypass instructions to skip interceptors
+     * @throws NamingException if bind fails
      */
     public void bind( BindOperationContext opContext, Collection<String> bypass )
             throws NamingException
@@ -733,7 +730,7 @@
 
         try
         {
-            configuration.getInterceptorChain().bind( opContext );
+            service.getInterceptorChain().bind( opContext );
         }
         finally
         {
@@ -750,7 +747,7 @@
         stack.push( new Invocation( this, caller, "unbind", args, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().unbind( opContext );
+            service.getInterceptorChain().unbind( opContext );
         }
         finally
         {
@@ -798,7 +795,7 @@
         stack.push( new Invocation( this, caller, "getRootDSE", null, bypass ) );
         try
         {
-            return this.configuration.getInterceptorChain().getRootDSE( opContext );
+            return service.getInterceptorChain().getRootDSE( opContext );
         }
         finally
         {
@@ -822,7 +819,7 @@
                 {opContext}, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().addContextPartition( opContext );
+            service.getInterceptorChain().addContextPartition( opContext );
         }
         finally
         {
@@ -846,7 +843,7 @@
                 {opContext}, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().removeContextPartition( opContext );
+            service.getInterceptorChain().removeContextPartition( opContext );
         }
         finally
         {
@@ -866,7 +863,7 @@
 
     public void registerSupportedExtensions( Set<String> extensionOids )
     {
-        configuration.getPartitionNexus().registerSupportedExtensions( extensionOids );
+        service.getPartitionNexus().registerSupportedExtensions( extensionOids );
     }
 
     // -----------------------------------------------------------------------
@@ -883,7 +880,7 @@
     public void addNamingListener( EventContext ctx, Name name, ExprNode filter, SearchControls searchControls,
             NamingListener namingListener ) throws NamingException
     {
-        InterceptorChain chain = this.configuration.getInterceptorChain();
+        InterceptorChain chain = service.getInterceptorChain();
         EventService interceptor = ( EventService ) chain.get( EventService.class.getName() );
         interceptor.addNamingListener( ctx, name, filter, searchControls, namingListener );
     }
@@ -891,7 +888,7 @@
 
     public void removeNamingListener( EventContext ctx, NamingListener namingListener ) throws NamingException
     {
-        InterceptorChain chain = this.configuration.getInterceptorChain();
+        InterceptorChain chain = service.getInterceptorChain();
         if ( chain == null )
         {
             return;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Fri Oct  5 23:48:35 2007
@@ -20,7 +20,7 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.Partition;
@@ -145,7 +145,7 @@
     }
 
 
-    public final void init( DirectoryServiceConfiguration factoryCfg ) throws NamingException
+    public final void init( DirectoryService directoryService ) throws NamingException
     {
         // setup optimizer and registries for parent
         if ( ! optimizerEnabled )
@@ -157,15 +157,14 @@
             optimizer = new DefaultOptimizer( this );
         }
 
-        initRegistries( factoryCfg.getRegistries() );
+        initRegistries( directoryService.getRegistries() );
         
         // initialize the store
         store.setCacheSize( cacheSize );
         store.setContextEntry( contextEntry );
         store.setName( id );
         store.setSuffixDn( suffix );
-        store.setWorkingDirectory( new File(
-            factoryCfg.getStartupConfiguration().getWorkingDirectory().getPath() + File.separator + id ) );
+        store.setWorkingDirectory( new File( directoryService.getWorkingDirectory().getPath() + File.separator + id ) );
 
         Set<JdbmIndex> userIndices = new HashSet<JdbmIndex>();
         for ( Index obj : indexedAttributes )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java Fri Oct  5 23:48:35 2007
@@ -20,11 +20,12 @@
 package org.apache.directory.server.core.prefs;
 
 
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.shared.ldap.NotImplementedException;
+
 import java.util.prefs.Preferences;
 import java.util.prefs.PreferencesFactory;
 
-import org.apache.directory.shared.ldap.NotImplementedException;
-
 
 /**
  * A preferences factory implementation.  Currently the userRoot() preferences
@@ -35,9 +36,18 @@
  */
 public class ServerPreferencesFactory implements PreferencesFactory
 {
+    private final DirectoryService directoryService;
+
+
+    public ServerPreferencesFactory( DirectoryService directoryService )
+    {
+        this.directoryService = directoryService;
+    }
+
+
     public Preferences systemRoot()
     {
-        return new ServerSystemPreferences();
+        return new ServerSystemPreferences( directoryService );
     }