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/03/22 12:23:00 UTC

svn commit: r158593 - in directory/apacheds/branches/interceptor_revamp/core/src: main/java/org/apache/ldap/server/jndi/ main/java/org/apache/ldap/server/jndi/invocation/interceptor/ test/org/apache/ldap/server/jndi/invocation/interceptor/

Author: trustin
Date: Tue Mar 22 03:22:56 2005
New Revision: 158593

URL: http://svn.apache.org/viewcvs?view=rev&rev=158593
Log:
* Added JavaDoc about configuring Interceptor settings.
* Renamed EnvKeys.INTERCEPTOR to EnvKeys.INTERCEPTORS

Modified:
    directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java
    directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java
    directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/Interceptor.java
    directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/invocation/interceptor/ConfigurationTest.java

Modified: directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java?view=diff&r1=158592&r2=158593
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java Tue Mar 22 03:22:56 2005
@@ -491,7 +491,7 @@
         // --------------------------------------------------------------------
         // Adding interceptors
         // --------------------------------------------------------------------
-        Interceptor interceptor = (Interceptor) initialEnv.get( EnvKeys.INTERCEPTOR );
+        InterceptorChain interceptor = (InterceptorChain) initialEnv.get( EnvKeys.INTERCEPTORS );
         if( interceptor == null ) {
             // If custom interceptor is not specified, use defaule one.
             interceptor = InterceptorChain.newDefaultChain();
@@ -499,7 +499,7 @@
 
         interceptor.init( new InterceptorContext(
                 initialEnv, system, globalRegistries, nexus,
-                InterceptorConfigBuilder.build( initialEnv, EnvKeys.INTERCEPTOR ) ) );
+                InterceptorConfigBuilder.build( initialEnv, EnvKeys.INTERCEPTORS ) ) );
         provider.setInterceptor( interceptor );
 
         // fire up the app partitions now!

Modified: directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java?view=diff&r1=158592&r2=158593
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/EnvKeys.java Tue Mar 22 03:22:56 2005
@@ -58,9 +58,21 @@
      * 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
      * add some default interceptors in <tt>org.apache.ldap.server.jndi.invocation.interceptor</tt>
-     * package in your custom interceptor chain. 
+     * package in your custom interceptor chain.
+     * <p>
+     * Here is an example of how to pass configuration values to interceptor:
+     * <pre>
+     * # Passes property 'propA=3' to the root interceptor chain.
+     * server.interceptors#propA=3
+     * # Passes property 'propB=7' to the interceptor whose name is 'myinterceptor'.
+     * server.interceptors.myinterceptor#propB=7
+     * # Passes property 'propC=9' to an interceptor 'yourinterceptor' whose
+     * # parent is an interceptor chain 'childChain' which is a child of the
+     * # root interceptor chain. 
+     * server.interceptors.childChain.yourinterceptor#propC=9
+     * </pre>
      */
-    public static final String INTERCEPTOR = "server.interceptor";
+    public static final String INTERCEPTORS = "server.interceptor";
 
     // ------------------------------------------------------------------------
     // Properties for protocol/network settings

Modified: directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/Interceptor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/Interceptor.java?view=diff&r1=158592&r2=158593
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/Interceptor.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/Interceptor.java Tue Mar 22 03:22:56 2005
@@ -79,6 +79,11 @@
  * Plus, placing your interceptor implementations to packages like
  * '<code>interceptor</code>' would be the best practice.
  * 
+ * <h2>Overriding Default Interceptor Settings</h2>
+ * <p>
+ * See {@link org.apache.ldap.server.jndi.EnvKeys#INTERCEPTORS} and
+ * {@link InterceptorChain#newDefaultChain()}.
+ * 
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$

Modified: directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/invocation/interceptor/ConfigurationTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/invocation/interceptor/ConfigurationTest.java?view=diff&r1=158592&r2=158593
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/invocation/interceptor/ConfigurationTest.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/invocation/interceptor/ConfigurationTest.java Tue Mar 22 03:22:56 2005
@@ -25,15 +25,15 @@
         childChain.addLast( "B", interceptorB );
         rootChain.addLast( "default", InterceptorChain.newDefaultChain() );
         
-        extras.put( EnvKeys.INTERCEPTOR, rootChain );
-        extras.put( EnvKeys.INTERCEPTOR + "#root", "1" );
-        extras.put( EnvKeys.INTERCEPTOR + ".A", "2" );
-        extras.put( EnvKeys.INTERCEPTOR + ".A#A", "3" );
-        extras.put( EnvKeys.INTERCEPTOR + ".A#A.A", "4" );
-        extras.put( EnvKeys.INTERCEPTOR + ".child#child", "5" );
-        extras.put( EnvKeys.INTERCEPTOR + ".child.B", "6" );
-        extras.put( EnvKeys.INTERCEPTOR + ".child.B#B", "7" );
-        extras.put( EnvKeys.INTERCEPTOR + ".child.B#B.B", "8" );
+        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();
     }