You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/06/15 07:15:04 UTC

svn commit: r190709 - in /directory/apacheds/trunk: core/src/main/java/org/apache/ldap/server/configuration/ core/src/main/java/org/apache/ldap/server/interceptor/ core/src/main/java/org/apache/ldap/server/jndi/ main/ main/src/main/java/org/apache/ldap/server/configuration/

Author: trustin
Date: Tue Jun 14 22:15:03 2005
New Revision: 190709

URL: http://svn.apache.org/viewcvs?rev=190709&view=rev
Log:
* Made InterceptorChain unnstable as we discussed before
* server.xml demonstrates how to configure interceptor chain now.
* Added InterceptorConfiguration
* Replaced StartupConfiguration.interceptors with List<InterceptorConfiguration>.



Added:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/InterceptorConfiguration.java   (with props)
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableInterceptorConfiguration.java   (with props)
Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/ConfigurationUtil.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryContext.java
    directory/apacheds/trunk/main/server.xml
    directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/ConfigurationUtil.java?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/ConfigurationUtil.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/ConfigurationUtil.java Tue Jun 14 22:15:03 2005
@@ -18,8 +18,11 @@
  */
 package org.apache.ldap.server.configuration;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import javax.naming.directory.Attributes;
@@ -41,7 +44,26 @@
     static Set getTypeSafeSet( Set set, Class type )
     {
         Set newSet = new HashSet();
-        Iterator i = set.iterator();
+        getTypeSafeCollection( set, type, newSet );
+        return newSet;
+    }
+
+    /**
+     * Checks all elements of the specified list is of the specified type,
+     * and returns cloned list.
+     * 
+     * @throws ConfigurationException if the specified set has an element of wrong type
+     */
+    static List getTypeSafeList( List list, Class type )
+    {
+        List newList = new ArrayList();
+        getTypeSafeCollection( list, type, newList );
+        return newList;
+    }
+
+    private static void getTypeSafeCollection( Collection collection, Class type, Collection newCollection )
+    {
+        Iterator i = collection.iterator();
         while( i.hasNext() )
         {
             Object e = i.next();
@@ -51,9 +73,8 @@
                         "Invalid element type: " + e.getClass() +
                         " (expected " + type );
             }
-            newSet.add( e );
+            newCollection.add( e );
         }
-        return newSet;
     }
     
     /**
@@ -64,6 +85,16 @@
         Set newSet = new HashSet();
         newSet.addAll( set );
         return newSet;
+    }
+    
+    /**
+     * Returns the clone of the specified list.
+     */
+    static List getClonedList( List list )
+    {
+        List newList = new ArrayList();
+        newList.addAll( list );
+        return newList;
     }
     
     /**

Added: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/InterceptorConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/InterceptorConfiguration.java?rev=190709&view=auto
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/InterceptorConfiguration.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/InterceptorConfiguration.java Tue Jun 14 22:15:03 2005
@@ -0,0 +1,70 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.server.configuration;
+
+import org.apache.ldap.server.interceptor.Interceptor;
+
+/**
+ * A configuration for {@link Interceptor}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class InterceptorConfiguration
+{
+    private String name;
+    private Interceptor interceptor;
+
+    protected InterceptorConfiguration()
+    {
+    }
+
+    public Interceptor getInterceptor()
+    {
+        return interceptor;
+    }
+
+    protected void setInterceptor( Interceptor authenticator )
+    {
+        this.interceptor = authenticator;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    protected void setName( String name )
+    {
+        this.name = name.trim();
+    }
+
+    public void validate()
+    {
+        if( name == null )
+        {
+            throw new ConfigurationException( "Name is not specified." );
+        }
+        
+        if( interceptor == null )
+        {
+            throw new ConfigurationException( "Authenticator is not specified." );
+        }
+    }
+}

Propchange: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/InterceptorConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableInterceptorConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableInterceptorConfiguration.java?rev=190709&view=auto
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableInterceptorConfiguration.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableInterceptorConfiguration.java Tue Jun 14 22:15:03 2005
@@ -0,0 +1,46 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.server.configuration;
+
+import org.apache.ldap.server.interceptor.Interceptor;
+
+/**
+ * A mutable version of {@link InterceptorConfiguration}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MutableInterceptorConfiguration extends
+        InterceptorConfiguration
+{
+
+    public MutableInterceptorConfiguration()
+    {
+    }
+
+    public void setInterceptor( Interceptor interceptor )
+    {
+        super.setInterceptor( interceptor );
+    }
+
+    public void setName( String name )
+    {
+        super.setName( name );
+    }
+}

Propchange: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableInterceptorConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java Tue Jun 14 22:15:03 2005
@@ -19,10 +19,9 @@
 package org.apache.ldap.server.configuration;
 
 import java.io.File;
+import java.util.List;
 import java.util.Set;
 
-import org.apache.ldap.server.interceptor.InterceptorChain;
-
 /**
  * A mutable version of {@link StartupConfiguration}.
  *
@@ -57,9 +56,9 @@
         super.setAllowAnonymousAccess( enableAnonymousAccess );
     }
 
-    public void setInterceptors( InterceptorChain interceptors )
+    public void setInterceptorConfigurations( List interceptorConfigurations )
     {
-        super.setInterceptors( interceptors );
+        super.setInterceptorConfigurations( interceptorConfigurations );
     }
 
     public void setTestEntries( Set testEntries )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java Tue Jun 14 22:15:03 2005
@@ -19,15 +19,22 @@
 package org.apache.ldap.server.configuration;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import javax.naming.directory.Attributes;
 
 import org.apache.ldap.server.authn.AnonymousAuthenticator;
+import org.apache.ldap.server.authn.AuthenticationService;
 import org.apache.ldap.server.authn.SimpleAuthenticator;
-import org.apache.ldap.server.interceptor.InterceptorChain;
+import org.apache.ldap.server.authz.AuthorizationService;
+import org.apache.ldap.server.exception.ExceptionService;
+import org.apache.ldap.server.normalization.NormalizationService;
+import org.apache.ldap.server.operational.OperationalAttributeService;
+import org.apache.ldap.server.schema.SchemaService;
 import org.apache.ldap.server.schema.bootstrap.ApacheSchema;
 import org.apache.ldap.server.schema.bootstrap.BootstrapSchema;
 import org.apache.ldap.server.schema.bootstrap.CoreSchema;
@@ -49,7 +56,7 @@
     private File workingDirectory = new File( "server-work" );
     private boolean allowAnonymousAccess = true; // allow by default
     private Set authenticatorConfigurations; // Set<AuthenticatorConfiguration>
-    private InterceptorChain interceptors = InterceptorChain.newDefaultChain();
+    private List interceptorConfigurations; // Set<InterceptorConfiguration>
     
     private Set bootstrapSchemas; // Set<BootstrapSchema>
     private Set contextPartitionConfigurations = new HashSet(); // Set<ContextPartitionConfiguration>
@@ -57,6 +64,13 @@
     
     protected StartupConfiguration()
     {
+        setDefaultAuthenticatorConfigurations();
+        setDefaultBootstrapSchemas();
+        setDefaultInterceptorConfigurations();
+    }
+
+    private void setDefaultAuthenticatorConfigurations()
+    {
         Set set; 
         
         // Set default authenticator configurations
@@ -77,7 +91,11 @@
         set.add( authCfg );
         
         setAuthenticatorConfigurations( set );
-        
+    }
+
+    private void setDefaultBootstrapSchemas()
+    {
+        Set set;
         // Set default bootstrap schemas
         set = new HashSet();
         
@@ -91,6 +109,45 @@
         setBootstrapSchemas( set );
     }
 
+    private void setDefaultInterceptorConfigurations()
+    {
+        // Set default interceptor chains
+        InterceptorConfiguration interceptorCfg;
+        List list = new ArrayList();
+        
+        interceptorCfg = new MutableInterceptorConfiguration();
+        interceptorCfg.setName( "normalizationService" );
+        interceptorCfg.setInterceptor( new NormalizationService() );
+        list.add( interceptorCfg );
+        
+        interceptorCfg = new MutableInterceptorConfiguration();
+        interceptorCfg.setName( "authenticationService" );
+        interceptorCfg.setInterceptor( new AuthenticationService() );
+        list.add( interceptorCfg );
+        
+        interceptorCfg = new MutableInterceptorConfiguration();
+        interceptorCfg.setName( "authorizationService" );
+        interceptorCfg.setInterceptor( new AuthorizationService() );
+        list.add( interceptorCfg );
+        
+        interceptorCfg = new MutableInterceptorConfiguration();
+        interceptorCfg.setName( "exceptionService" );
+        interceptorCfg.setInterceptor( new ExceptionService() );
+        list.add( interceptorCfg );
+        
+        interceptorCfg = new MutableInterceptorConfiguration();
+        interceptorCfg.setName( "schemaService" );
+        interceptorCfg.setInterceptor( new SchemaService() );
+        list.add( interceptorCfg );
+        
+        interceptorCfg = new MutableInterceptorConfiguration();
+        interceptorCfg.setName( "operationalAttributeService" );
+        interceptorCfg.setInterceptor( new OperationalAttributeService() );
+        list.add( interceptorCfg );
+        
+        setInterceptorConfigurations( list );
+    }
+
     /**
      * Returns {@link AuthenticatorConfiguration}s to use for authenticating clients.
      */
@@ -177,21 +234,26 @@
     /**
      * Returns interceptor chain.
      */
-    public InterceptorChain getInterceptors()
+    public List getInterceptorConfigurations()
     {
-        return interceptors;
+        return ConfigurationUtil.getClonedList( interceptorConfigurations );
     }
 
     /**
      * Sets interceptor chain.
      */
-    protected void setInterceptors( InterceptorChain interceptors )
+    protected void setInterceptorConfigurations( List interceptorConfigurations )
     {
-        if( interceptors == null )
+        List newList = ConfigurationUtil.getTypeSafeList(
+                interceptorConfigurations, InterceptorConfiguration.class );
+        
+        Iterator i = newList.iterator();
+        while( i.hasNext() )
         {
-            throw new ConfigurationException( "Interceptors cannot be null" );
+            ( ( InterceptorConfiguration ) i.next() ).validate();
         }
-        this.interceptors = interceptors;
+
+        this.interceptorConfigurations = interceptorConfigurations;
     }
 
     /**

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java Tue Jun 14 22:15:03 2005
@@ -84,7 +84,7 @@
  * <p/>
  * <h2>Overriding Default Interceptor Settings</h2>
  * <p/>
- * See {@link StartupConfiguration} and {@link InterceptorChain#newDefaultChain()}.
+ * See {@link StartupConfiguration}.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java Tue Jun 14 22:15:03 2005
@@ -27,13 +27,8 @@
 
 import javax.naming.NamingException;
 
-import org.apache.ldap.server.authn.AuthenticationService;
-import org.apache.ldap.server.authz.AuthorizationService;
-import org.apache.ldap.server.exception.ExceptionService;
+import org.apache.ldap.server.configuration.InterceptorConfiguration;
 import org.apache.ldap.server.invocation.Invocation;
-import org.apache.ldap.server.normalization.NormalizationService;
-import org.apache.ldap.server.operational.OperationalAttributeService;
-import org.apache.ldap.server.schema.SchemaService;
 
 
 /**
@@ -44,64 +39,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class InterceptorChain implements Interceptor
+public class InterceptorChain
 {
-    /**
-     * The name of default interceptor that passes its control to the
-     * next interceptor in parent chain.
-     */
-    public static final String NEXT_INTERCEPTOR = "nextInterceptor";
-
-
-    /**
-     * Returns a new chain of default interceptors required to run core.
-     */
-    public static InterceptorChain newDefaultChain()
-    {
-        InterceptorChain chain = new InterceptorChain();
-
-        chain.addFirst( "normalizationService", new NormalizationService() );
-
-        chain.addBefore( NEXT_INTERCEPTOR, "authenticationService", new AuthenticationService() );
-
-        chain.addBefore( NEXT_INTERCEPTOR, "authorizationService", new AuthorizationService() );
-
-        chain.addBefore( NEXT_INTERCEPTOR, "exceptionService", new ExceptionService() );
-
-        chain.addBefore( NEXT_INTERCEPTOR, "schemaService", new SchemaService() );
-
-        chain.addBefore( NEXT_INTERCEPTOR, "operationalAttributeService", new OperationalAttributeService() );
-
-        return chain;
-    }
-
-
-    private final Interceptor NEXT_INTERCEPTOR0 = new Interceptor()
-    {
-        public void init( InterceptorContext context )
-        {
-        }
-
-
-        public void destroy()
-        {
-        }
-
-
-        public void process( NextInterceptor nextInterceptor, Invocation invocation ) throws NamingException
-        {
-            if( parent != null )
-            {
-                Entry e = ( Entry ) parent.interceptor2entry.get( InterceptorChain.this );
-
-                e.nextInterceptor.process( invocation );
-            }
-
-            nextInterceptor.process( invocation );
-        }
-    };
-
-
     private final Interceptor FINAL_INTERCEPTOR = new Interceptor()
     {
         private InterceptorContext ctx;
@@ -136,21 +75,31 @@
 
     private final Map interceptor2entry = new IdentityHashMap();
 
-    private Entry head = new Entry( null, null, NEXT_INTERCEPTOR, NEXT_INTERCEPTOR0 );
-
     private final Entry tail = new Entry( null, null, "end", FINAL_INTERCEPTOR );
 
+    private Entry head = tail;
+
 
     /**
      * Create a new interceptor chain.
      */
     public InterceptorChain()
     {
-        head.nextEntry = tail;
-
-        tail.prevEntry = head;
-
-        register( NEXT_INTERCEPTOR, head );
+        this( new ArrayList() );
+    }
+    
+    /**
+     * Creates a new interceptor chain 
+     * @param configurations
+     */
+    public InterceptorChain( List configurations )
+    {
+        Iterator it = configurations.iterator();
+        while( it.hasNext() )
+        {
+            InterceptorConfiguration cfg = ( InterceptorConfiguration ) it.next();
+            this.addLast( cfg.getName(), cfg.getInterceptor() );
+        }
     }
 
 
@@ -247,14 +196,7 @@
                                        Interceptor interceptor )
     {
         checkAddable( name, interceptor );
-
-        Entry newEntry = new Entry( null, head, name, interceptor );
-
-        head.prevEntry = newEntry;
-
-        head = newEntry;
-
-        register( name, newEntry );
+        register( name, interceptor, head );
     }
 
 
@@ -265,21 +207,7 @@
                                       Interceptor interceptor )
     {
         checkAddable( name, interceptor );
-
-        Entry newEntry = new Entry( tail.prevEntry, tail, name, interceptor );
-
-        if ( tail.prevEntry != null )
-        {
-            tail.prevEntry.nextEntry = newEntry;
-        }
-        else
-        {
-            head = newEntry;
-        }
-
-        tail.prevEntry = newEntry;
-
-        register( name, newEntry );
+        register( name, interceptor, tail );
     }
 
 
@@ -290,28 +218,8 @@
     public synchronized void addBefore( String baseName, String name, Interceptor interceptor )
     {
         Entry baseEntry = checkOldName( baseName );
-
         checkAddable( name, interceptor );
-
-        Entry prevEntry = baseEntry.prevEntry;
-
-        Entry newEntry = new Entry( prevEntry, baseEntry, name, interceptor );
-
-        if ( prevEntry == null )
-        {
-            baseEntry.prevEntry = newEntry;
-
-            head = newEntry;
-            
-        }
-        else
-        {
-            baseEntry.prevEntry = newEntry;
-
-            prevEntry.nextEntry = newEntry;
-        }
-
-        register( name, newEntry );
+        register( name, interceptor, baseEntry );
     }
 
 
@@ -322,23 +230,8 @@
     public synchronized void addAfter( String baseName, String name, Interceptor interceptor )
     {
         Entry baseEntry = checkOldName( baseName );
-
         checkAddable( name, interceptor );
-
-        Entry nextEntry = baseEntry.nextEntry;
-
-        Entry newEntry = new Entry( baseEntry, nextEntry, name, interceptor );
-
-        if ( nextEntry == null )
-        {
-            throw new IllegalStateException();
-        }
-
-        nextEntry.prevEntry.nextEntry = newEntry;
-
-        nextEntry.prevEntry = newEntry;
-
-        register( name, newEntry );
+        register( name, interceptor, baseEntry );
     }
 
 
@@ -393,18 +286,30 @@
     }
 
 
-    private void register( String name, Entry newEntry )
+    private void register( String name, Interceptor interceptor, Entry nextEntry )
     {
-        Interceptor interceptor = newEntry.interceptor;
-
-        name2entry.put( name, newEntry );
-
-        interceptor2entry.put( newEntry.interceptor, newEntry );
-
-        if ( interceptor instanceof InterceptorChain )
+        Entry newEntry;
+        if( nextEntry == head )
+        {
+            newEntry = new Entry( null, head, name, interceptor );
+            head.prevEntry = newEntry;
+            head = newEntry;
+        }
+        else if( head == tail )
+        {
+            newEntry = new Entry( null, tail, name, interceptor );
+            tail.prevEntry = newEntry;
+            head = newEntry;
+        }
+        else
         {
-            ( ( InterceptorChain ) interceptor ).parent = this;
+            newEntry = new Entry( nextEntry.prevEntry, nextEntry, name, interceptor );
+            nextEntry.prevEntry.nextEntry = newEntry;
+            nextEntry.prevEntry = newEntry;
         }
+        
+        name2entry.put( name, newEntry );
+        interceptor2entry.put( newEntry.interceptor, newEntry );
     }
 
 
@@ -451,7 +356,7 @@
      *
      * @throws NamingException if invocation failed
      */
-    public void process( NextInterceptor nextInterceptor, Invocation invocation ) throws NamingException
+    public void process( Invocation invocation ) throws NamingException
     {
         Entry head = this.head;
 
@@ -522,8 +427,6 @@
 
         private Entry nextEntry;
 
-        private final String name;
-
         private final Interceptor interceptor;
 
         private final NextInterceptor nextInterceptor;
@@ -544,8 +447,6 @@
             this.prevEntry = prevEntry;
 
             this.nextEntry = nextEntry;
-
-            this.name = name;
 
             this.interceptor = interceptor;
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryContext.java?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryContext.java Tue Jun 14 22:15:03 2005
@@ -286,7 +286,7 @@
             throw new IllegalStateException( "ApacheDS is not started yet." );
         }
         
-        interceptorChain.process( null, call );
+        interceptorChain.process( call );
         return call.getReturnValue();
     }
 
@@ -495,7 +495,6 @@
         loader.load( configuration.getBootstrapSchemas(), bootstrapRegistries );
 
         java.util.List errors = bootstrapRegistries.checkRefInteg();
-
         if ( !errors.isEmpty() )
         {
             NamingException e = new NamingException();
@@ -535,7 +534,8 @@
         systemPartition = new SystemPartition( db, eng, attributes );
         globalRegistries = new GlobalRegistries( systemPartition, bootstrapRegistries );
         rootNexus = new RootNexus( systemPartition, new LockableAttributesImpl() );
-        interceptorChain = configuration.getInterceptors();
+        
+        interceptorChain = new InterceptorChain( configuration.getInterceptorConfigurations() );
         interceptorChain.init( new InterceptorContext( configuration, systemPartition, globalRegistries, rootNexus ) );
 
         // fire up the app partitions now!

Modified: directory/apacheds/trunk/main/server.xml
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/server.xml?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/main/server.xml (original)
+++ directory/apacheds/trunk/main/server.xml Tue Jun 14 22:15:03 2005
@@ -41,6 +41,47 @@
         <bean class="org.apache.ldap.server.schema.bootstrap.SystemSchema"/>
       </set>
     </property>
+    
+    <property name="interceptorConfigurations">
+      <list>
+        <bean class="org.apache.ldap.server.configuration.MutableInterceptorConfiguration">
+          <property name="name"><value>normalizationService</value></property>
+          <property name="interceptor">
+            <bean class="org.apache.ldap.server.normalization.NormalizationService" />
+          </property>
+        </bean>
+        <bean class="org.apache.ldap.server.configuration.MutableInterceptorConfiguration">
+          <property name="name"><value>authenticationService</value></property>
+          <property name="interceptor">
+            <bean class="org.apache.ldap.server.authn.AuthenticationService" />
+          </property>
+        </bean>
+        <bean class="org.apache.ldap.server.configuration.MutableInterceptorConfiguration">
+          <property name="name"><value>authorizationService</value></property>
+          <property name="interceptor">
+            <bean class="org.apache.ldap.server.authz.AuthorizationService" />
+          </property>
+        </bean>
+        <bean class="org.apache.ldap.server.configuration.MutableInterceptorConfiguration">
+          <property name="name"><value>exceptionService</value></property>
+          <property name="interceptor">
+            <bean class="org.apache.ldap.server.exception.ExceptionService" />
+          </property>
+        </bean>
+        <bean class="org.apache.ldap.server.configuration.MutableInterceptorConfiguration">
+          <property name="name"><value>schemaService</value></property>
+          <property name="interceptor">
+            <bean class="org.apache.ldap.server.schema.SchemaService" />
+          </property>
+        </bean>
+        <bean class="org.apache.ldap.server.configuration.MutableInterceptorConfiguration">
+          <property name="name"><value>operationalAttributeService</value></property>
+          <property name="interceptor">
+            <bean class="org.apache.ldap.server.operational.OperationalAttributeService" />
+          </property>
+        </bean>
+      </list>
+    </property>
   </bean>
   
   <bean id="apachePartitionConfiguration" class="org.apache.ldap.server.configuration.MutableContextPartitionConfiguration">

Modified: directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java?rev=190709&r1=190708&r2=190709&view=diff
==============================================================================
--- directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java (original)
+++ directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java Tue Jun 14 22:15:03 2005
@@ -19,9 +19,9 @@
 package org.apache.ldap.server.configuration;
 
 import java.io.File;
+import java.util.List;
 import java.util.Set;
 
-import org.apache.ldap.server.interceptor.InterceptorChain;
 import org.apache.mina.registry.ServiceRegistry;
 
 /**
@@ -60,9 +60,9 @@
         super.setContextPartitionConfigurations( arg0 );
     }
 
-    public void setInterceptors( InterceptorChain arg0 )
+    public void setInterceptorConfigurations( List arg0 )
     {
-        super.setInterceptors( arg0 );
+        super.setInterceptorConfigurations( arg0 );
     }
 
     public void setTestEntries( Set arg0 )