Author: trustin
Date: Thu Mar 17 20:04:38 2005
New Revision: 158019
URL: http://svn.apache.org/viewcvs?view=rev&rev=158019
Log:
* Revamped Interceptor interface.
* Now implementing InterceptorChain...
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorChain.java
(with props)
Removed:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/FailFastPipeline.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorPipeline.java
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/OnErrorPipeline.java
Modified:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Interceptor.java
(contents, props changed)
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
Modified:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Interceptor.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Interceptor.java?view=diff&r1=158018&r2=158019
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Interceptor.java
(original)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Interceptor.java
Thu Mar 17 20:04:38 2005
@@ -16,34 +16,44 @@
*/
package org.apache.ldap.server.jndi;
+import java.util.Properties;
import javax.naming.NamingException;
-
/**
- * The Interceptor is a component through which invocations pass thru. In
- * most cases the invocations pass thru a series of Interceptor objects
- * before the target object is invoked.
- *
- * Got this idea from a class written by Peter Donald who originally wrote it
- * for XInvoke in the Spice Project at Codehaus.
- *
- * @author <a href="mailto:[email protected]">Apache Directory
Project</a>
- * @version $Rev$
+ * Processes or filters any directory operations. You can intercept the
+ * [EMAIL PROTECTED] Invocation}s and perform 'before', 'after', 'around' any
any other
+ * filtering operations.
+ *
+ * @author The Apache Directory Project ([email protected])
+ * @author Trustin Lee ([EMAIL PROTECTED])
+ * @version $Rev$, $Date$
*/
public interface Interceptor
{
- /**
- * Process a particular invocation. The method must try to catch and
- * rethrow exceptions as EveInterceptorExceptions and any other exceptions
- * will be caught and placed into the invocation via
- * [EMAIL PROTECTED] Invocation#setThrowable} or [EMAIL PROTECTED]
Invocation#addFailure(Throwable)}.
- *
- * <p>Note: most Interceptors pass control to the next Interceptor in the
- * series.</p>
+ /**
+ * Intializes this interceptor. This is invoked by directory service
+ * provider when this intercepter is loaded into invocation chain.
+ *
+ * @param config the configuration properties for this interceptor
+ * @throws NamingException if failed to initialize this interceptor
+ */
+ void init( Properties config ) throws NamingException;
+
+ /**
+ * Deinitialized this interceptor. This is invoked by directory service
+ * provider when this intercepter is unloaded from invocation chain.
+ */
+ void destroy();
+
+ /**
+ * Process a particular invocation. You can pass control to
+ * <code>nextInterceptor</code> by invoking [EMAIL PROTECTED]
#invoke(Interceptor, Invocation)}.
*
+ * @param nextInterceptor the next interceptor in the interceptor chain
* @param invocation the invocation to process
* @throws NamingException on failures while handling the invokation
*/
- void invoke( Invocation invocation ) throws NamingException;
+ void invoke( Interceptor nextInterceptor, Invocation invocation )
+ throws NamingException;
}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/Interceptor.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar 17 20:04:38 2005
@@ -1 +1 @@
-Rev
+HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorChain.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorChain.java?view=auto&rev=158019
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorChain.java
(added)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorChain.java
Thu Mar 17 20:04:38 2005
@@ -0,0 +1,40 @@
+package org.apache.ldap.server.jndi;
+
+/**
+ * Manages [EMAIL PROTECTED] Interceptor} stack. The first [EMAIL PROTECTED]
Interceptor} is
+ * invoked and then invocation chain starts.
+ *
+ * TODO imeplement me.
+ *
+ * @author The Apache Directory Project ([email protected])
+ * @author Trustin Lee ([EMAIL PROTECTED])
+ * @version $Rev$, $Date$
+ */
+public class InterceptorChain
+{
+
+ public Interceptor getInterceptor( String name )
+ {
+
+ }
+
+ public void addFirst( String name, Interceptor interceptor )
+ {
+
+ }
+
+ public void addLast( String name, Interceptor interceptor )
+ {
+
+ }
+
+ public void addBefore( Interceptor other, String name, Interceptor
interceptor )
+ {
+
+ }
+
+ public void addAfter( Interceptor other, String name, Interceptor
interceptor )
+ {
+
+ }
+}
Propchange:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/InterceptorChain.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Modified:
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
URL:
http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java?view=diff&r1=158018&r2=158019
==============================================================================
---
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
(original)
+++
directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/JndiProvider.java
Thu Mar 17 20:04:38 2005
@@ -44,12 +44,8 @@
/** Singleton instance of this class */
private static JndiProvider s_singleton = null;
- /** Interceptor of interceptors in post-invocation pipeline */
- private InterceptorPipeline after = new FailFastPipeline();
- /** Interceptor of interceptors in pre-invocation pipeline */
- private InterceptorPipeline before = new FailFastPipeline();
- /** Interceptor of interceptors in post-invocation pipeline failure */
- private InterceptorPipeline afterFailure = new OnErrorPipeline();
+ /** The interceptor chain for this provider */
+ private final InterceptorChain interceptors = new InterceptorChain();
/** RootNexus as it was given to us by the ServiceManager */
private RootNexus nexus = null;
/** PartitionNexus proxy wrapping nexus to inject services */
@@ -146,9 +142,7 @@
this.nexus.close();
this.nexus = null;
this.proxy = null;
- this.before = null;
- this.after = null;
- this.afterFailure = null;
+ this.interceptors.clear();
this.isShutdown = true;
s_singleton = null;
}