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/21 12:42:53 UTC

svn commit: r158452 - in directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor: Interceptor.java NextInterceptor.java

Author: trustin
Date: Mon Mar 21 03:42:51 2005
New Revision: 158452

URL: http://svn.apache.org/viewcvs?view=rev&rev=158452
Log:
Moved documentation about invocation chaining from NextInterceptor to Interceptor.


Modified:
    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/main/java/org/apache/ldap/server/jndi/invocation/interceptor/NextInterceptor.java

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=158451&r2=158452
==============================================================================
--- 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 Mon Mar 21 03:42:51 2005
@@ -27,6 +27,49 @@
  * {@link Invocation}s performed on {@link BackingStore}s just like Servlet
  * filters do.
  * 
+ * <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. 
+ * <p>
+ * <h3>Pre-invocation Filtering</h3>
+ * <pre>
+ * public void process( NextInterceptor nextInterceptor, Invocation invocation )
+ * {
+ *     System.out.println( "Starting invocation." );
+ *     nextInterceptor.process( invocation );
+ * }
+ * </pre>
+ * 
+ * <h3>Post-invocation Filtering</h3>
+ * <pre>
+ * public void process( NextInterceptor nextInterceptor, Invocation invocation )
+ * {
+ *     nextInterceptor.process( invocation );
+ *     System.out.println( "Invocation ended." );
+ * }
+ * </pre>
+ * 
+ * <h3>Around-invocation Filtering</h3>
+ * <pre>
+ * public void process( NextInterceptor nextInterceptor, Invocation invocation )
+ * {
+ *     long startTime = System.currentTimeMillis();   
+ *     try
+ *     {
+ *         nextInterceptor.process( invocation );
+ *     }
+ *     finally
+ *     {
+ *         long endTime = System.currentTimeMillis();
+ *         System.out.println( ( endTime - startTime ) + "ms elapsed." );
+ *     }
+ * }
+ * </pre>
+ * 
  * <h2>Interceptor Naming Convention</h2>
  * <p>
  * When you create an implementation of Interceptor, you have to follow
@@ -44,6 +87,7 @@
  * @version $Rev$, $Date$
  * 
  * @see InvocationChain
+ * @see NextInterceptor
  */
 public interface Interceptor
 {

Modified: directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/NextInterceptor.java?view=diff&r1=158451&r2=158452
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/NextInterceptor.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/invocation/interceptor/NextInterceptor.java Mon Mar 21 03:42:51 2005
@@ -22,13 +22,6 @@
 
 /**
  * Represents the next {@link Interceptor} in the interceptor chain.
- * {@link Interceptor}s should usually pass the control of current invocation
- * to the next {@link Interceptor} by calling
- * <code>nextInterceptor.process(invocation)</code>.
- * This method returns 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. 
  * 
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @author Trustin Lee (trustin@apache.org)