You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/07/12 05:13:52 UTC
svn commit: r555477 [2/2] - in /directory/apacheds/trunk:
bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/
core/src/main/java/org/apache/directory/server/core/
core/src/main/java/org/apache/directory/server/core/a...
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java Wed Jul 11 20:13:50 2007
@@ -87,9 +87,6 @@
*/
public class SubentryService extends BaseInterceptor
{
- /** The service name */
- public static final String NAME = "subentryService";
-
/** the subentry control OID */
private static final String SUBENTRY_CONTROL = SubentriesControl.CONTROL_OID;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java Wed Jul 11 20:13:50 2007
@@ -36,6 +36,7 @@
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -77,11 +78,6 @@
{
/** the logger for this class */
private static final Logger log = LoggerFactory.getLogger( TriggerService.class );
-
- /** The service name */
- public static final String NAME = "triggerService";
-
-
/** the entry trigger attribute string: entryTrigger */
private static final String ENTRY_TRIGGER_ATTR = "entryTriggerSpecification";
@@ -436,7 +432,7 @@
// we need to construct an entry to represent it
// at least with minimal requirements which are object class
// and access control subentry operational attributes.
- SubentryService subentryService = ( SubentryService ) chain.get( SubentryService.NAME );
+ SubentryService subentryService = ( SubentryService ) chain.get( StartupConfiguration.SUBENTRY_SERVICE_NAME );
Attributes fakeImportedEntry = subentryService.getSubentryAttributes( newDN, importedEntry );
NamingEnumeration attrList = importedEntry.getAll();
while ( attrList.hasMore() )
@@ -510,7 +506,7 @@
// we need to construct an entry to represent it
// at least with minimal requirements which are object class
// and access control subentry operational attributes.
- SubentryService subentryService = ( SubentryService ) chain.get( SubentryService.NAME );
+ SubentryService subentryService = ( SubentryService ) chain.get( StartupConfiguration.SUBENTRY_SERVICE_NAME );
Attributes fakeImportedEntry = subentryService.getSubentryAttributes( newDN, importedEntry );
NamingEnumeration attrList = importedEntry.getAll();
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Wed Jul 11 20:13:50 2007
@@ -24,25 +24,19 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.naming.Context;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
import junit.framework.TestCase;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.DirectoryServiceListener;
-import org.apache.directory.server.core.configuration.InterceptorConfiguration;
import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.DeadContext;
@@ -51,31 +45,43 @@
/**
- * Unit test cases for InterceptorChain methods.
+ * Unit test cases for InterceptorChain methods which test bypass
+ * instructions in the chain.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
public class InterceptorChainTest extends TestCase
{
- private final MockInterceptor[] interceptorArray =
- { new MockInterceptor( "0" ), new MockInterceptor( "1" ), new MockInterceptor( "2" ),
- new MockInterceptor( "3" ), new MockInterceptor( "4" ) };
+ private static final int INTERCEPTOR_COUNT = 5;
private InterceptorChain chain;
- private List<Interceptor> interceptors = new ArrayList<Interceptor>( interceptorArray.length );
-
+ List<MockInterceptor> interceptors = new ArrayList<MockInterceptor>( INTERCEPTOR_COUNT );
+
+ public InterceptorChainTest()
+ {
+ }
+
+
protected void setUp() throws Exception
{
chain = new InterceptorChain();
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ for ( int ii = 0; ii < INTERCEPTOR_COUNT; ii++ )
{
MutableInterceptorConfiguration config = new MutableInterceptorConfiguration();
- config.setInterceptor( interceptorArray[ii] );
- config.setName( interceptorArray[ii].getName() );
+ config.setInterceptorClassName( MockInterceptor.class.getName() );
+ config.setName( Integer.toString( ii ) );
chain.addLast( config );
}
+
+ List interceptorsInChain = chain.getAll();
+ for ( int ii = 0; ii < INTERCEPTOR_COUNT; ii++ )
+ {
+ MockInterceptor interceptor = ( MockInterceptor ) interceptorsInChain.get( ii );
+ interceptor.setTest( this );
+ interceptor.setName( Integer.toString( ii ) );
+ }
}
@@ -92,8 +98,7 @@
Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
- { dn } );
+ Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]{ dn } );
InvocationStack.getInstance().push( i );
try
@@ -104,10 +109,10 @@
{
}
- assertEquals( interceptorArray.length, interceptors.size() );
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ assertEquals( INTERCEPTOR_COUNT, interceptors.size() );
+ for ( int ii = 0; ii < INTERCEPTOR_COUNT; ii++ )
{
- assertEquals( interceptorArray[ii], interceptors.get( ii ) );
+ assertEquals( Integer.toString( ii ), interceptors.get( ii ).getName() );
}
}
@@ -130,15 +135,11 @@
{
}
- assertEquals( interceptorArray.length - 1, interceptors.size() );
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ assertEquals( INTERCEPTOR_COUNT - 1, interceptors.size() );
+ for ( int ii = 1; ii < INTERCEPTOR_COUNT; ii++ )
{
- if ( ii != 0 )
- {
- assertEquals( interceptorArray[ii], interceptors.get( ii - 1 ) );
- }
+ assertEquals( Integer.toString( ii ), interceptors.get( ii - 1 ).getName() );
}
- assertFalse( interceptors.contains( interceptorArray[0] ) );
}
@@ -163,16 +164,11 @@
{
}
- assertEquals( interceptorArray.length - 2, interceptors.size() );
- for ( int ii = 0; ii < interceptorArray.length; ii++ )
+ assertEquals( INTERCEPTOR_COUNT - 2, interceptors.size() );
+ for ( int ii = 2; ii < INTERCEPTOR_COUNT; ii++ )
{
- if ( ii != 0 && ii != 1 )
- {
- assertEquals( interceptorArray[ii], interceptors.get( ii - 2 ) );
- }
+ assertEquals( Integer.toString( ii ), interceptors.get( ii - 2 ).getName() );
}
- assertFalse( interceptors.contains( interceptorArray[0] ) );
- assertFalse( interceptors.contains( interceptorArray[1] ) );
}
@@ -197,12 +193,10 @@
{
}
- assertEquals( interceptorArray.length - 2, interceptors.size() );
- assertEquals( interceptorArray[1], interceptors.get( 0 ) );
- assertEquals( interceptorArray[2], interceptors.get( 1 ) );
- assertEquals( interceptorArray[3], interceptors.get( 2 ) );
- assertFalse( interceptors.contains( interceptorArray[0] ) );
- assertFalse( interceptors.contains( interceptorArray[4] ) );
+ assertEquals( INTERCEPTOR_COUNT - 2, interceptors.size() );
+ assertEquals( "1", interceptors.get( 0 ).getName() );
+ assertEquals( "2", interceptors.get( 1 ).getName() );
+ assertEquals( "3", interceptors.get( 2 ).getName() );
}
@@ -227,12 +221,10 @@
{
}
- assertEquals( interceptorArray.length - 2, interceptors.size() );
- assertEquals( interceptorArray[0], interceptors.get( 0 ) );
- assertEquals( interceptorArray[2], interceptors.get( 1 ) );
- assertEquals( interceptorArray[4], interceptors.get( 2 ) );
- assertFalse( interceptors.contains( interceptorArray[1] ) );
- assertFalse( interceptors.contains( interceptorArray[3] ) );
+ assertEquals( INTERCEPTOR_COUNT - 2, interceptors.size() );
+ assertEquals( "0", interceptors.get( 0 ).getName() );
+ assertEquals( "2", interceptors.get( 1 ).getName() );
+ assertEquals( "4", interceptors.get( 2 ).getName() );
}
@@ -257,172 +249,7 @@
assertEquals( 0, interceptors.size() );
}
- class MockInterceptor implements Interceptor
- {
- String name;
-
-
- public MockInterceptor(String name)
- {
- this.name = name;
- }
-
-
- public String getName()
- {
- return this.name;
- }
-
-
- public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration cfg )
- throws NamingException
- {
- }
-
-
- public void destroy()
- {
- }
-
-
- public Attributes getRootDSE( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.getRootDSE( opContext );
- }
-
-
- public LdapDN getMatchedName ( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.getMatchedName( opContext );
- }
-
-
- public LdapDN getSuffix ( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.getSuffix( opContext );
- }
-
-
- public Iterator listSuffixes ( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.listSuffixes( opContext );
- }
-
-
- public void addContextPartition( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.addContextPartition( opContext );
- }
-
-
- public void removeContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.removeContextPartition( opContext );
- }
-
-
- public boolean compare( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.compare( opContext );
- }
-
-
- public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.delete( opContext );
- }
-
-
- public void add(NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.add( opContext );
- }
-
-
- public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.modify( opContext );
- }
-
-
- public NamingEnumeration list( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.list( opContext );
- }
-
-
- public NamingEnumeration<SearchResult> search( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.search( opContext );
- }
-
-
- public Attributes lookup( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.lookup( opContext );
- }
-
-
- public boolean hasEntry( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- return next.hasEntry( opContext );
- }
-
-
- public void rename( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.rename( opContext );
- }
-
-
- public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.move( opContext );
- }
-
-
- public void moveAndRename( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.moveAndRename( opContext );
- }
-
-
- public void bind( NextInterceptor next, OperationContext opContext )
- throws NamingException
- {
- interceptors.add( this );
- next.bind( opContext );
- }
-
-
- public void unbind( NextInterceptor next, OperationContext opContext ) throws NamingException
- {
- interceptors.add( this );
- next.unbind( opContext );
- }
- }
-
+
class MockDirectoryService extends DirectoryService
{
public void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException
Added: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java?view=auto&rev=555477
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java (added)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java Wed Jul 11 20:13:50 2007
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.directory.server.core.interceptor;
+
+
+import java.util.Iterator;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
+
+import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.configuration.InterceptorConfiguration;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+
+public class MockInterceptor implements Interceptor
+{
+ InterceptorChainTest test;
+ String name;
+
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+
+ public void setTest( InterceptorChainTest test )
+ {
+ this.test = test;
+ }
+
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+
+ public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration cfg )
+ throws NamingException
+ {
+ }
+
+
+ public void destroy()
+ {
+ }
+
+
+ public Attributes getRootDSE( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.getRootDSE( opContext );
+ }
+
+
+ public LdapDN getMatchedName ( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.getMatchedName( opContext );
+ }
+
+
+ public LdapDN getSuffix ( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.getSuffix( opContext );
+ }
+
+
+ public Iterator listSuffixes ( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.listSuffixes( opContext );
+ }
+
+
+ public void addContextPartition( NextInterceptor next, OperationContext opContext )
+ throws NamingException
+ {
+ test.interceptors.add( this );
+ next.addContextPartition( opContext );
+ }
+
+
+ public void removeContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ next.removeContextPartition( opContext );
+ }
+
+
+ public boolean compare( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.compare( opContext );
+ }
+
+
+ public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ next.delete( opContext );
+ }
+
+
+ public void add(NextInterceptor next, OperationContext opContext )
+ throws NamingException
+ {
+ test.interceptors.add( this );
+ next.add( opContext );
+ }
+
+
+ public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ next.modify( opContext );
+ }
+
+
+ public NamingEnumeration list( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.list( opContext );
+ }
+
+
+ public NamingEnumeration<SearchResult> search( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.search( opContext );
+ }
+
+
+ public Attributes lookup( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.lookup( opContext );
+ }
+
+
+ public boolean hasEntry( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ return next.hasEntry( opContext );
+ }
+
+
+ public void rename( NextInterceptor next, OperationContext opContext )
+ throws NamingException
+ {
+ test.interceptors.add( this );
+ next.rename( opContext );
+ }
+
+
+ public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ next.move( opContext );
+ }
+
+
+ public void moveAndRename( NextInterceptor next, OperationContext opContext )
+ throws NamingException
+ {
+ test.interceptors.add( this );
+ next.moveAndRename( opContext );
+ }
+
+
+ public void bind( NextInterceptor next, OperationContext opContext )
+ throws NamingException
+ {
+ test.interceptors.add( this );
+ next.bind( opContext );
+ }
+
+
+ public void unbind( NextInterceptor next, OperationContext opContext ) throws NamingException
+ {
+ test.interceptors.add( this );
+ next.unbind( opContext );
+ }
+
+
+ public String toString()
+ {
+ return name;
+ }
+}
\ No newline at end of file
Propchange: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
------------------------------------------------------------------------------
svn:executable = *
Added: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java?view=auto&rev=555477
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java (added)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java Wed Jul 11 20:13:50 2007
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.directory.mitosis.configuration;
+
+
+/**
+ * A specialized mutable version of the InterceptorConfiguration for the
+ * replication service which contains all the parameters to configure
+ * this service.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MutableReplicationInterceptorConfiguration extends ReplicationInterceptorConfiguration
+{
+ public void setReplicationConfiguration( ReplicationConfiguration replicationConfiguration )
+ {
+ super.setReplicationConfiguration( replicationConfiguration );
+ }
+
+
+ public void setInterceptorClassName( String interceptorClassName )
+ {
+ super.setInterceptorClassName( interceptorClassName );
+ }
+
+
+ public void setName( String name )
+ {
+ super.setName( name );
+ }
+}
Propchange: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java
------------------------------------------------------------------------------
svn:executable = *
Added: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java?view=auto&rev=555477
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java (added)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java Wed Jul 11 20:13:50 2007
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.directory.mitosis.configuration;
+
+
+import org.apache.directory.server.core.configuration.InterceptorConfiguration;
+
+
+/**
+ * A specialized InterceptorConfiguration for the replication service which
+ * contains all the parameters to configure this service.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ReplicationInterceptorConfiguration extends InterceptorConfiguration
+{
+ private ReplicationConfiguration replicationConfiguration;
+
+
+ public ReplicationConfiguration getReplicationConfiguration()
+ {
+ return replicationConfiguration;
+ }
+
+
+ protected void setReplicationConfiguration( ReplicationConfiguration replicationConfiguration )
+ {
+ this.replicationConfiguration = replicationConfiguration;
+ }
+}
Propchange: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java
------------------------------------------------------------------------------
svn:executable = *
Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java Wed Jul 11 20:13:50 2007
@@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
@@ -43,6 +42,7 @@
import org.apache.directory.mitosis.common.Replica;
import org.apache.directory.mitosis.common.ReplicaId;
import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
+import org.apache.directory.mitosis.configuration.ReplicationInterceptorConfiguration;
import org.apache.directory.mitosis.operation.Operation;
import org.apache.directory.mitosis.operation.OperationFactory;
import org.apache.directory.mitosis.service.protocol.codec.ReplicationServerProtocolCodecFactory;
@@ -172,13 +172,6 @@
}
- public void setConfiguration( ReplicationConfiguration cfg )
- {
- cfg.validate();
- this.configuration = cfg;
- }
-
-
public DirectoryServiceConfiguration getFactoryConfiguration()
{
return directoryServiceConfiguration;
@@ -187,6 +180,8 @@
public void init( DirectoryServiceConfiguration serviceCfg, InterceptorConfiguration cfg ) throws NamingException
{
+ ReplicationInterceptorConfiguration replicationCfg = ( ReplicationInterceptorConfiguration ) cfg;
+ configuration = replicationCfg.getReplicationConfiguration();
configuration.validate();
// and then preserve frequently used ones
directoryServiceConfiguration = serviceCfg;
Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java (original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java Wed Jul 11 20:13:50 2007
@@ -42,10 +42,10 @@
import org.apache.commons.io.FileUtils;
import org.apache.directory.mitosis.common.Replica;
import org.apache.directory.mitosis.common.ReplicaId;
+import org.apache.directory.mitosis.configuration.MutableReplicationInterceptorConfiguration;
import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
-import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
import org.apache.directory.server.core.jndi.CoreContextFactory;
@@ -208,12 +208,11 @@
}
ReplicationService replicationService = new ReplicationService();
- replicationService.setConfiguration( replicationCfg );
-
- MutableInterceptorConfiguration interceptorCfg = new MutableInterceptorConfiguration();
+ MutableReplicationInterceptorConfiguration interceptorCfg =
+ new MutableReplicationInterceptorConfiguration();
interceptorCfg.setName( "mitosis" );
- interceptorCfg.setInterceptor( replicationService );
-
+ interceptorCfg.setInterceptorClassName( replicationService.getClass().getName() );
+ interceptorCfg.setReplicationConfiguration( replicationCfg );
interceptorCfgs.add( interceptorCfg );
ldapCfg.setInterceptorConfigurations( interceptorCfgs );
Modified: directory/apacheds/trunk/server-installers/src/main/installers/server.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-installers/src/main/installers/server.xml?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/server-installers/src/main/installers/server.xml (original)
+++ directory/apacheds/trunk/server-installers/src/main/installers/server.xml Wed Jul 11 20:13:50 2007
@@ -199,107 +199,93 @@
<list>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="normalizationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.normalization.NormalizationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.normalization.NormalizationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="authenticationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.authn.AuthenticationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.authn.AuthenticationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="referralService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.referral.ReferralService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.referral.ReferralService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="authorizationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.authz.AuthorizationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.authz.AuthorizationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="defaultAuthorizationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.authz.DefaultAuthorizationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.authz.DefaultAuthorizationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="exceptionService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.exception.ExceptionService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.exception.ExceptionService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="operationalAttributeService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.operational.OperationalAttributeService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.operational.OperationalAttributeService" />
</bean>
- <!-- bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <!-- Uncomment to enable the password policy service
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="passwordPolicyService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.kerberos.PasswordPolicyService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.kerberos.PasswordPolicyService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="keyDerivationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.kerberos.KeyDerivationService" />
- </property>
- </bean -->
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.kerberos.KeyDerivationService" />
+ </bean>
+ -->
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="schemaService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.schema.SchemaService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.schema.SchemaService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="subentryService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.subtree.SubentryService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.subtree.SubentryService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="collectiveAttributeService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.collective.CollectiveAttributeService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.collective.CollectiveAttributeService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="eventService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.event.EventService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.event.EventService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="triggerService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.trigger.TriggerService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.trigger.TriggerService" />
</bean>
- <!-- Uncomment to enable replication service
- <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <!-- Uncomment to enable replication service
+ <bean class="org.apache.directory.mitosis.configuration.MutableReplicationInterceptorConfiguration">
<property name="name" value="replicationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.mitosis.service.ReplicationService">
- <property name="configuration">
- <bean class="org.apache.directory.mitosis.configuration.ReplicationConfiguration">
- <property name="replicaId">
- <bean class="org.apache.directory.mitosis.common.ReplicaId">
- <constructor-arg>
- <value>instance_a</value>
- </constructor-arg>
- </bean>
- </property>
- <property name="serverPort" value="10390" />
- <property name="peerReplicas" value="instance_b@localhost:10392" />
+ <property name="interceptorClassName"
+ value="org.apache.directory.mitosis.service.ReplicationService" />
+ <property name="replicationConfiguration">
+ <bean class="org.apache.directory.mitosis.configuration.ReplicationConfiguration">
+ <property name="replicaId">
+ <bean class="org.apache.directory.mitosis.common.ReplicaId">
+ <constructor-arg>
+ <value>instance_a</value>
+ </constructor-arg>
</bean>
</property>
+ <property name="serverPort" value="10390" />
+ <property name="peerReplicas" value="instance_b@localhost:10392" />
</bean>
</property>
</bean>
Modified: directory/apacheds/trunk/server-main/server.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-main/server.xml?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/server-main/server.xml (original)
+++ directory/apacheds/trunk/server-main/server.xml Wed Jul 11 20:13:50 2007
@@ -199,107 +199,93 @@
<list>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="normalizationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.normalization.NormalizationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.normalization.NormalizationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="authenticationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.authn.AuthenticationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.authn.AuthenticationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="referralService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.referral.ReferralService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.referral.ReferralService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="authorizationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.authz.AuthorizationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.authz.AuthorizationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="defaultAuthorizationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.authz.DefaultAuthorizationService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.authz.DefaultAuthorizationService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="exceptionService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.exception.ExceptionService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.exception.ExceptionService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="operationalAttributeService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.operational.OperationalAttributeService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.operational.OperationalAttributeService" />
</bean>
- <!-- bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <!-- Uncomment to enable the password policy service
+ <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="passwordPolicyService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.kerberos.PasswordPolicyService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.kerberos.PasswordPolicyService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="keyDerivationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.kerberos.KeyDerivationService" />
- </property>
- </bean -->
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.kerberos.KeyDerivationService" />
+ </bean>
+ -->
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="schemaService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.schema.SchemaService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.schema.SchemaService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="subentryService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.subtree.SubentryService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.subtree.SubentryService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="collectiveAttributeService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.collective.CollectiveAttributeService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.collective.CollectiveAttributeService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="eventService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.event.EventService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.event.EventService" />
</bean>
<bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
<property name="name" value="triggerService" />
- <property name="interceptor">
- <bean class="org.apache.directory.server.core.trigger.TriggerService" />
- </property>
+ <property name="interceptorClassName"
+ value="org.apache.directory.server.core.trigger.TriggerService" />
</bean>
- <!-- Uncomment to enable replication service
- <bean class="org.apache.directory.server.core.configuration.MutableInterceptorConfiguration">
+ <!-- Uncomment to enable replication service
+ <bean class="org.apache.directory.mitosis.configuration.MutableReplicationInterceptorConfiguration">
<property name="name" value="replicationService" />
- <property name="interceptor">
- <bean class="org.apache.directory.mitosis.service.ReplicationService">
- <property name="configuration">
- <bean class="org.apache.directory.mitosis.configuration.ReplicationConfiguration">
- <property name="replicaId">
- <bean class="org.apache.directory.mitosis.common.ReplicaId">
- <constructor-arg>
- <value>instance_a</value>
- </constructor-arg>
- </bean>
- </property>
- <property name="serverPort" value="10390" />
- <property name="peerReplicas" value="instance_b@localhost:10392" />
+ <property name="interceptorClassName"
+ value="org.apache.directory.mitosis.service.ReplicationService" />
+ <property name="replicationConfiguration">
+ <bean class="org.apache.directory.mitosis.configuration.ReplicationConfiguration">
+ <property name="replicaId">
+ <bean class="org.apache.directory.mitosis.common.ReplicaId">
+ <constructor-arg>
+ <value>instance_a</value>
+ </constructor-arg>
</bean>
</property>
+ <property name="serverPort" value="10390" />
+ <property name="peerReplicas" value="instance_b@localhost:10392" />
</bean>
</property>
</bean>
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java Wed Jul 11 20:13:50 2007
@@ -110,7 +110,7 @@
List<InterceptorConfiguration> list = configuration.getInterceptorConfigurations();
interceptorCfg.setName( KeyDerivationService.NAME );
- interceptorCfg.setInterceptor( new KeyDerivationService() );
+ interceptorCfg.setInterceptorClassName( "org.apache.directory.server.core.kerberos.KeyDerivationService" );
list.add( interceptorCfg );
configuration.setInterceptorConfigurations( list );
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java Wed Jul 11 20:13:50 2007
@@ -94,7 +94,7 @@
List<InterceptorConfiguration> list = configuration.getInterceptorConfigurations();
interceptorCfg.setName( PasswordPolicyService.NAME );
- interceptorCfg.setInterceptor( new PasswordPolicyService() );
+ interceptorCfg.setInterceptorClassName( "org.apache.directory.server.core.kerberos.PasswordPolicyService" );
list.add( interceptorCfg );
configuration.setInterceptorConfigurations( list );
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java?view=diff&rev=555477&r1=555476&r2=555477
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java Wed Jul 11 20:13:50 2007
@@ -124,7 +124,7 @@
List<InterceptorConfiguration> list = configuration.getInterceptorConfigurations();
interceptorCfg.setName( KeyDerivationService.NAME );
- interceptorCfg.setInterceptor( new KeyDerivationService() );
+ interceptorCfg.setInterceptorClassName( "org.apache.directory.server.core.kerberos.KeyDerivationService" );
list.add( interceptorCfg );
configuration.setInterceptorConfigurations( list );