directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r159316 - in directory/apacheds/trunk/core/src: main/java/org/apache/ldap/server/interceptor/ main/java/org/apache/ldap/server/invocation/ main/java/org/apache/ldap/server/jndi/ main/java/org/apache/ldap/server/normalization/ test/org/apache/ldap/server/interceptor/
Date Mon, 28 Mar 2005 22:20:15 GMT
Author: akarasulu
Date: Mon Mar 28 14:20:10 2005
New Revision: 159316

URL: http://svn.apache.org/viewcvs?view=rev&rev=159316
Log:
changes ...

 o added normalization service
 o had to add setters for names of various invocation objects so normalizer can
   alter the name used to make the call - I wonder how trustin got around this
 o took care of some formating


Added:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java
Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.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/interceptor/InterceptorConfigBuilder.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorException.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/NextInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Add.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Delete.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetMatchedDN.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetSuffix.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/HasEntry.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/IsSuffix.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/List.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Lookup.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/LookupWithAttrIds.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Modify.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyMany.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyRN.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Move.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/MoveAndModifyRN.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Search.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java
    directory/apacheds/trunk/core/src/test/org/apache/ldap/server/interceptor/ConfigurationTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java Mon Mar 28 14:20:10 2005
@@ -25,12 +25,13 @@
 
 
 /**
- * A easy-to-use implementation of {@link Interceptor} that demultiplexes invocations using method signature
- * overloading.
+ * A easy-to-use implementation of {@link Interceptor} that demultiplexes invocations
+ * using method signature overloading.
  * <p/>
- * This {@link Interceptor} forwards received process requests to an appropriate <code>process(NextInterceptor,
- * <em>ConcreteInvocation</em>)</code> methods.  Users can override any <code>process(..)</code> methods that
- * corresponds to {@link Invocation} types that he or she wants to filter.
+ * This {@link Interceptor} forwards received process requests to an appropriate
+ * <code>process(NextInterceptor, <em>ConcreteInvocation</em>)</code> methods.  Users
+ * can override any <code>process(..)</code> methods that correspond to
+ * {@link Invocation} types that he or she wants to filter.
  * <p/>
  * For example, if user wants to filter {@link Add} invocation:
  * <pre>
@@ -43,7 +44,8 @@
  *     }
  * }
  * </pre>
- * <code>BaseInterceptor</code> handles all long and tedious if-elseif blocks behind the scene.
+ * <code>BaseInterceptor</code> handles all long and tedious if-elseif blocks behind the
+ * scenes.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -66,6 +68,7 @@
     {
     }
 
+
     // ------------------------------------------------------------------------
     // Interceptor's Invoke Method
     // ------------------------------------------------------------------------
@@ -147,117 +150,103 @@
         }
     }
 
+
     // ------------------------------------------------------------------------
     // Invocation Analogs
     // ------------------------------------------------------------------------
 
-    protected void process( NextInterceptor nextInterceptor, Add call )
-            throws NamingException
+
+    protected void process( NextInterceptor nextInterceptor, Add call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, Delete call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, Delete call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, GetMatchedDN call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, GetMatchedDN call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, GetSuffix call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, GetSuffix call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, HasEntry call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, HasEntry call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, IsSuffix call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, IsSuffix call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, List call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, List call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, ListSuffixes call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, ListSuffixes call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, Lookup call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, Lookup call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, LookupWithAttrIds call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, LookupWithAttrIds call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, Modify call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, Modify call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, ModifyMany call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, ModifyMany call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, ModifyRN call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, ModifyRN call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, Move call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, Move call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, MoveAndModifyRN call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, MoveAndModifyRN call ) throws NamingException
     {
         nextInterceptor.process( call );
     }
 
 
-    protected void process( NextInterceptor nextInterceptor, Search call )
-            throws NamingException
+    protected void process( NextInterceptor nextInterceptor, Search call ) throws NamingException
     {
         nextInterceptor.process( call );
     }

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?view=diff&r1=159315&r2=159316
==============================================================================
--- 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 Mon Mar 28 14:20:10 2005
@@ -24,15 +24,15 @@
 
 
 /**
- * Filters any directory operations.  You can filter any {@link Invocation}s
+ * Filters any directory operations.  You can filter any {@link Invocation}
  * performed on {@link BackingStore}s just like Servlet filters do.
  * <p/>
  * <h2>Interceptor Chaining</h2> Interceptors should usually pass the control
  * of current invocation to the next interceptor by calling
  * {@link NextInterceptor#process(Invocation)}. The flow control is returned
  * when the next interceptor's {@link Interceptor#process(NextInterceptor, Invocation)}
- * returns. You can therefore implement pre-, post-, around- invocation
- * handler by how you place the statement.
+ * returns. You can therefore implement pre-, post-, around- invocation handler
+ * by how you place the statement.
  * <p/>
  * <h3>Pre-invocation Filtering</h3>
  * <pre>
@@ -74,10 +74,12 @@
  * When you create an implementation of Interceptor, you have to follow the
  * basic class naming convention to avoid others' confusion:
  * <ul>
- *  <li>Class name must be an agent noun or end with '<code>Interceptor</code>'.</li>
+ *  <li>Class name must be an agent noun or end with <code>Interceptor</code> or
+ * <code>Service</code>.</li>
  * </ul>
- * Plus, placing your interceptor implementations to packages like
- * '<code>interceptor</code>' would be the best practice.
+ * Plus, placing your interceptor implementations into relavent packages like
+ * <code>interceptor</code> or ones that reflect its purpose would be a good
+ * practice.
  * <p/>
  * <h2>Overriding Default Interceptor Settings</h2>
  * <p/>
@@ -116,6 +118,5 @@
      * @param invocation      the invocation to process
      * @throws NamingException on failures while handling the invocation
      */
-    void process( NextInterceptor nextInterceptor, Invocation invocation )
-            throws NamingException;
+    void process( NextInterceptor nextInterceptor, Invocation invocation ) throws NamingException;
 }

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?view=diff&r1=159315&r2=159316
==============================================================================
--- 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 Mon Mar 28 14:20:10 2005
@@ -23,6 +23,7 @@
 import org.apache.ldap.server.schema.SchemaService;
 import org.apache.ldap.server.operational.OperationalAttributeService;
 import org.apache.ldap.server.exception.ExceptionService;
+import org.apache.ldap.server.normalization.NormalizationService;
 
 import javax.naming.NamingException;
 import java.util.*;
@@ -55,35 +56,49 @@
     public static InterceptorChain newDefaultChain()
     {
         InterceptorChain chain = new InterceptorChain();
-        chain.addBefore( NEXT_INTERCEPTOR, "authenticator", new AuthenticationService() );
-        chain.addBefore( NEXT_INTERCEPTOR, "authorizer", new AuthorizationService() );
-        chain.addBefore( NEXT_INTERCEPTOR, "validator", new ExceptionService() );
-        chain.addBefore( NEXT_INTERCEPTOR, "schemaManager", new SchemaService() );
-        chain.addBefore( NEXT_INTERCEPTOR, "operationalAttributeInterceptor", new OperationalAttributeService() );
+
+        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;
@@ -101,13 +116,12 @@
         }
 
 
-        public void process( NextInterceptor nextInterceptor, Invocation call )
-                throws NamingException
+        public void process( NextInterceptor nextInterceptor, Invocation call ) throws NamingException
         {
             if ( parent == null )
             {
-                // execute the actual backend operation only when this chain
-                // is root.
+                // execute the actual backend operation only when this chain is root.
+
                 call.execute( ctx.getRootNexus() );
             }
         }
@@ -130,26 +144,34 @@
     public InterceptorChain()
     {
         head.nextEntry = tail;
+
         tail.prevEntry = head;
+
         register( NEXT_INTERCEPTOR, head );
     }
 
+
     /**
      * Initializes all interceptors this chain contains.
      */
     public synchronized void init( InterceptorContext ctx ) throws NamingException
     {
         ListIterator it = getAll().listIterator();
+
         Interceptor interceptor = null;
+
         try
         {
             while ( it.hasNext() )
             {
                 interceptor = ( Interceptor ) it.next();
+
                 String name = getName( interceptor );
-                InterceptorContext newCtx = new InterceptorContext( ctx.getEnvironment(), ctx.getSystemPartition(),
-                        ctx.getGlobalRegistries(), ctx.getRootNexus(),
-                        InterceptorConfigBuilder.build( ctx.getConfig(), ( name == null ) ? "" : name ) );
+
+                Map config = InterceptorConfigBuilder.build( ctx.getConfig(), ( name == null ) ? "" : name );
+
+                InterceptorContext newCtx = new InterceptorContext( ctx.getEnvironment(),
+                        ctx.getSystemPartition(), ctx.getGlobalRegistries(), ctx.getRootNexus(), config );
 
                 interceptor.init( newCtx );
             }
@@ -159,6 +181,7 @@
             while ( it.hasPrevious() )
             {
                 Interceptor i = ( Interceptor ) it.previous();
+
                 try
                 {
                     i.destroy();
@@ -175,8 +198,7 @@
             }
             else
             {
-                throw new InterceptorException( interceptor, null,
-                        "Failed to initialize interceptor chain.", t );
+                throw new InterceptorException( interceptor, null, "Failed to initialize interceptor chain.", t );
             }
         }
     }
@@ -188,9 +210,11 @@
     public synchronized void destroy()
     {
         ListIterator it = getAllReversed().listIterator();
+
         while ( it.hasNext() )
         {
             Interceptor interceptor = ( Interceptor ) it.next();
+
             try
             {
                 interceptor.destroy();
@@ -211,10 +235,12 @@
     public Interceptor get( String name )
     {
         Entry e = ( Entry ) name2entry.get( name );
+
         if ( e == null )
         {
             return null;
         }
+
         return e.interceptor;
     }
 
@@ -222,10 +248,12 @@
     private String getName( Interceptor interceptor )
     {
         Entry e = ( Entry ) interceptor2entry.get( interceptor );
+
         if ( e == null )
         {
             return null;
         }
+
         return e.name;
     }
 
@@ -239,7 +267,9 @@
         checkAddable( name, interceptor );
 
         Entry newEntry = new Entry( null, head, name, interceptor );
+
         head.prevEntry = newEntry;
+
         head = newEntry;
 
         register( name, newEntry );
@@ -255,6 +285,7 @@
         checkAddable( name, interceptor );
 
         Entry newEntry = new Entry( tail.prevEntry, tail, name, interceptor );
+
         if ( tail.prevEntry != null )
         {
             tail.prevEntry.nextEntry = newEntry;
@@ -263,6 +294,7 @@
         {
             head = newEntry;
         }
+
         tail.prevEntry = newEntry;
 
         register( name, newEntry );
@@ -273,24 +305,27 @@
      * Adds the specified interceptor with the specified name just before the interceptor whose name is
      * <code>baseName</code> in this chain.
      */
-    public synchronized void addBefore( String baseName,
-                                        String name,
-                                        Interceptor interceptor )
+    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;
         }
 
@@ -302,22 +337,25 @@
      * Adds the specified interceptor with the specified name just after the interceptor whose name is
      * <code>baseName</code> in this chain.
      */
-    public synchronized void addAfter( String baseName,
-                                       String name,
-                                       Interceptor interceptor )
+    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 );
     }
 
@@ -328,22 +366,30 @@
     public synchronized void remove( String name )
     {
         Entry entry = checkOldName( name );
+
         Entry prevEntry = entry.prevEntry;
+
         Entry nextEntry = entry.nextEntry;
+
         if ( prevEntry == null )
         {
             nextEntry.prevEntry = null;
+
             head = entry;
         }
         else
         {
             prevEntry.nextEntry = nextEntry;
+
             nextEntry.prevEntry = prevEntry;
         }
 
         name2entry.remove( name );
+
         Interceptor interceptor = entry.interceptor;
+
         interceptor2entry.remove( interceptor );
+
         if ( interceptor instanceof InterceptorChain )
         {
             ( ( InterceptorChain ) interceptor ).parent = null;
@@ -357,6 +403,7 @@
     public synchronized void clear()
     {
         Iterator it = new ArrayList( name2entry.keySet() ).iterator();
+
         while ( it.hasNext() )
         {
             this.remove( ( String ) it.next() );
@@ -367,8 +414,11 @@
     private void register( String name, Entry newEntry )
     {
         Interceptor interceptor = newEntry.interceptor;
+
         name2entry.put( name, newEntry );
+
         interceptor2entry.put( newEntry.interceptor, newEntry );
+
         if ( interceptor instanceof InterceptorChain )
         {
             ( ( InterceptorChain ) interceptor ).parent = this;
@@ -384,11 +434,12 @@
     private Entry checkOldName( String baseName )
     {
         Entry e = ( Entry ) name2entry.get( baseName );
+
         if ( e == null )
         {
-            throw new IllegalArgumentException( "Unknown interceptor name:" +
-                    baseName );
+            throw new IllegalArgumentException( "Unknown interceptor name:" + baseName );
         }
+
         return e;
     }
 
@@ -421,6 +472,7 @@
     public void process( NextInterceptor nextInterceptor, Invocation invocation ) throws NamingException
     {
         Entry head = this.head;
+
         try
         {
             head.interceptor.process( head.nextInterceptor, invocation );
@@ -431,8 +483,7 @@
         }
         catch ( Throwable e )
         {
-            throw new InterceptorException( head.interceptor, invocation,
-                    "Unexpected exception.", e );
+            throw new InterceptorException( head.interceptor, invocation, "Unexpected exception.", e );
         }
     }
 
@@ -443,10 +494,13 @@
     public List getAll()
     {
         List list = new ArrayList();
+
         Entry e = head;
+
         do
         {
             list.add( e.interceptor );
+
             e = e.nextEntry;
         }
         while ( e != null );
@@ -461,12 +515,16 @@
     public List getAllReversed()
     {
         List list = new ArrayList();
+
         Entry e = tail;
+
         do
         {
             list.add( e.interceptor );
+
             e = e.prevEntry;
         }
+
         while ( e != null );
 
         return list;
@@ -502,15 +560,19 @@
             }
 
             this.prevEntry = prevEntry;
+
             this.nextEntry = nextEntry;
+
             this.name = name;
+
             this.interceptor = interceptor;
+
             this.nextInterceptor = new NextInterceptor()
             {
-                public void process( Invocation call )
-                        throws NamingException
+                public void process( Invocation call ) throws NamingException
                 {
                     Interceptor interceptor = Entry.this.nextEntry.interceptor;
+
                     try
                     {
                         interceptor.process( Entry.this.nextEntry.nextInterceptor, call );
@@ -521,8 +583,7 @@
                     }
                     catch ( Throwable e )
                     {
-                        throw new InterceptorException( interceptor, call,
-                                "Unexpected exception.", e );
+                        throw new InterceptorException( interceptor, call, "Unexpected exception.", e );
                     }
                 }
             };

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorConfigBuilder.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorConfigBuilder.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorConfigBuilder.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorConfigBuilder.java Mon Mar 28 14:20:10 2005
@@ -18,18 +18,24 @@
     public static Map build( Map map, String prefix )
     {
         Map newMap = new HashMap();
+
         Iterator it = map.entrySet().iterator();
+
         while ( it.hasNext() )
         {
             Map.Entry e = ( Map.Entry ) it.next();
+
             String key = e.getKey().toString();
+
             if ( key.startsWith( prefix ) && key.length() > prefix.length() )
             {
                 key = key.substring( prefix.length() );
+
                 if ( key.indexOf( '#' ) < 0 )
                 {
                     continue;
                 }
+
                 if ( key.charAt( 0 ) == '.' || key.charAt( 0 ) == '#' )
                 {
                     key = key.substring( 1 );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorContext.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorContext.java Mon Mar 28 14:20:10 2005
@@ -49,9 +49,13 @@
                                Map config )
     {
         this.environment = environment;
+
         this.systemPartition = systemPartition;
+
         this.globalRegistries = globalRegistries;
+
         this.rootNexus = rootNexus;
+
         this.config = config;
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorException.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorException.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorException.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorException.java Mon Mar 28 14:20:10 2005
@@ -53,7 +53,9 @@
     public InterceptorException( Interceptor interceptor, Invocation invocation )
     {
         super( ResultCodeEnum.OTHER );
+
         this.invocation = invocation;
+
         this.interceptor = interceptor;
     }
 
@@ -65,11 +67,12 @@
      * @param invocation  the Invocation the Interceptor failed on
      * @param explanation String explanation of why the Interceptor failed
      */
-    public InterceptorException( Interceptor interceptor,
-                                 Invocation invocation, String explanation )
+    public InterceptorException( Interceptor interceptor, Invocation invocation, String explanation )
     {
         super( explanation, ResultCodeEnum.OTHER );
+
         this.invocation = invocation;
+
         this.interceptor = interceptor;
     }
 
@@ -81,10 +84,10 @@
      * @param invocation  the Invocation the Interceptor failed on
      * @param rootCause   the root cause of this exception
      */
-    public InterceptorException( Interceptor interceptor,
-                                 Invocation invocation, Throwable rootCause )
+    public InterceptorException( Interceptor interceptor, Invocation invocation, Throwable rootCause )
     {
         this( interceptor, invocation );
+
         super.setRootCause( rootCause );
     }
 
@@ -97,12 +100,11 @@
      * @param explanation String explanation of why the Interceptor failed
      * @param rootCause   the root cause of this exception
      */
-    public InterceptorException( Interceptor interceptor,
-                                 Invocation invocation,
-                                 String explanation,
+    public InterceptorException( Interceptor interceptor, Invocation invocation, String explanation,
                                  Throwable rootCause )
     {
         this( interceptor, invocation, explanation );
+
         super.setRootCause( rootCause );
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/NextInterceptor.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/NextInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/NextInterceptor.java Mon Mar 28 14:20:10 2005
@@ -33,7 +33,8 @@
 public interface NextInterceptor
 {
     /**
-     * Passes the control of current invocation to the next {@link org.apache.ldap.server.interceptor.Interceptor} in the {@link org.apache.ldap.server.interceptor.InterceptorChain}.
+     * Passes the control of current invocation to the next {@link org.apache.ldap.server.interceptor.Interceptor} in
+     * the {@link org.apache.ldap.server.interceptor.InterceptorChain}.
      *
      * @param incovation
      * @throws NamingException

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Add.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Add.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Add.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Add.java Mon Mar 28 14:20:10 2005
@@ -35,7 +35,7 @@
 
     private final String userProvidedName;
 
-    private final Name normalizedName;
+    private Name normalizedName;
 
     private final Attributes attributes;
 
@@ -58,7 +58,9 @@
         }
 
         this.userProvidedName = userProvidedName;
+
         this.normalizedName = normalizedName;
+
         this.attributes = attributes;
     }
 
@@ -75,6 +77,12 @@
     }
 
 
+    public void setNormalizedName( Name normalizedName )
+    {
+        this.normalizedName = normalizedName;
+    }
+
+
     public String getUserProvidedName()
     {
         return userProvidedName;
@@ -84,6 +92,7 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         store.add( userProvidedName, normalizedName, attributes );
+
         return null;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Delete.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Delete.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Delete.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Delete.java Mon Mar 28 14:20:10 2005
@@ -32,7 +32,7 @@
 public class Delete extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
 
     public Delete( Name name )
@@ -55,6 +55,13 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         store.delete( name );
+
         return null;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetMatchedDN.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetMatchedDN.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetMatchedDN.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetMatchedDN.java Mon Mar 28 14:20:10 2005
@@ -33,7 +33,7 @@
 public class GetMatchedDN extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
     private final boolean normalized;
 
@@ -46,6 +46,7 @@
         }
 
         this.name = name;
+
         this.normalized = normalized;
     }
 
@@ -65,5 +66,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return ( ( PartitionNexus ) store ).getMatchedDn( name, normalized );
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetSuffix.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetSuffix.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetSuffix.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/GetSuffix.java Mon Mar 28 14:20:10 2005
@@ -33,7 +33,7 @@
 public class GetSuffix extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
     private final boolean normalized;
 
@@ -46,6 +46,7 @@
         }
 
         this.name = name;
+
         this.normalized = normalized;
     }
 
@@ -65,5 +66,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return ( ( ContextPartition ) store ).getSuffix( normalized );
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/HasEntry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/HasEntry.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/HasEntry.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/HasEntry.java Mon Mar 28 14:20:10 2005
@@ -32,7 +32,7 @@
 public class HasEntry extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
 
     public HasEntry( Name name )
@@ -55,5 +55,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return store.hasEntry( name ) ? Boolean.TRUE : Boolean.FALSE;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/IsSuffix.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/IsSuffix.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/IsSuffix.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/IsSuffix.java Mon Mar 28 14:20:10 2005
@@ -32,7 +32,7 @@
 public class IsSuffix extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
 
     public IsSuffix( Name name )
@@ -55,5 +55,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return store.isSuffix( name ) ? Boolean.TRUE : Boolean.FALSE;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/List.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/List.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/List.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/List.java Mon Mar 28 14:20:10 2005
@@ -32,7 +32,7 @@
 public class List extends Invocation
 {
 
-    private final Name baseName;
+    private Name baseName;
 
 
     public List( Name baseName )
@@ -55,5 +55,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return store.list( baseName );
+    }
+
+
+    public void setBaseName( Name baseName )
+    {
+        this.baseName = baseName;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Lookup.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Lookup.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Lookup.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Lookup.java Mon Mar 28 14:20:10 2005
@@ -32,7 +32,7 @@
 public class Lookup extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
 
     public Lookup( Name name )
@@ -55,5 +55,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return store.lookup( name );
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/LookupWithAttrIds.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/LookupWithAttrIds.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/LookupWithAttrIds.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/LookupWithAttrIds.java Mon Mar 28 14:20:10 2005
@@ -32,7 +32,7 @@
 public class LookupWithAttrIds extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
     private final String[] attributeIds;
 
@@ -44,6 +44,7 @@
             throw new NullPointerException( "name" );
         }
         this.name = name;
+
         this.attributeIds = attributeIds;
     }
 
@@ -63,5 +64,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return store.lookup( name, attributeIds );
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Modify.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Modify.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Modify.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Modify.java Mon Mar 28 14:20:10 2005
@@ -33,7 +33,7 @@
 public class Modify extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
     private final int modOp;
 
@@ -48,7 +48,9 @@
         }
 
         this.name = name;
+
         this.modOp = modOp;
+
         this.attributes = attributes;
     }
 
@@ -74,6 +76,13 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         store.modify( name, modOp, attributes );
+
         return null;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyMany.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyMany.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyMany.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyMany.java Mon Mar 28 14:20:10 2005
@@ -33,7 +33,7 @@
 public class ModifyMany extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
     private final ModificationItem[] modificationItems;
 
@@ -50,6 +50,7 @@
         }
 
         this.name = name;
+
         this.modificationItems = modificationItems;
     }
 
@@ -69,6 +70,13 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         store.modify( name, modificationItems );
+
         return null;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyRN.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyRN.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyRN.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/ModifyRN.java Mon Mar 28 14:20:10 2005
@@ -32,7 +32,7 @@
 public class ModifyRN extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
     private final String newRelativeName;
 
@@ -53,7 +53,9 @@
         }
 
         this.name = name;
+
         this.newRelativeName = newRelativeName;
+
         this.deleteOldName = deleteOldName;
     }
 
@@ -79,6 +81,13 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         store.modifyRn( name, newRelativeName, deleteOldName );
+
         return null;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Move.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Move.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Move.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Move.java Mon Mar 28 14:20:10 2005
@@ -32,9 +32,9 @@
 public class Move extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
-    private final Name newParentName;
+    private Name newParentName;
 
 
     public Move( Name name, Name newParentName )
@@ -50,6 +50,7 @@
         }
 
         this.name = name;
+
         this.newParentName = newParentName;
     }
 
@@ -69,6 +70,19 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         store.move( name, newParentName );
+
         return null;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
+    }
+
+
+    public void setNewParentName( Name newParentName )
+    {
+        this.newParentName = newParentName;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/MoveAndModifyRN.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/MoveAndModifyRN.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/MoveAndModifyRN.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/MoveAndModifyRN.java Mon Mar 28 14:20:10 2005
@@ -32,9 +32,9 @@
 public class MoveAndModifyRN extends Invocation
 {
 
-    private final Name name;
+    private Name name;
 
-    private final Name newParentName;
+    private Name newParentName;
 
     private final String newRelativeName;
 
@@ -58,8 +58,11 @@
         }
 
         this.name = name;
+
         this.newParentName = newParentName;
+
         this.newRelativeName = newRelativeName;
+
         this.deleteOldName = deleteOldName;
     }
 
@@ -91,6 +94,19 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         store.move( name, newParentName, newRelativeName, deleteOldName );
+
         return null;
+    }
+
+
+    public void setName( Name name )
+    {
+        this.name = name;
+    }
+
+
+    public void setNewParentName( Name newParentName )
+    {
+        this.newParentName = newParentName;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Search.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Search.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Search.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/invocation/Search.java Mon Mar 28 14:20:10 2005
@@ -35,7 +35,7 @@
 public class Search extends Invocation
 {
 
-    private final Name baseName;
+    private Name baseName;
 
     private final Map environment;
 
@@ -65,8 +65,11 @@
         }
 
         this.baseName = baseName;
+
         this.environment = environment;
+
         this.filter = filters;
+
         this.controls = controls;
     }
 
@@ -98,5 +101,11 @@
     protected Object doExecute( BackingStore store ) throws NamingException
     {
         return store.search( baseName, environment, filter, controls );
+    }
+
+
+    public void setBaseName( Name baseName )
+    {
+        this.baseName = baseName;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java Mon Mar 28 14:20:10 2005
@@ -481,15 +481,18 @@
         // --------------------------------------------------------------------
         // Adding interceptors
         // --------------------------------------------------------------------
-        InterceptorChain interceptor = (InterceptorChain) initialEnv.get( EnvKeys.INTERCEPTORS );
-        if( interceptor == null ) {
+        InterceptorChain interceptor = ( InterceptorChain ) initialEnv.get( EnvKeys.INTERCEPTORS );
+
+        if( interceptor == null )
+        {
             // If custom interceptor is not specified, use defaule one.
+
             interceptor = InterceptorChain.newDefaultChain();
         }
 
-        interceptor.init( new InterceptorContext(
-                initialEnv, system, globalRegistries, nexus,
+        interceptor.init( new InterceptorContext( initialEnv, system, globalRegistries, nexus,
                 InterceptorConfigBuilder.build( initialEnv, EnvKeys.INTERCEPTORS ) ) );
+
         provider.setInterceptor( interceptor );
 
         // fire up the app partitions now!

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java Mon Mar 28 14:20:10 2005
@@ -39,21 +39,30 @@
     // Properties for setting working directory, schemas and allowing anon binds
     // ------------------------------------------------------------------------
 
+    //    Not enabled anywhere but in the protocol client at the time being ...
+    //    public static final String ICF_INSTANCE = "server.use.factory.instance";
+
     /** bootstrap prop: path to eve's working directory - relative or absolute */
     public static final String WKDIR = "server.wkdir";
+
     /** a comma separated list of schema class files to load */
     public static final String SCHEMAS = "server.schemas";
+
     /** bootstrap prop: if key is present it enables anonymous users */
     public static final String DISABLE_ANONYMOUS = "server.disable.anonymous";
+
     /** a comma separated list of authenticator names */
     public static final String AUTHENTICATORS = "server.authenticators";
+
     /** the envprop key base to the authenticator implementation class */
     public static final String AUTHENTICATOR_CLASS = "server.authenticator.class.";
+
     /** the envprop key base to the properties of an authenticator */
     public static final String AUTHENTICATOR_PROPERTIES = "server.authenticator.properties.";
 
     /**
-     * bootstrap property: {@link Interceptor} or {@link InterceptorChain}
+     * Bootstrap property: {@link org.apache.ldap.server.interceptor.Interceptor} or
+     * {@link org.apache.ldap.server.interceptor.InterceptorChain}
      * that will intercept directory operations when they are invoked.  You
      * don't need to specify this property if you want to use the default
      * interceptor chain.  If you specify this property, you might have to

Added: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java?view=auto&rev=159316
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java Mon Mar 28 14:20:10 2005
@@ -0,0 +1,275 @@
+/*
+ *   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.normalization;
+
+
+import org.apache.ldap.server.interceptor.BaseInterceptor;
+import org.apache.ldap.server.interceptor.InterceptorContext;
+import org.apache.ldap.server.interceptor.NextInterceptor;
+import org.apache.ldap.server.invocation.*;
+import org.apache.ldap.server.schema.AttributeTypeRegistry;
+import org.apache.ldap.common.name.NameComponentNormalizer;
+import org.apache.ldap.common.name.DnParser;
+import org.apache.ldap.common.schema.AttributeType;
+
+import javax.naming.NamingException;
+
+
+/**
+ * A name normalization service.  This service makes sure all relative and distinuished
+ * names are normalized before calls are made against the respective interface methods
+ * on the root nexus.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NormalizationService extends BaseInterceptor
+{
+    private DnParser parser;
+
+
+    public void init( InterceptorContext context ) throws NamingException
+    {
+        AttributeTypeRegistry attributeRegistry = context.getGlobalRegistries().getAttributeTypeRegistry();
+
+        parser = new DnParser( new PerComponentNormalizer( attributeRegistry ) );
+    }
+
+
+    public void destroy()
+    {
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Normalize all Name based arguments for BackingStore interface operations
+    // ------------------------------------------------------------------------
+
+
+    protected void process( NextInterceptor nextInterceptor, Add call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setNormalizedName( parser.parse( call.getNormalizedName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, Delete call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, Modify call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, ModifyMany call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, ModifyRN call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, Move call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+
+            call.setNewParentName( parser.parse( call.getNewParentName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, MoveAndModifyRN call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+
+            call.setNewParentName( parser.parse( call.getNewParentName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, Search call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setBaseName( parser.parse( call.getBaseName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, HasEntry call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, IsSuffix call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, List call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setBaseName( parser.parse( call.getBaseName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, Lookup call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, LookupWithAttrIds call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Normalize all Name based arguments for other interface operations
+    // ------------------------------------------------------------------------
+
+
+    protected void process( NextInterceptor nextInterceptor, GetMatchedDN call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+    protected void process( NextInterceptor nextInterceptor, GetSuffix call ) throws NamingException
+    {
+        synchronized( parser )
+        {
+            call.setName( parser.parse( call.getName().toString() ) );
+        }
+
+        super.process( nextInterceptor, call );
+    }
+
+
+
+    /**
+     * A normalizer that normalizes each name component specifically according to
+     * the attribute type of the name component.
+     */
+    class PerComponentNormalizer implements NameComponentNormalizer
+    {
+        /** the attribute type registry we use to lookup component normalizers */
+        private final AttributeTypeRegistry registry;
+
+
+        /**
+         * Creates a name component normalizer that looks up normalizers using
+         * an AttributeTypeRegistry.
+         *
+         * @param registry the attribute type registry to get normalizers
+         */
+        public PerComponentNormalizer( AttributeTypeRegistry registry )
+        {
+            this.registry = registry;
+        }
+
+
+        public String normalizeByName( String name, String value ) throws NamingException
+        {
+            AttributeType type = registry.lookup( name );
+
+            return ( String ) type.getEquality().getNormalizer().normalize( value );
+        }
+
+
+        public String normalizeByOid( String oid, String value ) throws NamingException
+        {
+            AttributeType type = registry.lookup( oid );
+
+            return ( String ) type.getEquality().getNormalizer().normalize( value );
+        }
+    }
+}

Modified: directory/apacheds/trunk/core/src/test/org/apache/ldap/server/interceptor/ConfigurationTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/interceptor/ConfigurationTest.java?view=diff&r1=159315&r2=159316
==============================================================================
--- directory/apacheds/trunk/core/src/test/org/apache/ldap/server/interceptor/ConfigurationTest.java (original)
+++ directory/apacheds/trunk/core/src/test/org/apache/ldap/server/interceptor/ConfigurationTest.java Mon Mar 28 14:20:10 2005
@@ -32,18 +32,29 @@
     protected void setUp() throws Exception
     {
         rootChain.addLast( "A", interceptorA );
+
         rootChain.addLast( "child", childChain );
+
         childChain.addBefore( InterceptorChain.NEXT_INTERCEPTOR, "B", interceptorB );
+
         rootChain.addLast( "default", InterceptorChain.newDefaultChain() );
 
         extras.put( EnvKeys.INTERCEPTORS, rootChain );
+
         extras.put( EnvKeys.INTERCEPTORS + "#root", "1" );
+
         extras.put( EnvKeys.INTERCEPTORS + ".A", "2" );
+
         extras.put( EnvKeys.INTERCEPTORS + ".A#A", "3" );
+
         extras.put( EnvKeys.INTERCEPTORS + ".A#A.A", "4" );
+
         extras.put( EnvKeys.INTERCEPTORS + ".child#child", "5" );
+
         extras.put( EnvKeys.INTERCEPTORS + ".child.B", "6" );
+
         extras.put( EnvKeys.INTERCEPTORS + ".child.B#B", "7" );
+
         extras.put( EnvKeys.INTERCEPTORS + ".child.B#B.B", "8" );
 
         super.setUp();
@@ -53,12 +64,19 @@
     public void testRootChain() throws Exception
     {
         Map expected = new HashMap();
+
         expected.put( "root", "1" );
+
         expected.put( "A#A", "3" );
+
         expected.put( "A#A.A", "4" );
+
         expected.put( "child#child", "5" );
+
         expected.put( "child.B#B", "7" );
+
         expected.put( "child.B#B.B", "8" );
+
         Assert.assertEquals( expected, rootChain.config );
     }
 
@@ -66,9 +84,13 @@
     public void testChildChain() throws Exception
     {
         Map expected = new HashMap();
+
         expected.put( "child", "5" );
+
         expected.put( "B#B", "7" );
+
         expected.put( "B#B.B", "8" );
+
         Assert.assertEquals( expected, childChain.config );
     }
 
@@ -76,8 +98,11 @@
     public void testA() throws Exception
     {
         Map expected = new HashMap();
+
         expected.put( "A", "3" );
+
         expected.put( "A.A", "4" );
+
         Assert.assertEquals( expected, interceptorA.config );
     }
 
@@ -85,8 +110,11 @@
     public void testB() throws Exception
     {
         Map expected = new HashMap();
+
         expected.put( "B", "7" );
+
         expected.put( "B.B", "8" );
+
         Assert.assertEquals( expected, interceptorB.config );
     }
 
@@ -99,6 +127,7 @@
         public synchronized void init( InterceptorContext ctx ) throws NamingException
         {
             config = ctx.getConfig();
+
             super.init( ctx );
         }
 



Mime
View raw message