You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/06/14 11:14:34 UTC
svn commit: r784530 [5/5] - in /directory:
apacheds/trunk/core/src/main/java/org/apache/directory/server/core/
apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/
apacheds/trunk/core/src/test/java/org/apache/directory/serv...
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java Sun Jun 14 09:14:31 2009
@@ -37,7 +37,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import org.apache.directory.server.ldap.LdapService;
+import org.apache.directory.server.ldap.LdapServer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -117,7 +117,7 @@
)
public class SearchLimitsIT
{
- public static LdapService ldapService;
+ public static LdapServer ldapServer;
/**
@@ -170,19 +170,19 @@
@Before
public void setUp() throws Exception
{
- oldMaxTimeLimit = ldapService.getMaxTimeLimit();
- oldMaxSizeLimit = ldapService.getMaxSizeLimit();
+ oldMaxTimeLimit = ldapServer.getMaxTimeLimit();
+ oldMaxSizeLimit = ldapServer.getMaxSizeLimit();
delayInterceptor = new DelayInducingInterceptor();
- ldapService.getDirectoryService().getInterceptorChain().addFirst( delayInterceptor );
+ ldapServer.getDirectoryService().getInterceptorChain().addFirst( delayInterceptor );
}
@After
public void tearDown() throws Exception
{
- ldapService.setMaxTimeLimit( oldMaxTimeLimit );
- ldapService.setMaxSizeLimit( oldMaxSizeLimit );
- ldapService.getDirectoryService().getInterceptorChain().remove( DelayInducingInterceptor.class.getName() );
+ ldapServer.setMaxTimeLimit( oldMaxTimeLimit );
+ ldapServer.setMaxSizeLimit( oldMaxSizeLimit );
+ ldapServer.getDirectoryService().getInterceptorChain().remove( DelayInducingInterceptor.class.getName() );
}
@@ -199,10 +199,10 @@
@Test ( expected = TimeLimitExceededException.class )
public void testRequestConstrainedUnlimitByConfiguration() throws Exception
{
- ldapService.setMaxTimeLimit( LdapService.NO_TIME_LIMIT );
+ ldapServer.setMaxTimeLimit( LdapServer.NO_TIME_LIMIT );
delayInterceptor.setDelayMillis( 500 );
- getActorsWithLimit( "(objectClass=*)", 499, LdapService.NO_SIZE_LIMIT );
+ getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT );
}
@@ -214,10 +214,10 @@
@Test ( expected = TimeLimitExceededException.class )
public void testRequestConstrainedLessThanConfiguration() throws Exception
{
- ldapService.setMaxTimeLimit( 10000 ); // this is in seconds
+ ldapServer.setMaxTimeLimit( 10000 ); // this is in seconds
delayInterceptor.setDelayMillis( 500 );
- getActorsWithLimit( "(objectClass=*)", 499, LdapService.NO_SIZE_LIMIT );
+ getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT );
}
@@ -229,10 +229,10 @@
@Test ( expected = TimeLimitExceededException.class )
public void testRequestConstrainedGreaterThanConfiguration() throws Exception
{
- ldapService.setMaxTimeLimit( 1 ); // this is in seconds
+ ldapServer.setMaxTimeLimit( 1 ); // this is in seconds
delayInterceptor.setDelayMillis( 1100 );
- getActorsWithLimit( "(objectClass=*)", 100000, LdapService.NO_SIZE_LIMIT );
+ getActorsWithLimit( "(objectClass=*)", 100000, LdapServer.NO_SIZE_LIMIT );
}
@@ -243,11 +243,11 @@
@Test
public void testRequestUnlimitedConfigurationLimited() throws Exception
{
- ldapService.setMaxTimeLimit( 1 ); // this is in seconds
+ ldapServer.setMaxTimeLimit( 1 ); // this is in seconds
delayInterceptor.setDelayMillis( 500 );
getActorsWithLimit( "(objectClass=*)",
- LdapService.NO_TIME_LIMIT, LdapService.NO_SIZE_LIMIT );
+ LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT );
}
@@ -258,11 +258,11 @@
@Test ( expected = TimeLimitExceededException.class )
public void testNonAdminRequestUnlimitedConfigurationLimited() throws Exception
{
- ldapService.setMaxTimeLimit( 1 ); // this is in seconds
+ ldapServer.setMaxTimeLimit( 1 ); // this is in seconds
delayInterceptor.setDelayMillis( 500 );
getActorsWithLimitNonAdmin( "(objectClass=*)",
- LdapService.NO_TIME_LIMIT, LdapService.NO_SIZE_LIMIT );
+ LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT );
}
@@ -279,9 +279,9 @@
@Test (expected = SizeLimitExceededException.class)
public void testRequestConstrainedUnlimitByConfigurationSize() throws Exception
{
- ldapService.setMaxSizeLimit( LdapService.NO_SIZE_LIMIT );
+ ldapServer.setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT );
- getActorsWithLimit( "(objectClass=*)", LdapService.NO_TIME_LIMIT, 1 );
+ getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 1 );
}
@@ -293,9 +293,9 @@
@Test ( expected = SizeLimitExceededException.class )
public void testRequestConstrainedLessThanConfigurationSize() throws Exception
{
- ldapService.setMaxSizeLimit( 10000 );
+ ldapServer.setMaxSizeLimit( 10000 );
- getActorsWithLimit( "(objectClass=*)", LdapService.NO_TIME_LIMIT, 1 );
+ getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 1 );
}
@@ -307,8 +307,8 @@
@Test
public void testRequestConstrainedGreaterThanConfigurationSize() throws Exception
{
- ldapService.setMaxSizeLimit( 1 );
- Set<String> set = getActorsWithLimit( "(objectClass=*)", LdapService.NO_TIME_LIMIT, 100000 );
+ ldapServer.setMaxSizeLimit( 1 );
+ Set<String> set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 100000 );
assertEquals( 4, set.size() );
}
@@ -321,10 +321,10 @@
@Test (expected = SizeLimitExceededException.class )
public void testNonAdminRequestConstrainedGreaterThanConfigurationSize() throws Exception
{
- ldapService.setMaxSizeLimit( 1 );
+ ldapServer.setMaxSizeLimit( 1 );
// We are not using the admin : it should fail
- getActorsWithLimitNonAdmin( "(objectClass=*)", LdapService.NO_TIME_LIMIT, 100000 );
+ getActorsWithLimitNonAdmin( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 100000 );
}
@@ -335,9 +335,9 @@
@Test
public void testRequestUnlimitedConfigurationLimitedSize() throws Exception
{
- ldapService.setMaxSizeLimit( 1 );
+ ldapServer.setMaxSizeLimit( 1 );
Set<String> set = getActorsWithLimit( "(objectClass=*)",
- LdapService.NO_TIME_LIMIT, LdapService.NO_SIZE_LIMIT );
+ LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT );
assertEquals( 4, set.size() );
}
@@ -350,9 +350,9 @@
@Test ( expected = SizeLimitExceededException.class )
public void testNonAdminRequestUnlimitedConfigurationLimitedSize() throws Exception
{
- ldapService.setMaxSizeLimit( 1 );
+ ldapServer.setMaxSizeLimit( 1 );
getActorsWithLimitNonAdmin( "(objectClass=*)",
- LdapService.NO_TIME_LIMIT, LdapService.NO_SIZE_LIMIT );
+ LdapServer.NO_TIME_LIMIT, LdapServer.NO_SIZE_LIMIT );
}
@@ -370,9 +370,9 @@
@Test ( expected = SizeLimitExceededException.class )
public void testRequestConstraintedLessThanExpectedSize() throws Exception
{
- ldapService.setMaxSizeLimit( LdapService.NO_SIZE_LIMIT );
+ ldapServer.setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT );
- getActorsWithLimit( "(objectClass=*)", LdapService.NO_TIME_LIMIT, 3 );
+ getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 3 );
}
@@ -385,8 +385,8 @@
@Test
public void testRequestConstraintedEqualToExpectedSize() throws Exception
{
- ldapService.setMaxSizeLimit( LdapService.NO_SIZE_LIMIT );
- Set<String> set = getActorsWithLimit( "(objectClass=*)", LdapService.NO_TIME_LIMIT, 4 );
+ ldapServer.setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT );
+ Set<String> set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 4 );
assertEquals( 4, set.size() );
}
@@ -400,8 +400,8 @@
@Test
public void testRequestConstraintedGreaterThanExpectedSize() throws Exception
{
- ldapService.setMaxSizeLimit( LdapService.NO_SIZE_LIMIT );
- Set<String> set = getActorsWithLimit( "(objectClass=*)", LdapService.NO_TIME_LIMIT, 5 );
+ ldapServer.setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT );
+ Set<String> set = getActorsWithLimit( "(objectClass=*)", LdapServer.NO_TIME_LIMIT, 5 );
assertEquals( 4, set.size() );
}
@@ -414,9 +414,9 @@
@Test
public void testRequestObjectScopeAndSizeLimit() throws Exception
{
- ldapService.setMaxSizeLimit( LdapService.NO_SIZE_LIMIT );
+ ldapServer.setMaxSizeLimit( LdapServer.NO_SIZE_LIMIT );
- DirContext ctx = getWiredContext( ldapService );
+ DirContext ctx = getWiredContext( ldapServer );
String filter = "(objectClass=*)";
SearchControls controls = new SearchControls();
controls.setTimeLimit( 0 );
@@ -442,7 +442,7 @@
*/
private Set<String> getActorsWithLimit( String filter, int timeLimitMillis, int sizeLimit ) throws Exception
{
- DirContext ctx = getWiredContext( ldapService );
+ DirContext ctx = getWiredContext( ldapServer );
Set<String> results = new HashSet<String>();
SearchControls controls = new SearchControls();
controls.setTimeLimit( timeLimitMillis );
@@ -467,7 +467,7 @@
private Set<String> getActorsWithLimitNonAdmin( String filter, int timeLimitMillis, int sizeLimit )
throws Exception
{
- DirContext ctx = getWiredContext( ldapService, "uid=jblack,ou=actors,ou=system", "secret" );
+ DirContext ctx = getWiredContext( ldapServer, "uid=jblack,ou=actors,ou=system", "secret" );
Set<String> results = new HashSet<String>();
SearchControls controls = new SearchControls();
controls.setTimeLimit( timeLimitMillis );
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/LdapsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/LdapsIT.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/LdapsIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/LdapsIT.java Sun Jun 14 09:14:31 2009
@@ -28,7 +28,7 @@
import org.apache.directory.server.core.integ.annotations.Factory;
import org.apache.directory.server.integ.LdapServerFactory;
import org.apache.directory.server.integ.SiRunner;
-import org.apache.directory.server.ldap.LdapService;
+import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.ldap.handlers.bind.MechanismHandler;
import org.apache.directory.server.ldap.handlers.bind.SimpleMechanismHandler;
import org.apache.directory.server.ldap.handlers.bind.cramMD5.CramMd5MechanismHandler;
@@ -72,12 +72,12 @@
private static final String RDN = "cn=The Person";
- public static LdapService ldapService;
+ public static LdapServer ldapServer;
public static class Factory implements LdapServerFactory
{
- public LdapService newInstance() throws Exception
+ public LdapServer newInstance() throws Exception
{
DirectoryService service = new DefaultDirectoryService();
IntegrationUtils.doDelete( service.getWorkingDirectory() );
@@ -88,14 +88,17 @@
// on the system and somewhere either under target directory
// or somewhere in a temp area of the machine.
- LdapService ldapService = new LdapService();
- ldapService.setDirectoryService( service );
+ LdapServer ldapServer = new LdapServer();
+ ldapServer.setDirectoryService( service );
int port = AvailablePortFinder.getNextAvailable( 1024 );
- ldapService.setTcpTransport( new TcpTransport( port ) );
- ldapService.setEnabled( true );
- ldapService.setEnableLdaps( true );
- ldapService.setConfidentialityRequired( true );
- ldapService.addExtendedOperationHandler( new StoredProcedureExtendedOperationHandler() );
+ TcpTransport tcpTransport = new TcpTransport( port );
+ int portSSL = port + 1;
+ TcpTransport tcpTransportSsl = new TcpTransport( portSSL );
+ tcpTransportSsl.enableSSL( true );
+ ldapServer.setTransports( tcpTransport, tcpTransportSsl );
+ ldapServer.setEnabled( true );
+ ldapServer.setConfidentialityRequired( true );
+ ldapServer.addExtendedOperationHandler( new StoredProcedureExtendedOperationHandler() );
// Setup SASL Mechanisms
@@ -115,9 +118,9 @@
mechanismHandlerMap.put( SupportedSaslMechanisms.NTLM, ntlmMechanismHandler );
mechanismHandlerMap.put( SupportedSaslMechanisms.GSS_SPNEGO, ntlmMechanismHandler );
- ldapService.setSaslMechanismHandlers( mechanismHandlerMap );
+ ldapServer.setSaslMechanismHandlers( mechanismHandlerMap );
- return ldapService;
+ return ldapServer;
}
}
@@ -129,7 +132,7 @@
{
Hashtable<String, String> env = new Hashtable<String, String>();
env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
- env.put( "java.naming.provider.url", "ldap://localhost:" + ldapService.getPort() + "/ou=system" );
+ env.put( "java.naming.provider.url", "ldap://localhost:" + ldapServer.getPortSSL() + "/ou=system" );
env.put( "java.naming.ldap.factory.socket", SSLSocketFactory.class.getName() );
env.put( "java.naming.security.principal", "uid=admin,ou=system" );
env.put( "java.naming.security.credentials", "secret" );
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java Sun Jun 14 09:14:31 2009
@@ -56,7 +56,7 @@
import org.apache.directory.server.core.integ.annotations.CleanupLevel;
import org.apache.directory.server.integ.ServerIntegrationUtils;
import org.apache.directory.server.integ.SiRunner;
-import org.apache.directory.server.ldap.LdapService;
+import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.junit.After;
import org.junit.Before;
@@ -94,7 +94,7 @@
private File ksFile;
- public static LdapService ldapService;
+ public static LdapServer ldapServer;
boolean oldConfidentialityRequiredValue;
@@ -118,7 +118,7 @@
ksFile = File.createTempFile( "testStore", "ks" );
- CoreSession session = ldapService.getDirectoryService().getAdminSession();
+ CoreSession session = ldapServer.getDirectoryService().getAdminSession();
ClonedServerEntry entry = session.lookup( new LdapDN( "uid=admin,ou=system" ), CERT_IDS );
byte[] userCertificate = entry.get( CERT_IDS[0] ).getBytes();
assertNotNull( userCertificate );
@@ -132,7 +132,7 @@
ks.store( new FileOutputStream( ksFile ), "changeit".toCharArray() );
LOG.debug( "Keystore file installed: {}", ksFile.getAbsolutePath() );
- oldConfidentialityRequiredValue = ldapService.isConfidentialityRequired();
+ oldConfidentialityRequiredValue = ldapServer.isConfidentialityRequired();
}
@@ -148,7 +148,7 @@
}
LOG.debug( "Keystore file deleted: {}", ksFile.getAbsolutePath() );
- ldapService.setConfidentialityRequired( oldConfidentialityRequiredValue );
+ ldapServer.setConfidentialityRequired( oldConfidentialityRequiredValue );
}
@@ -164,7 +164,7 @@
env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
// Must use the name of the server that is found in its certificate?
- env.put( Context.PROVIDER_URL, "ldap://localhost:" + ldapService.getPort() );
+ env.put( Context.PROVIDER_URL, "ldap://localhost:" + ldapServer.getPort() );
// Create initial context
LOG.debug( "About to get initial context" );
@@ -192,7 +192,7 @@
@Test
public void testConfidentiality() throws Exception
{
- ldapService.setConfidentialityRequired( true );
+ ldapServer.setConfidentialityRequired( true );
// -------------------------------------------------------------------
// Unsecured bind should fail
@@ -200,7 +200,7 @@
try
{
- ServerIntegrationUtils.getWiredContext( ldapService );
+ ServerIntegrationUtils.getWiredContext( ldapServer );
fail( "Should not get here due to violation of confidentiality requirements" );
}
catch( AuthenticationNotSupportedException e )
@@ -364,7 +364,7 @@
env.put( "java.naming.security.authentication", "simple" );
// Must use the name of the server that is found in its certificate?
- env.put( Context.PROVIDER_URL, "ldap://localhost:" + ldapService.getPort() );
+ env.put( Context.PROVIDER_URL, "ldap://localhost:" + ldapServer.getPort() );
// Create initial context
LOG.debug( "About to get initial context" );
Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Sun Jun 14 09:14:31 2009
@@ -27,15 +27,13 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.ldap.LdapService;
+import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.StringTools;
-import org.apache.mina.core.buffer.IoBuffer;
-import org.apache.mina.core.buffer.SimpleBufferAllocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,39 +68,30 @@
private final List<LdifLoadFilter> ldifFilters = new ArrayList<LdifLoadFilter>();
/** The LDAP server protocol handler */
- private final LdapService ldapService;
-
- /** The LDAPS server protocol handler */
- private final LdapService ldapsService;
+ private final LdapServer ldapServer;
/** The directory service */
- private final DirectoryService directoryService;
+ private DirectoryService directoryService;
/**
* Creates a new instance of the ApacheDS server
*
* @param directoryService
- * @param ldapService
- * @param ldapsService
+ * @param ldapServer
*/
- public ApacheDS( DirectoryService directoryService, LdapService ldapService, LdapService ldapsService )
+ public ApacheDS( LdapServer ldapServer )
{
LOG.info( "Starting the Apache Directory Server" );
+ this.ldapServer = ldapServer;
+
+ directoryService = ldapServer.getDirectoryService();
+
if ( directoryService == null )
{
- this.directoryService = new DefaultDirectoryService();
+ directoryService = new DefaultDirectoryService();
}
- else
- {
- this.directoryService = directoryService;
- }
-
- this.ldapService = ldapService;
- this.ldapsService = ldapsService;
- IoBuffer.setAllocator( new SimpleBufferAllocator() );
- IoBuffer.setUseDirectBuffer( false );
}
@@ -130,29 +119,21 @@
loadLdifs();
// Start the LDAP server
- if ( ldapService != null && ! ldapService.isStarted() )
+ if ( ldapServer != null && ! ldapServer.isStarted() )
{
LOG.debug( "3. Starting the LDAP server" );
- ldapService.start();
+ ldapServer.start();
}
- // Start the LDAPS server
- if ( ldapsService != null && ! ldapsService.isStarted() )
- {
- LOG.debug( "4. Starting the LDAPS server" );
- ldapsService.start();
- }
-
LOG.debug( "Server successfully started" );
}
public boolean isStarted()
{
- if ( ldapService != null || ldapsService != null )
+ if ( ldapServer != null )
{
- return ( ldapService != null && ldapService.isStarted() )
- || ( ldapsService != null && ldapsService.isStarted() );
+ return ( ldapServer.isStarted() );
}
return directoryService.isStarted();
@@ -161,29 +142,18 @@
public void shutdown() throws Exception
{
- if ( ldapService != null && ldapService.isStarted() )
+ if ( ldapServer != null && ldapServer.isStarted() )
{
- ldapService.stop();
- }
-
- if ( ldapsService != null && ldapsService.isStarted() )
- {
- ldapsService.stop();
+ ldapServer.stop();
}
directoryService.shutdown();
}
- public LdapService getLdapService()
+ public LdapServer getLdapServer()
{
- return ldapService;
- }
-
-
- public LdapService getLdapsService()
- {
- return ldapsService;
+ return ldapServer;
}
@@ -216,24 +186,6 @@
}
- public void setAllowAnonymousAccess( boolean allowAnonymousAccess )
- {
- LOG.info( "Set the allowAnonymousAccess flag to {}", allowAnonymousAccess );
-
- directoryService.setAllowAnonymousAccess( allowAnonymousAccess );
-
- if ( ldapService != null )
- {
- ldapService.setAllowAnonymousAccess( allowAnonymousAccess );
- }
-
- if ( ldapsService != null )
- {
- ldapsService.setAllowAnonymousAccess( allowAnonymousAccess );
- }
- }
-
-
public void setLdifDirectory( File ldifDirectory )
{
LOG.info( "The LDIF directory file is {}", ldifDirectory.getAbsolutePath() );
Modified: directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java (original)
+++ directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java Sun Jun 14 09:14:31 2009
@@ -63,14 +63,14 @@
directoryService.addPartition( example );
directoryService.startup();
- LdapService ldapService = new LdapService();
- ldapService.setDirectoryService( directoryService );
- ldapService.setAllowAnonymousAccess( false );
- ldapService.setSocketAcceptor( new SocketAcceptor( null ) );
- ldapService.setEnabled( true );
- ldapService.setIpPort( 20389 );
+ LdapServer ldapServer = new LdapServer();
+ ldapServer.setDirectoryService( directoryService );
+ ldapServer.setAllowAnonymousAccess( false );
+ ldapServer.setSocketAcceptor( new SocketAcceptor( null ) );
+ ldapServer.setEnabled( true );
+ ldapServer.setIpPort( 20389 );
- ApacheDS ads = new ApacheDS( directoryService, ldapService, null );
+ ApacheDS ads = new ApacheDS( directoryService, ldapServer, null );
File f = new File( System.getProperty( "ldifFile" ) );
ads.setLdifDirectory( f );
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java Sun Jun 14 09:14:31 2009
@@ -222,7 +222,7 @@
}
else if ( getApacheDS() != null )
{
- port = getApacheDS().getLdapService().getPort();
+ port = getApacheDS().getLdapServer().getPort();
if ( isDebugEnabled() )
{
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DiagnosticCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DiagnosticCommand.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DiagnosticCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DiagnosticCommand.java Sun Jun 14 09:14:31 2009
@@ -130,7 +130,7 @@
}
else if ( getApacheDS() != null )
{
- port = getApacheDS().getLdapService().getPort();
+ port = getApacheDS().getLdapServer().getPort();
if ( isDebugEnabled() )
{
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DisconnectNotificationCommand.java Sun Jun 14 09:14:31 2009
@@ -228,7 +228,7 @@
}
else if ( getApacheDS() != null )
{
- port = getApacheDS().getLdapService().getPort();
+ port = getApacheDS().getLdapServer().getPort();
if ( isDebugEnabled() )
{
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java Sun Jun 14 09:14:31 2009
@@ -222,7 +222,7 @@
}
else if ( getApacheDS() != null )
{
- port = getApacheDS().getLdapService().getPort();
+ port = getApacheDS().getLdapServer().getPort();
if ( isDebugEnabled() )
{
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java Sun Jun 14 09:14:31 2009
@@ -799,7 +799,7 @@
}
else if ( getApacheDS() != null )
{
- port = getApacheDS().getLdapService().getPort();
+ port = getApacheDS().getLdapServer().getPort();
if ( isDebugEnabled() )
{
Modified: directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Sun Jun 14 09:14:31 2009
@@ -45,7 +45,7 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.jndi.CoreContextFactory;
-import org.apache.directory.server.ldap.LdapService;
+import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.ldap.handlers.bind.MechanismHandler;
import org.apache.directory.server.ldap.handlers.bind.cramMD5.CramMd5MechanismHandler;
import org.apache.directory.server.ldap.handlers.bind.digestMD5.DigestMd5MechanismHandler;
@@ -100,7 +100,7 @@
protected static int nbTests = 10000;
protected DirectoryService directoryService;
protected NioSocketAcceptor socketAcceptor;
- protected LdapService ldapService;
+ protected LdapServer ldapServer;
/**
@@ -254,11 +254,11 @@
directoryService = new DefaultDirectoryService();
directoryService.setShutdownHookEnabled( false );
port = AvailablePortFinder.getNextAvailable( 1024 );
- ldapService = new LdapService();
- ldapService.setTcpTransport( new TcpTransport( port ) );
- ldapService.setDirectoryService( directoryService );
+ ldapServer = new LdapServer();
+ ldapServer.setTransports( new TcpTransport( port ) );
+ ldapServer.setDirectoryService( directoryService );
- setupSaslMechanisms( ldapService );
+ setupSaslMechanisms( ldapServer );
doDelete( directoryService.getWorkingDirectory() );
configureDirectoryService();
@@ -267,15 +267,15 @@
configureLdapServer();
// TODO shouldn't this be before calling configureLdapServer() ???
- ldapService.addExtendedOperationHandler( new StartTlsHandler() );
- ldapService.addExtendedOperationHandler( new StoredProcedureExtendedOperationHandler() );
+ ldapServer.addExtendedOperationHandler( new StartTlsHandler() );
+ ldapServer.addExtendedOperationHandler( new StoredProcedureExtendedOperationHandler() );
- ldapService.start();
+ ldapServer.start();
setContexts( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
}
- private void setupSaslMechanisms( LdapService server )
+ private void setupSaslMechanisms( LdapServer server )
{
Map<String, MechanismHandler> mechanismHandlerMap = new HashMap<String,MechanismHandler>();
@@ -298,7 +298,7 @@
mechanismHandlerMap.put( SupportedSaslMechanisms.NTLM, ntlmMechanismHandler );
mechanismHandlerMap.put( SupportedSaslMechanisms.GSS_SPNEGO, ntlmMechanismHandler );
- ldapService.setSaslMechanismHandlers( mechanismHandlerMap );
+ ldapServer.setSaslMechanismHandlers( mechanismHandlerMap );
}
@@ -384,7 +384,7 @@
protected void tearDown() throws Exception
{
super.tearDown();
- ldapService.stop();
+ ldapServer.stop();
try
{
directoryService.shutdown();
Modified: directory/apacheds/trunk/server-xml/src/main/resources/server.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-xml/src/main/resources/server.xml?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-xml/src/main/resources/server.xml (original)
+++ directory/apacheds/trunk/server-xml/src/main/resources/server.xml Sun Jun 14 09:14:31 2009
@@ -20,7 +20,7 @@
-->
-<spring:beans xmlns="http://apacheds.org/config/${pom.version}"
+<spring:beans xmlns="http://apacheds.org/config/1.5.5-SNAPSHOT"
xmlns:spring="http://xbean.apache.org/schemas/spring/1.0"
xmlns:s="http://www.springframework.org/schema/beans">
@@ -30,6 +30,7 @@
allowAnonymousAccess="true"
accessControlEnabled="false"
denormalizeOpAttrsEnabled="false"
+ syncPeriodMillis="15000"
maxPDUSize="2000000">
<systemPartition>
<!-- use the following partitionConfiguration to override defaults for -->
@@ -105,8 +106,38 @@
</replicationInterceptor>
-->
</interceptors>
+
+ <!-- Uncomment to enable replication configuration -->
+ <!--replicationConfiguration>
+ <providers>
+ <provider id="1 type="refreshAndPersist" timeLimit="1000" sizeLimit="1000">
+ <url>
+ ldap://ldap1.acme.com:10389/ou=data,dc=acme,dc=com?*, +?sub?(objectClass=*)
+ </url>
+ <connection bindMethod="simple">
+ <principal>
+ uid=admin,ou=system
+ </principal>
+ <credentials>secret</credentials>
+ </bind>
+ </provider>
+ <provider id="2 type="refreshAndPersist" timeLimit="1000" sizeLimit="1000">
+ <url>
+ ldaps://ldap2.acme.com:10389/ou=data,dc=acme,dc=com?*, +?sub?(objectClass=*)
+ </url>
+ <connection bindMethod="simple">
+ <principal>
+ uid=admin,ou=system
+ </principal>
+ <credentials>secret</credentials>
+ </bind>
+ </provider>
+ </providers>
+ </replicationConfiguration-->
+
</defaultDirectoryService>
+
<!--
+============================================================+
| ChangePassword server configuration |
@@ -114,12 +145,10 @@
-->
<!-- missing atou=users,dc=example,dc=com
<changePasswordServer id="changePasswordServer">
- <tcpTransport>
+ <transports>
<tcpTransport port="60464" nbThreads="2" backLog="50"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60464" nbThreads="2" backLog="50"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</changePasswordServer>
-->
@@ -131,12 +160,10 @@
-->
<!-- missing atou=users,dc=example,dc=com
<kdcServer id="kdcServer">
- <tcpTransport>
+ <transports>
<tcpTransport port="60088" nbThreads="4" backLog="50"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60088" nbThreads="4" backLog="50"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</kdcServer>
-->
@@ -146,62 +173,45 @@
| NtpServer configuration |
+============================================================+
-->
- <ntpServer>
- <tcpTransport>
+ <!--ntpServer>
+ <transports>
<tcpTransport port="60123"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60123" nbThreads="1"/>
- </udpTransport>
- </ntpServer>
+ </transports>
+ </ntpServer-->
<!--
+============================================================+
| DnsServer configuration |
+============================================================+
-->
-
<!-- missing atou=users,dc=example,dc=com
<dnsServer>
- <tcpTransport>
+ <transports>
<tcpTransport port="8053"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="8053"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</dnsServer>
-->
<!--
+============================================================+
- | LDAPS Service configuration |
- +============================================================+
- -->
- <ldapService id="ldapsService"
- enabled="true"
- enableLdaps="true">
- <tcpTransport>
- <tcpTransport port="10686"/>
- </tcpTransport>
- <directoryService>#directoryService</directoryService>
- </ldapService>
-
- <!--
- +============================================================+
| LDAP Service configuration |
+============================================================+
-->
- <ldapService id="ldapService"
- allowAnonymousAccess="false"
- saslHost="ldap.example.com"
- saslPrincipal="ldap/ldap.example.com@EXAMPLE.COM"
- searchBaseDn="ou=users,ou=system"
- maxTimeLimit="15000"
- maxSizeLimit="1000">
- <tcpTransport>
- <tcpTransport port="10389" nbThreads="8" backLog="50"/>
- </tcpTransport>
+
+ <ldapServer id="ldapServer"
+ allowAnonymousAccess="false"
+ saslHost="ldap.example.com"
+ saslPrincipal="ldap/ldap.example.com@EXAMPLE.COM"
+ searchBaseDn="ou=users,ou=system"
+ maxTimeLimit="15000"
+ maxSizeLimit="1000">
+ <transports>
+ <tcpTransport address="*" port="10389" nbThreads="8" backLog="50" enableSSL="false"/>
+ <tcpTransport address="localhost" port="10686" enableSSL="true"/>
+ </transports>
<directoryService>#directoryService</directoryService>
@@ -236,15 +246,9 @@
<!-- The Stored Procedure Extended Operation is not stable yet and it may cause security risks.-->
<!--storedProcedureExtendedOperationHandler/-->
</extendedOperationHandlers>
- </ldapService>
+ </ldapServer>
-
- <apacheDS id="apacheDS"
- synchPeriodMillis="15000"
- allowAnonymousAccess="false">
-
- <directoryService>#directoryService</directoryService>
- <ldapService>#ldapService</ldapService>
- <ldapsService>#ldapsService</ldapsService>
+ <apacheDS id="apacheDS">
+ <ldapServer>#ldapServer</ldapServer>
</apacheDS>
</spring:beans>
Modified: directory/apacheds/trunk/server-xml/src/main/resources/serverAuthenticatorInAuthenticationInterceptor.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-xml/src/main/resources/serverAuthenticatorInAuthenticationInterceptor.xml?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-xml/src/main/resources/serverAuthenticatorInAuthenticationInterceptor.xml (original)
+++ directory/apacheds/trunk/server-xml/src/main/resources/serverAuthenticatorInAuthenticationInterceptor.xml Sun Jun 14 09:14:31 2009
@@ -20,7 +20,7 @@
-->
-<spring:beans xmlns="http://apacheds.org/config/${pom.version}"
+<spring:beans xmlns="http://apacheds.org/config/1.5.5-SNAPSHOT"
xmlns:spring="http://xbean.apache.org/schemas/spring/1.0"
xmlns:s="http://www.springframework.org/schema/beans">
@@ -29,6 +29,7 @@
allowAnonymousAccess="true"
accessControlEnabled="false"
denormalizeOpAttrsEnabled="false"
+ syncPeriodMillis="15000"
maxPDUSize="2000000">
<systemPartition>
<!-- use the following partitionConfiguration to override defaults for -->
@@ -123,13 +124,11 @@
+============================================================+
-->
<!-- missing atou=users,dc=example,dc=com
- <changePasswordServer>
- <tcpTransport>
+ <changePasswordServer id="changePasswordServer">
+ <transports>
<tcpTransport port="60464" nbThreads="2" backLog="50"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60464" nbThreads="2" backLog="50"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</changePasswordServer>
-->
@@ -141,12 +140,11 @@
-->
<!-- missing atou=users,dc=example,dc=com
<kdcServer>
- <tcpTransport>
+ <kdcServer id="kdcServer">
+ <transports>
<tcpTransport port="60088" nbThreads="4" backLog="50"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60088" nbThreads="4" backLog="50"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</kdcServer>
-->
@@ -156,65 +154,44 @@
| NtpServer configuration |
+============================================================+
-->
- <ntpServer>
- <tcpTransport>
+ <!--ntpServer>
+ <transports>
<tcpTransport port="60123"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60123" nbThreads="1"/>
- </udpTransport>
- </ntpServer>
+ </transports>
+ </ntpServer-->
<!--
+============================================================+
| DnsServer configuration |
+============================================================+
-->
-
<!-- missing atou=users,dc=example,dc=com
<dnsServer>
- <tcpTransport>
+ <transports>
<tcpTransport port="8053"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="8053"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</dnsServer>
-->
<!--
+============================================================+
- | LDAPS Service configuration |
- +============================================================+
- -->
- <ldapService id="ldapsService"
- enabled="true"
- enableLdaps="true">
-
- <tcpTransport>
- <tcpTransport port="10686" nbThreads="8" backLog="50"/>
- </tcpTransport>
-
- <directoryService>#directoryService</directoryService>
- </ldapService>
-
- <!--
- +============================================================+
| LDAP Service configuration |
+============================================================+
-->
- <ldapService id="ldapService"
+ <ldapServer id="ldapServer"
allowAnonymousAccess="false"
saslHost="ldap.example.com"
saslPrincipal="ldap/ldap.example.com@EXAMPLE.COM"
searchBaseDn="ou=users,ou=system"
maxTimeLimit="15000"
maxSizeLimit="1000">
-
- <tcpTransport>
- <tcpTransport port="10389" nbThreads="8" backLog="50"/>
- </tcpTransport>
+ <transports>
+ <tcpTransport id="tcp-ldap" port="10389" nbThreads="8" backLog="50" enableSSL="false"/>
+ <tcpTransport id="tcp-ldaps" port="10686" enableSSL="true"/>
+ </transports>
<directoryService>#directoryService</directoryService>
@@ -249,15 +226,9 @@
<!-- The Stored Procedure Extended Operation is not stable yet and it may cause security risks.-->
<!--storedProcedureExtendedOperationHandler/-->
</extendedOperationHandlers>
- </ldapService>
+ </ldapServer>
-
- <apacheDS id="apacheDS"
- synchPeriodMillis="15000"
- allowAnonymousAccess="false">
-
- <directoryService>#directoryService</directoryService>
- <ldapService>#ldapService</ldapService>
- <ldapsService>#ldapsService</ldapsService>
+ <apacheDS id="apacheDS">
+ <ldapServer>#ldapServer</ldapServer>
</apacheDS>
</spring:beans>
Modified: directory/apacheds/trunk/server-xml/src/main/resources/serverJdbmPartition.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-xml/src/main/resources/serverJdbmPartition.xml?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-xml/src/main/resources/serverJdbmPartition.xml (original)
+++ directory/apacheds/trunk/server-xml/src/main/resources/serverJdbmPartition.xml Sun Jun 14 09:14:31 2009
@@ -20,7 +20,7 @@
-->
-<spring:beans xmlns="http://apacheds.org/config/${pom.version}"
+<spring:beans xmlns="http://apacheds.org/config/1.5.5-SNAPSHOT"
xmlns:spring="http://xbean.apache.org/schemas/spring/1.0"
xmlns:s="http://www.springframework.org/schema/beans">
@@ -29,6 +29,7 @@
allowAnonymousAccess="true"
accessControlEnabled="false"
denormalizeOpAttrsEnabled="false"
+ syncPeriodMillis="15000"
maxPDUSize="2000000">
<systemPartition>
<!-- use the following partitionConfiguration to override defaults for -->
@@ -63,8 +64,8 @@
<jdbmIndex attributeId="apacheOneAlias" cacheSize="10"/>
<jdbmIndex attributeId="apacheSubAlias" cacheSize="10"/>
<jdbmIndex attributeId="apacheAlias" cacheSize="10"/>
- <jdbmIndex attributeId="objectClass" cacheSize="100" numDupLimit="100" wkDirPath="/tmp"/>
- <jdbmIndex attributeId="dc" cacheSize="100"/>
+ <jdbmIndex attributeId="objectClass" cacheSize="100" numDupLimit="100"/>
+ <jdbmIndex attributeId="dc" cacheSize="100" wkDirPath="/tmp"/>
<jdbmIndex attributeId="ou" cacheSize="100"/>
<jdbmIndex attributeId="krb5PrincipalName" cacheSize="100"/>
<jdbmIndex attributeId="uid" cacheSize="100"/>
@@ -112,13 +113,11 @@
+============================================================+
-->
<!-- missing atou=users,dc=example,dc=com
- <changePasswordServer>
- <tcpTransport>
+ <changePasswordServer id="changePasswordServer">
+ <transports>
<tcpTransport port="60464" nbThreads="2" backLog="50"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60464" nbThreads="2" backLog="50"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</changePasswordServer>
-->
@@ -129,13 +128,11 @@
+============================================================+
-->
<!-- missing atou=users,dc=example,dc=com
- <kdcServer>
- <tcpTransport>
+ <kdcServer id="kdcServer">
+ <transports>
<tcpTransport port="60088" nbThreads="4" backLog="50"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60088" nbThreads="4" backLog="50"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</kdcServer>
-->
@@ -145,65 +142,44 @@
| NtpServer configuration |
+============================================================+
-->
- <ntpServer>
- <tcpTransport>
+ <!--ntpServer>
+ <transports>
<tcpTransport port="60123"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="60123" nbThreads="1"/>
- </udpTransport>
- </ntpServer>
+ </transports>
+ </ntpServer-->
<!--
+============================================================+
| DnsServer configuration |
+============================================================+
-->
-
<!-- missing atou=users,dc=example,dc=com
<dnsServer>
- <tcpTransport>
+ <transports>
<tcpTransport port="8053"/>
- </tcpTransport>
- <udpTransport>
<udpTransport port="8053"/>
- </udpTransport>
+ </transports>
<directoryService>#directoryService</directoryService>
</dnsServer>
-->
<!--
+============================================================+
- | LDAPS Service configuration |
- +============================================================+
- -->
- <ldapService id="ldapsService"
- enabled="true"
- enableLdaps="true">
-
- <tcpTransport>
- <tcpTransport port="10686" nbThreads="8" backLog="50"/>
- </tcpTransport>
-
- <directoryService>#directoryService</directoryService>
- </ldapService>
-
- <!--
- +============================================================+
| LDAP Service configuration |
+============================================================+
-->
- <ldapService id="ldapService"
+ <ldapServer id="ldapServer"
allowAnonymousAccess="false"
saslHost="ldap.example.com"
saslPrincipal="ldap/ldap.example.com@EXAMPLE.COM"
searchBaseDn="ou=users,ou=system"
maxTimeLimit="15000"
maxSizeLimit="1000">
-
- <tcpTransport>
- <tcpTransport port="10389" nbThreads="8" backLog="50"/>
- </tcpTransport>
+ <transports>
+ <tcpTransport port="10389" nbThreads="8" backLog="50" enableSSL="false"/>
+ <tcpTransport port="10686" enableSSL="true"/>
+ </transports>
<directoryService>#directoryService</directoryService>
@@ -238,15 +214,9 @@
<!-- The Stored Procedure Extended Operation is not stable yet and it may cause security risks.-->
<!--storedProcedureExtendedOperationHandler/-->
</extendedOperationHandlers>
- </ldapService>
-
+ </ldapServer>
- <apacheDS id="apacheDS"
- synchPeriodMillis="15000"
- allowAnonymousAccess="false">
-
- <directoryService>#directoryService</directoryService>
- <ldapService>#ldapService</ldapService>
- <ldapsService>#ldapsService</ldapsService>
+ <apacheDS id="apacheDS">
+ <ldapServer>#ldapServer</ldapServer>
</apacheDS>
</spring:beans>
Modified: directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java (original)
+++ directory/apacheds/trunk/server-xml/src/test/java/org/apache/directory/server/SpringServerTest.java Sun Jun 14 09:14:31 2009
@@ -24,15 +24,14 @@
import org.apache.directory.server.core.authn.SimpleAuthenticator;
import org.apache.directory.server.core.authn.StrongAuthenticator;
import org.apache.directory.server.core.interceptor.Interceptor;
-import org.apache.directory.server.ldap.replication.SyncreplConfiguration;
import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -172,7 +171,8 @@
@Test
public void testSpringServerJdbmPartition() throws Exception {
// NOTE : This test will only work on systems which have a /tmp temp dir
- if ( "/tmp".equals( getTmpDir() ) )
+ File tmpDir = getTmpDir();
+ if ( "/tmp".equals( tmpDir.getCanonicalPath() ) )
{
ClassLoader classLoader = this.getClass().getClassLoader();
URL configURL = classLoader.getResource( "serverJdbmPartition.xml" );
@@ -186,10 +186,10 @@
// Now, launch the server, and check that the ObjectClass index has been created in OS' tmp directory
apacheDS.startup();
- File tmpOCdb = new File( getTmpDir(), "objectClass.db" );
+ File tmpOCdb = new File( tmpDir, "dc.db" );
assertTrue( tmpOCdb.exists() );
- File tmpOClg = new File( getTmpDir(), "objectClass.lg" );
+ File tmpOClg = new File( tmpDir, "dc.lg" );
assertTrue( tmpOClg.exists() );
// Shutdown and cleanup
@@ -211,7 +211,7 @@
* @return
* The OS specific tmp dir
*/
- private File getTmpDir()
+ private File getTmpDir() throws IOException
{
return new File( System.getProperty( "java.io.tmpdir" ) );
}
Modified: directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java
URL: http://svn.apache.org/viewvc/directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java (original)
+++ directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java Sun Jun 14 09:14:31 2009
@@ -21,16 +21,18 @@
import java.io.File;
+import java.io.IOException;
+
+import javax.naming.NamingException;
import org.apache.directory.daemon.DaemonApplication;
import org.apache.directory.daemon.InstallationLayout;
import org.apache.directory.server.changepw.ChangePasswordServer;
-import org.apache.directory.server.configuration.ApacheDS;
import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.dns.DnsServer;
import org.apache.directory.server.kerberos.kdc.KdcServer;
-import org.apache.directory.server.ldap.LdapService;
+import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.ntp.NtpServer;
import org.apache.directory.server.protocol.shared.transport.TcpTransport;
import org.apache.xbean.spring.context.FileSystemXmlApplicationContext;
@@ -49,11 +51,8 @@
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( Service.class );
- private Thread workerThread;
- private SynchWorker worker = new SynchWorker();
-
/** The LDAP server instance */
- private ApacheDS apacheDS;
+ private LdapServer ldapServer;
/** The NTP server instance */
private NtpServer ntpServer;
@@ -82,7 +81,7 @@
// initDns( install, args );
// Initialize the DHCP server (Not ready yet)
- //initDhcp( install, args );
+ // initDhcp( install, args );
// Initialize the ChangePwd server (Not ready yet)
initChangePwd( install, args );
@@ -106,36 +105,29 @@
{
LOG.info( "server: loading settings from ", args[0] );
factory = new FileSystemXmlApplicationContext( new File( args[0] ).toURI().toURL().toString() );
- apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" );
+ ldapServer = ( LdapServer ) factory.getBean( "ldapServer" );
}
else
{
LOG.info( "server: using default settings ..." );
DirectoryService directoryService = new DefaultDirectoryService();
directoryService.startup();
- LdapService ldapService = new LdapService();
- ldapService.setDirectoryService( directoryService );
- ldapService.setTcpTransport( new TcpTransport( 10389 ) );
- ldapService.start();
- LdapService ldapsService = new LdapService();
- ldapsService.setTcpTransport( new TcpTransport( 10636 ) );
- ldapsService.setEnableLdaps( true );
- ldapsService.setDirectoryService( directoryService );
- ldapsService.start();
- apacheDS = new ApacheDS( directoryService, ldapService, ldapsService );
+ ldapServer = new LdapServer();
+ ldapServer.setDirectoryService( directoryService );
+ TcpTransport tcpTransportSsl = new TcpTransport( 10636 );
+ tcpTransportSsl.enableSSL( true );
+ ldapServer.setTransports( new TcpTransport( 10389 ), tcpTransportSsl );
+ ldapServer.start();
}
if ( install != null )
{
- apacheDS.getDirectoryService().setWorkingDirectory( install.getPartitionsDirectory() );
+ ldapServer.getDirectoryService().setWorkingDirectory( install.getPartitionsDirectory() );
}
- apacheDS.startup();
+ // And start the server now
+ start();
- if ( apacheDS.getSynchPeriodMillis() > 0 )
- {
- workerThread = new Thread( worker, "SynchWorkerThread" );
- }
if ( LOG.isInfoEnabled() )
{
@@ -245,6 +237,7 @@
kdcServer.start();
System.out.println( "Kerberos server started" );
+
if ( LOG.isInfoEnabled() )
{
LOG.info( "Kerberos server: started in {} milliseconds", ( System.currentTimeMillis() - startTime ) + "" );
@@ -288,47 +281,42 @@
public DirectoryService getDirectoryService() {
- return apacheDS.getDirectoryService();
+ return ldapServer.getDirectoryService();
}
public void synch() throws Exception
{
- apacheDS.getDirectoryService().sync();
+ ldapServer.getDirectoryService().sync();
}
public void start()
{
- if ( workerThread != null )
+ try
{
- workerThread.start();
+ ldapServer.start();
+ }
+ catch ( Exception e )
+ {
+ LOG.error( "Cannot start the server : " + e.getMessage() );
}
}
public void stop( String[] args ) throws Exception
{
- if ( workerThread != null )
- {
- worker.stop = true;
- synchronized ( worker.lock )
- {
- worker.lock.notify();
- }
-
- while ( workerThread.isAlive() )
- {
- LOG.info( "Waiting for SynchWorkerThread to die." );
- workerThread.join( 500 );
- }
- }
if (factory != null)
{
factory.close();
}
- apacheDS.shutdown();
+
+ // Stops the server
+ ldapServer.stop();
+
+ // We now have to stop the underlaying DirectoryService
+ ldapServer.getDirectoryService().shutdown();
}
@@ -337,39 +325,6 @@
}
- class SynchWorker implements Runnable
- {
- final Object lock = new Object();
- boolean stop;
-
-
- public void run()
- {
- while ( !stop )
- {
- synchronized ( lock )
- {
- try
- {
- lock.wait( apacheDS.getSynchPeriodMillis() );
- }
- catch ( InterruptedException e )
- {
- LOG.warn( "SynchWorker failed to wait on lock.", e );
- }
- }
-
- try
- {
- synch();
- }
- catch ( Exception e )
- {
- LOG.error( "SynchWorker failed to synch directory.", e );
- }
- }
- }
- }
private static final String BANNER_LDAP =
" _ _ ____ ____ \n"
Modified: directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/UberjarMain.java
URL: http://svn.apache.org/viewvc/directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/UberjarMain.java?rev=784530&r1=784529&r2=784530&view=diff
==============================================================================
--- directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/UberjarMain.java (original)
+++ directory/installers/trunk/apacheds-noarch/src/main/java/org/apache/directory/server/UberjarMain.java Sun Jun 14 09:14:31 2009
@@ -42,24 +42,24 @@
*/
public static void main( String[] args ) throws Exception
{
- Service server = new Service();
+ Service service = new Service();
if ( args.length > 0 && new File( args[0] ).isDirectory() )
{
InstallationLayout layout = new InstallationLayout( args[0] );
String confFile = layout.getConfigurationFile().toURI().toURL().toString();
- server.init( layout, new String[] { confFile } );
- server.start();
+ service.init( layout, new String[] { confFile } );
+ service.start();
}
else if ( args.length > 0 && new File( args[0] ).isFile() )
{
- server.init( null, args );
- server.start();
+ service.init( null, args );
+ service.start();
}
else
{
- server.init( null, null );
- server.start();
+ service.init( null, null );
+ service.start();
}
}
}