Author: trustin
Date: Tue Aug 9 20:35:56 2005
New Revision: 231160
URL: http://svn.apache.org/viewcvs?rev=231160&view=rev
Log:
* Added remove() method to InterceptorChain
Modified:
directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java
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=231160&r1=231159&r2=231160&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 Aug 9 20:35:56 2005
@@ -260,7 +260,7 @@
{
try
{
- deregister( e.configuration );
+ deregister( e.configuration.getName() );
}
catch ( Throwable t )
{
@@ -323,6 +323,11 @@
register0( cfg, e );
}
+ public synchronized InterceptorConfiguration remove( String interceptorName ) throws
NamingException
+ {
+ return deregister( interceptorName );
+ }
+
public synchronized void addAfter( String prevInterceptorName, InterceptorConfiguration
cfg ) throws NamingException
{
Entry e = (Entry) name2entry.get( prevInterceptorName );
@@ -345,11 +350,10 @@
/**
- * Removes and deinitializes the interceptor with the specified configuration.
+ * Removes and deinitializes the interceptor with the specified name.
*/
- private void deregister( InterceptorConfiguration cfg ) throws ConfigurationException
+ private InterceptorConfiguration deregister( String name ) throws ConfigurationException
{
- String name = cfg.getName();
Entry entry = checkOldName( name );
Entry prevEntry = entry.prevEntry;
Entry nextEntry = entry.nextEntry;
@@ -357,13 +361,13 @@
if( nextEntry == null )
{
// Don't deregister tail
- return;
+ return null;
}
if ( prevEntry == null )
{
nextEntry.prevEntry = null;
- head = entry;
+ head = nextEntry;
}
else
{
@@ -373,6 +377,8 @@
name2entry.remove( name );
entry.configuration.getInterceptor().destroy();
+
+ return entry.configuration;
}
@@ -823,17 +829,14 @@
private Entry( Entry prevEntry, Entry nextEntry,
InterceptorConfiguration configuration )
{
- if ( configuration == null )
+ if( configuration == null )
{
throw new NullPointerException( "configuration" );
}
this.prevEntry = prevEntry;
-
this.nextEntry = nextEntry;
-
this.configuration = configuration;
-
this.nextInterceptor = new NextInterceptor()
{
public Attributes getRootDSE() throws NamingException
|