You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dj...@apache.org on 2007/10/11 07:10:50 UTC
svn commit: r583683 - in /directory/apacheds/branches/bigbang:
protocol-changepw/
protocol-changepw/src/main/java/org/apache/directory/server/changepw/
protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/
protocol-dns/ protoco...
Author: djencks
Date: Wed Oct 10 22:10:48 2007
New Revision: 583683
URL: http://svn.apache.org/viewvc?rev=583683&view=rev
Log:
Move to direct use of acceptors in protocol servers
Added:
directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java (with props)
directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java (with props)
directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java (with props)
Removed:
directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java
directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java
directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java
Modified:
directory/apacheds/branches/bigbang/protocol-changepw/pom.xml
directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java
directory/apacheds/branches/bigbang/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java
directory/apacheds/branches/bigbang/protocol-dns/pom.xml
directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsConfiguration.java
directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java
directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml
directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcConfiguration.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
directory/apacheds/branches/bigbang/protocol-ntp/pom.xml
directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java
directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/package-info.java
directory/apacheds/branches/bigbang/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java
directory/apacheds/branches/bigbang/protocol-shared/pom.xml
directory/apacheds/branches/bigbang/server-xml/src/main/resources/server.xml
Modified: directory/apacheds/branches/bigbang/protocol-changepw/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/pom.xml?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/pom.xml Wed Oct 10 22:10:48 2007
@@ -38,11 +38,6 @@
<artifactId>apacheds-kerberos-shared</artifactId>
<version>${pom.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-server-jndi</artifactId>
- <version>${pom.version}</version>
- </dependency>
</dependencies>
</project>
Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java Wed Oct 10 22:10:48 2007
@@ -20,22 +20,22 @@
package org.apache.directory.server.changepw;
+import java.io.IOException;
+import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
-import java.net.InetSocketAddress;
-import java.io.IOException;
import javax.security.auth.kerberos.KerberosPrincipal;
-import org.apache.directory.server.configuration.ApacheDS;
+import org.apache.directory.server.changepw.protocol.ChangePasswordProtocolHandler;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
import org.apache.directory.server.kerberos.shared.store.JndiPrincipalStoreImpl;
import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
import org.apache.directory.server.protocol.shared.ServiceConfiguration;
-import org.apache.directory.server.changepw.protocol.ChangePasswordProtocolHandler;
-import org.apache.mina.common.ThreadModel;
+import org.apache.mina.transport.socket.nio.DatagramAcceptor;
import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
@@ -112,16 +112,21 @@
/** The policy for token size. */
private int policyTokenSize;
- private DirectoryService directoryService;
+ private final DirectoryService directoryService;
- private ApacheDS apacheDS;
+ private final DatagramAcceptor datagramAcceptor;
+ private final SocketAcceptor socketAcceptor;
/**
* Creates a new instance of ChangePasswordConfiguration.
*/
- public ChangePasswordLDAPServers()
+ public ChangePasswordLDAPServers( DatagramAcceptor datagramAcceptor, SocketAcceptor socketAcceptor, DirectoryService directoryService )
{
+ this.datagramAcceptor = datagramAcceptor;
+ this.socketAcceptor = socketAcceptor;
+ this.directoryService = directoryService;
+
super.setServiceName( SERVICE_NAME_DEFAULT );
super.setIpPort( IP_PORT_DEFAULT );
super.setServicePid( SERVICE_PID_DEFAULT );
@@ -264,26 +269,6 @@
}
- public DirectoryService getDirectoryService()
- {
- return directoryService;
- }
-
- public void setDirectoryService( DirectoryService directoryService )
- {
- this.directoryService = directoryService;
- }
-
- public ApacheDS getApacheDS()
- {
- return apacheDS;
- }
-
- public void setApacheDS( ApacheDS apacheDS )
- {
- this.apacheDS = apacheDS;
- }
-
/**
* @org.apache.xbean.InitMethod
*/
@@ -291,23 +276,33 @@
{
PrincipalStore store = new JndiPrincipalStoreImpl( getCatalogBaseDn(), getSearchBaseDn(), directoryService );
- DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
- udpConfig.setThreadModel( ThreadModel.MANUAL );
- apacheDS.getUdpAcceptor().bind( new InetSocketAddress( getIpPort() ), new ChangePasswordProtocolHandler( this, store ), udpConfig );
-
- SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
- tcpConfig.setDisconnectOnUnbind( false );
- tcpConfig.setReuseAddress( true );
- tcpConfig.setThreadModel( ThreadModel.MANUAL );
- apacheDS.getTcpAcceptor().bind( new InetSocketAddress( getIpPort() ), new ChangePasswordProtocolHandler( this, store ), tcpConfig );
+ if ( datagramAcceptor != null )
+ {
+ DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
+ datagramAcceptor.bind( new InetSocketAddress( getIpPort() ), new ChangePasswordProtocolHandler( this, store ), udpConfig );
+ }
+
+ if ( socketAcceptor != null )
+ {
+ SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
+ tcpConfig.setDisconnectOnUnbind( false );
+ tcpConfig.setReuseAddress( true );
+ socketAcceptor.bind( new InetSocketAddress( getIpPort() ), new ChangePasswordProtocolHandler( this, store ), tcpConfig );
+ }
}
/**
* @org.apache.xbean.DestroyMethod
*/
public void stop() {
- apacheDS.getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
- apacheDS.getTcpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
+ if ( datagramAcceptor != null )
+ {
+ datagramAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
+ if ( socketAcceptor != null )
+ {
+ socketAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
}
private void prepareEncryptionTypes()
Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java Wed Oct 10 22:10:48 2007
@@ -30,7 +30,6 @@
import javax.security.auth.kerberos.KerberosPrincipal;
import junit.framework.TestCase;
-
import org.apache.directory.server.changepw.ChangePasswordLDAPServers;
import org.apache.directory.server.changepw.io.ChangePasswordDataEncoder;
import org.apache.directory.server.changepw.messages.ChangePasswordError;
@@ -78,8 +77,10 @@
*/
public class ChangepwProtocolHandlerTest extends TestCase
{
- /** The Change Password SUCCESS result code. */
- // Never used...
+ /**
+ * The Change Password SUCCESS result code.
+ */
+ // Never used...
//private static final byte[] SUCCESS = new byte[]
// { ( byte ) 0x00, ( byte ) 0x00 };
@@ -96,7 +97,7 @@
*/
public ChangepwProtocolHandlerTest()
{
- config = new ChangePasswordLDAPServers();
+ config = new ChangePasswordLDAPServers( null, null, null );
store = new MapPrincipalStoreImpl();
handler = new ChangePasswordProtocolHandler( config, store );
session = new DummySession();
@@ -137,8 +138,8 @@
/**
* Tests when the INITIAL flag is missing that the request is rejected with
* the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testInitialFlagRequired() throws Exception
{
@@ -165,7 +166,7 @@
modifier.setSubSessionKey( subSessionKey );
EncryptedData encryptedAuthenticator = cipherTextHandler.seal( serviceTicket.getSessionKey(), modifier
- .getAuthenticator(), KeyUsage.NUMBER11 );
+ .getAuthenticator(), KeyUsage.NUMBER11 );
ApplicationRequest apReq = new ApplicationRequest( apOptions, serviceTicket, encryptedAuthenticator );
@@ -189,30 +190,30 @@
/**
* TODO : Check if this method is important or not. It was called in
* the testInitialFlagRequired() method above, but this call has been commented
- private void processChangePasswordReply( ChangePasswordReply reply, EncryptionKey sessionKey,
- EncryptionKey subSessionKey ) throws Exception
- {
- PrivateMessage privateMessage = reply.getPrivateMessage();
-
- EncryptedData encPrivPart = privateMessage.getEncryptedPart();
-
- EncKrbPrivPart privPart;
-
- try
- {
- privPart = ( EncKrbPrivPart ) cipherTextHandler.unseal( EncKrbPrivPart.class, subSessionKey, encPrivPart,
- KeyUsage.NUMBER13 );
- }
- catch ( KerberosException ke )
- {
- return;
- }
-
- // Verify result code.
- byte[] resultCode = privPart.getUserData();
-
- assertTrue( "Password change returned SUCCESS (0x00 0x00).", Arrays.equals( SUCCESS, resultCode ) );
- }
+ * private void processChangePasswordReply( ChangePasswordReply reply, EncryptionKey sessionKey,
+ * EncryptionKey subSessionKey ) throws Exception
+ * {
+ * PrivateMessage privateMessage = reply.getPrivateMessage();
+ * <p/>
+ * EncryptedData encPrivPart = privateMessage.getEncryptedPart();
+ * <p/>
+ * EncKrbPrivPart privPart;
+ * <p/>
+ * try
+ * {
+ * privPart = ( EncKrbPrivPart ) cipherTextHandler.unseal( EncKrbPrivPart.class, subSessionKey, encPrivPart,
+ * KeyUsage.NUMBER13 );
+ * }
+ * catch ( KerberosException ke )
+ * {
+ * return;
+ * }
+ * <p/>
+ * // Verify result code.
+ * byte[] resultCode = privPart.getUserData();
+ * <p/>
+ * assertTrue( "Password change returned SUCCESS (0x00 0x00).", Arrays.equals( SUCCESS, resultCode ) );
+ * }
*/
@@ -239,7 +240,7 @@
modifier.setClientMicroSecond( 0 );
EncryptedData encryptedAuthenticator = cipherTextHandler.seal( serverKey, modifier.getAuthenticator(),
- KeyUsage.NUMBER11 );
+ KeyUsage.NUMBER11 );
ApplicationRequest apReq = new ApplicationRequest( apOptions, serviceTicket, encryptedAuthenticator );
@@ -261,7 +262,7 @@
* Legacy kpasswd (Change Password) version. User data is the password bytes.
*/
private PrivateMessage getChangePasswordPrivateMessage( String newPassword, EncryptionKey subSessionKey )
- throws UnsupportedEncodingException, KerberosException, UnknownHostException
+ throws UnsupportedEncodingException, KerberosException, UnknownHostException
{
// Make private message part.
EncKrbPrivPartModifier privPartModifier = new EncKrbPrivPartModifier();
@@ -286,8 +287,8 @@
* Set/Change Password version. User data is an encoding of the new password and the target principal.
*/
private PrivateMessage getSetPasswordPrivateMessage( String newPassword, EncryptionKey subSessionKey,
- PrincipalName targetPrincipalName ) throws UnsupportedEncodingException, KerberosException,
- UnknownHostException, IOException
+ PrincipalName targetPrincipalName ) throws UnsupportedEncodingException, KerberosException,
+ UnknownHostException, IOException
{
// Make private message part.
EncKrbPrivPartModifier privPartModifier = new EncKrbPrivPartModifier();
Modified: directory/apacheds/branches/bigbang/protocol-dns/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/pom.xml?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-dns/pom.xml Wed Oct 10 22:10:48 2007
@@ -34,10 +34,12 @@
<dependencies>
+<!-- should be transitive now
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
</dependency>
+-->
<dependency>
@@ -49,11 +51,6 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-shared</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-server-jndi</artifactId>
<version>${pom.version}</version>
</dependency>
</dependencies>
Modified: directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsConfiguration.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsConfiguration.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsConfiguration.java Wed Oct 10 22:10:48 2007
@@ -23,15 +23,15 @@
import java.io.IOException;
import java.net.InetSocketAddress;
-import org.apache.directory.server.protocol.shared.ServiceConfiguration;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.dns.protocol.DnsProtocolHandler;
import org.apache.directory.server.dns.store.RecordStore;
import org.apache.directory.server.dns.store.jndi.JndiRecordStoreImpl;
-import org.apache.directory.server.configuration.ApacheDS;
+import org.apache.directory.server.protocol.shared.ServiceConfiguration;
+import org.apache.mina.transport.socket.nio.DatagramAcceptor;
import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
-import org.apache.mina.common.ThreadModel;
/**
@@ -55,17 +55,18 @@
/** The default service name. */
private static final String SERVICE_NAME_DEFAULT = "ApacheDS DNS Service";
- private DirectoryService directoryService;
-
- private ApacheDS apacheDS;
+ private final DirectoryService directoryService;
+ private final DatagramAcceptor datagramAcceptor;
+ private final SocketAcceptor socketAcceptor;
/**
* Creates a new instance of DnsConfiguration.
*/
- public DnsConfiguration( ApacheDS apacheDS, DirectoryService directoryService)
+ public DnsConfiguration( DatagramAcceptor datagramAcceptor, SocketAcceptor socketAcceptor, DirectoryService directoryService)
{
- this.apacheDS = apacheDS;
+ this.datagramAcceptor = datagramAcceptor;
+ this.socketAcceptor = socketAcceptor;
this.directoryService = directoryService;
super.setIpPort( IP_PORT_DEFAULT );
super.setServicePid( SERVICE_PID_DEFAULT );
@@ -79,22 +80,32 @@
{
RecordStore store = new JndiRecordStoreImpl( getCatalogBaseDn(), getSearchBaseDn(), directoryService );
- DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
- udpConfig.setThreadModel( ThreadModel.MANUAL );
- apacheDS.getUdpAcceptor().bind( new InetSocketAddress( getIpPort() ), new DnsProtocolHandler( this, store ), udpConfig );
-
- SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
- tcpConfig.setDisconnectOnUnbind( false );
- tcpConfig.setReuseAddress( true );
- tcpConfig.setThreadModel( ThreadModel.MANUAL );
- apacheDS.getTcpAcceptor().bind( new InetSocketAddress( getIpPort() ), new DnsProtocolHandler( this, store ), tcpConfig );
+ if ( datagramAcceptor != null )
+ {
+ DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
+ datagramAcceptor.bind( new InetSocketAddress( getIpPort() ), new DnsProtocolHandler( this, store ), udpConfig );
+ }
+
+ if ( socketAcceptor != null )
+ {
+ SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
+ tcpConfig.setDisconnectOnUnbind( false );
+ tcpConfig.setReuseAddress( true );
+ socketAcceptor.bind( new InetSocketAddress( getIpPort() ), new DnsProtocolHandler( this, store ), tcpConfig );
+ }
}
/**
* @org.apache.xbean.DestroyMethod
*/
public void stop() {
- apacheDS.getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
- apacheDS.getTcpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
+ if ( datagramAcceptor != null )
+ {
+ datagramAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
+ if ( socketAcceptor != null )
+ {
+ socketAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
}
}
Modified: directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java Wed Oct 10 22:10:48 2007
@@ -20,20 +20,12 @@
package org.apache.directory.server.dns;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.directory.server.dns.store.RecordStore;
-import org.apache.directory.server.dns.store.RecordStoreStub;
-import org.apache.directory.server.configuration.ApacheDS;
-import org.apache.directory.server.core.DirectoryService;
+import java.io.IOException;
+
import org.apache.directory.server.core.DefaultDirectoryService;
-import org.apache.mina.common.ExecutorThreadModel;
-import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.transport.socket.nio.DatagramAcceptor;
-import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
-import org.apache.mina.transport.socket.nio.SocketAcceptor;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.protocol.shared.DatagramAcceptor;
+import org.apache.directory.server.protocol.shared.SocketAcceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,16 +56,15 @@
/**
* Start an instance of the DNS server.
*/
- public void go()
+ public void go() throws IOException
{
- ApacheDS apacheDS = new ApacheDS();
+ DatagramAcceptor datagramAcceptor = new DatagramAcceptor( null );
+ SocketAcceptor socketAcceptor = new SocketAcceptor( null );
DirectoryService directoryService = new DefaultDirectoryService();
- dnsConfiguration = new DnsConfiguration( apacheDS, directoryService );
+ dnsConfiguration = new DnsConfiguration( datagramAcceptor, socketAcceptor, directoryService );
dnsConfiguration.setEnabled( true );
dnsConfiguration.setIpPort( 10053 );
-
- RecordStore store = new RecordStoreStub();
-
+ dnsConfiguration.start();
}
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml Wed Oct 10 22:10:48 2007
@@ -40,11 +40,6 @@
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-server-jndi</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-unit</artifactId>
<version>${pom.version}</version>
<scope>test</scope>
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcConfiguration.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcConfiguration.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcConfiguration.java Wed Oct 10 22:10:48 2007
@@ -20,22 +20,22 @@
package org.apache.directory.server.kerberos.kdc;
+import java.io.IOException;
+import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
-import java.net.InetSocketAddress;
-import java.io.IOException;
import javax.security.auth.kerberos.KerberosPrincipal;
-import org.apache.directory.server.configuration.ApacheDS;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler;
import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
import org.apache.directory.server.kerberos.shared.store.JndiPrincipalStoreImpl;
import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
-import org.apache.directory.server.kerberos.protocol.KerberosProtocolHandler;
import org.apache.directory.server.protocol.shared.ServiceConfiguration;
-import org.apache.mina.common.ThreadModel;
+import org.apache.mina.transport.socket.nio.DatagramAcceptor;
import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
@@ -142,15 +142,19 @@
/** Whether to verify the body checksum. */
private boolean isBodyChecksumVerified = DEFAULT_VERIFY_BODY_CHECKSUM;
- private DirectoryService directoryService;
- private ApacheDS apacheDS;
+ private final DirectoryService directoryService;
+ private final DatagramAcceptor datagramAcceptor;
+ private final SocketAcceptor socketAcceptor;
/**
* Creates a new instance of KdcConfiguration.
*/
- public KdcConfiguration()
+ public KdcConfiguration( DatagramAcceptor datagramAcceptor, SocketAcceptor socketAcceptor, DirectoryService directoryService)
{
+ this.datagramAcceptor = datagramAcceptor;
+ this.socketAcceptor = socketAcceptor;
+ this.directoryService = directoryService;
super.setServiceName( DEFAULT_NAME );
super.setIpPort( DEFAULT_IP_PORT );
super.setServicePid( DEFAULT_PID );
@@ -404,26 +408,6 @@
}
- public DirectoryService getDirectoryService()
- {
- return directoryService;
- }
-
- public void setDirectoryService( DirectoryService directoryService )
- {
- this.directoryService = directoryService;
- }
-
- public ApacheDS getApacheDS()
- {
- return apacheDS;
- }
-
- public void setApacheDS( ApacheDS apacheDS )
- {
- this.apacheDS = apacheDS;
- }
-
/**
* @org.apache.xbean.InitMethod
*/
@@ -431,23 +415,33 @@
{
PrincipalStore store = new JndiPrincipalStoreImpl( getCatalogBaseDn(), getSearchBaseDn(), directoryService );
- DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
- udpConfig.setThreadModel( ThreadModel.MANUAL );
- apacheDS.getUdpAcceptor().bind( new InetSocketAddress( getIpPort() ), new KerberosProtocolHandler( this, store ), udpConfig );
-
- SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
- tcpConfig.setDisconnectOnUnbind( false );
- tcpConfig.setReuseAddress( true );
- tcpConfig.setThreadModel( ThreadModel.MANUAL );
- apacheDS.getTcpAcceptor().bind( new InetSocketAddress( getIpPort() ), new KerberosProtocolHandler( this, store ), tcpConfig );
+ if ( datagramAcceptor != null )
+ {
+ DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
+ datagramAcceptor.bind( new InetSocketAddress( getIpPort() ), new KerberosProtocolHandler( this, store ), udpConfig );
+ }
+
+ if ( socketAcceptor != null )
+ {
+ SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
+ tcpConfig.setDisconnectOnUnbind( false );
+ tcpConfig.setReuseAddress( true );
+ socketAcceptor.bind( new InetSocketAddress( getIpPort() ), new KerberosProtocolHandler( this, store ), tcpConfig );
+ }
}
/**
* @org.apache.xbean.DestroyMethod
*/
public void stop() {
- apacheDS.getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
- apacheDS.getTcpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
+ if ( datagramAcceptor != null )
+ {
+ datagramAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
+ if ( socketAcceptor != null )
+ {
+ socketAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
}
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java Wed Oct 10 22:10:48 2007
@@ -40,6 +40,7 @@
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
import org.apache.directory.server.ldap.LdapConfiguration;
+import org.apache.directory.server.protocol.shared.SocketAcceptor;
import org.apache.directory.server.unit.AbstractServerTest;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -53,7 +54,7 @@
* and the Kerberos protocol. As with any "three-headed" Kerberos
* scenario, there are 3 principals: 1 for the test user, 1 for the
* Kerberos ticket-granting service (TGS), and 1 for the LDAP service.
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
@@ -85,7 +86,8 @@
ldapConfig.setSaslHost( "localhost" );
ldapConfig.setSaslPrincipal( "ldap/localhost@EXAMPLE.COM" );
- KdcConfiguration kdcConfig = new KdcConfiguration();
+ SocketAcceptor socketAcceptor = new SocketAcceptor( null );
+ KdcConfiguration kdcConfig = new KdcConfiguration( null, socketAcceptor, apacheDS.getDirectoryService() );
kdcConfig.setEnabled( true );
kdcConfig.setSearchBaseDn( "ou=users,dc=example,dc=com" );
kdcConfig.setSecurityAuthentication( "simple" );
@@ -150,7 +152,7 @@
{
Attribute disabled = new AttributeImpl( "m-disabled" );
ModificationItemImpl[] mods = new ModificationItemImpl[]
- { new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, disabled ) };
+ {new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, disabled )};
schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
}
@@ -181,10 +183,11 @@
/**
* Convenience method for creating principals.
- * @param cn the commonName of the person
- * @param principal the kerberos principal name for the person
- * @param sn the surName of the person
- * @param uid the unique identifier for the person
+ *
+ * @param cn the commonName of the person
+ * @param principal the kerberos principal name for the person
+ * @param sn the surName of the person
+ * @param uid the unique identifier for the person
* @param userPassword the credentials of the person
* @return the attributes of the person principal
*/
@@ -211,6 +214,7 @@
/**
* Convenience method for creating an organizational unit.
+ *
* @param ou the ou of the organizationalUnit
* @return the attributes of the organizationalUnit
*/
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationEncryptionTypeTest.java Wed Oct 10 22:10:48 2007
@@ -68,7 +68,7 @@
*/
public AuthenticationEncryptionTypeTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration( null, null, null );
store = new MapPrincipalStoreImpl();
handler = new KerberosProtocolHandler( config, store );
session = new DummySession();
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationPolicyTest.java Wed Oct 10 22:10:48 2007
@@ -49,7 +49,7 @@
*/
public AuthenticationPolicyTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration( null, null, null );
store = new MapPrincipalStoreImpl();
handler = new KerberosProtocolHandler( config, store );
session = new DummySession();
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/AuthenticationServiceTest.java Wed Oct 10 22:10:48 2007
@@ -56,7 +56,7 @@
*/
public AuthenticationServiceTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration( null, null, null );
store = new MapPrincipalStoreImpl();
handler = new KerberosProtocolHandler( config, store );
session = new DummySession();
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/EncTktInSkeyTest.java Wed Oct 10 22:10:48 2007
@@ -56,7 +56,7 @@
*/
public EncTktInSkeyTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration( null, null, null );
/*
* Body checksum verification must be disabled because we are bypassing
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/PreAuthenticationTest.java Wed Oct 10 22:10:48 2007
@@ -61,7 +61,7 @@
*/
public PreAuthenticationTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration( null, null, null );
store = new MapPrincipalStoreImpl();
handler = new KerberosProtocolHandler( config, store );
session = new DummySession();
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingEncryptionTypeTest.java Wed Oct 10 22:10:48 2007
@@ -45,7 +45,7 @@
/**
* Tests various facets of working with encryption types in the Ticket-Granting Service (TGS).
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
@@ -62,7 +62,7 @@
*/
public TicketGrantingEncryptionTypeTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration( null, null, null );
/*
* Body checksum verification must be disabled because we are bypassing
@@ -99,7 +99,7 @@
modifier.setRealm( "EXAMPLE.COM" );
EncryptionType[] encryptionTypes =
- { EncryptionType.DES_CBC_MD5 };
+ {EncryptionType.DES_CBC_MD5};
modifier.setEType( encryptionTypes );
@@ -126,13 +126,13 @@
/**
* Tests the use of a TGT containing a DES-CBC-MD5 session key while the
* requested encryption type is AES-128.
- *
+ *
* @throws Exception
*/
public void testRequestAes128() throws Exception
{
EncryptionType[] configuredEncryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
config.setEncryptionTypes( configuredEncryptionTypes );
// Get the mutable ticket part.
@@ -150,7 +150,7 @@
modifier.setRealm( "EXAMPLE.COM" );
EncryptionType[] encryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
modifier.setEType( encryptionTypes );
@@ -172,7 +172,7 @@
assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEncryptionType() );
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
- .getEncryptionType() );
+ .getEncryptionType() );
}
@@ -185,7 +185,7 @@
public void testRequestAes128TgtAndRequested() throws Exception
{
EncryptionType[] configuredEncryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
config.setEncryptionTypes( configuredEncryptionTypes );
// Get the mutable ticket part.
@@ -204,7 +204,7 @@
preAuthEncryptionTypes.add( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Map<EncryptionType, EncryptionKey> keyMap = KerberosKeyFactory.getKerberosKeys( principalName, passPhrase,
- preAuthEncryptionTypes );
+ preAuthEncryptionTypes );
EncryptionKey serverKey = keyMap.get( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Ticket tgt = getTicket( encTicketPartModifier, serverPrincipal, serverKey );
@@ -214,7 +214,7 @@
modifier.setRealm( "EXAMPLE.COM" );
EncryptionType[] encryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
modifier.setEType( encryptionTypes );
@@ -236,19 +236,19 @@
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
- .getEncryptionType() );
+ .getEncryptionType() );
}
/**
* Tests that the client-chosen nonce is correctly returned in the response.
- *
+ *
* @throws Exception
*/
public void testNonce() throws Exception
{
EncryptionType[] configuredEncryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
config.setEncryptionTypes( configuredEncryptionTypes );
// Get the mutable ticket part.
@@ -267,7 +267,7 @@
preAuthEncryptionTypes.add( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Map<EncryptionType, EncryptionKey> keyMap = KerberosKeyFactory.getKerberosKeys( principalName, passPhrase,
- preAuthEncryptionTypes );
+ preAuthEncryptionTypes );
EncryptionKey serverKey = keyMap.get( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Ticket tgt = getTicket( encTicketPartModifier, serverPrincipal, serverKey );
@@ -277,7 +277,7 @@
modifier.setRealm( "EXAMPLE.COM" );
EncryptionType[] encryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
modifier.setEType( encryptionTypes );
@@ -300,7 +300,7 @@
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
- .getEncryptionType() );
+ .getEncryptionType() );
assertEquals( "Nonce", nonce, reply.getNonce() );
}
@@ -308,13 +308,13 @@
/**
* Tests that the default reply key is the session key from the TGT.
- *
+ *
* @throws Exception
*/
public void testDecryptWithSessionKey() throws Exception
{
EncryptionType[] configuredEncryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
config.setEncryptionTypes( configuredEncryptionTypes );
// Get the mutable ticket part.
@@ -333,7 +333,7 @@
preAuthEncryptionTypes.add( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Map<EncryptionType, EncryptionKey> keyMap = KerberosKeyFactory.getKerberosKeys( principalName, passPhrase,
- preAuthEncryptionTypes );
+ preAuthEncryptionTypes );
EncryptionKey serverKey = keyMap.get( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Ticket tgt = getTicket( encTicketPartModifier, serverPrincipal, serverKey );
@@ -343,7 +343,7 @@
modifier.setRealm( "EXAMPLE.COM" );
EncryptionType[] encryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
modifier.setEType( encryptionTypes );
@@ -365,7 +365,7 @@
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getEncPart().getEncryptionType() );
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
- .getEncryptionType() );
+ .getEncryptionType() );
}
@@ -378,7 +378,7 @@
public void testDecryptWithSubSessionKey() throws Exception
{
EncryptionType[] configuredEncryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
config.setEncryptionTypes( configuredEncryptionTypes );
// Get the mutable ticket part.
@@ -397,7 +397,7 @@
preAuthEncryptionTypes.add( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Map<EncryptionType, EncryptionKey> keyMap = KerberosKeyFactory.getKerberosKeys( principalName, passPhrase,
- preAuthEncryptionTypes );
+ preAuthEncryptionTypes );
EncryptionKey serverKey = keyMap.get( EncryptionType.AES128_CTS_HMAC_SHA1_96 );
Ticket tgt = getTicket( encTicketPartModifier, serverPrincipal, serverKey );
@@ -407,7 +407,7 @@
modifier.setRealm( "EXAMPLE.COM" );
EncryptionType[] encryptionTypes =
- { EncryptionType.AES128_CTS_HMAC_SHA1_96 };
+ {EncryptionType.AES128_CTS_HMAC_SHA1_96};
modifier.setEType( encryptionTypes );
@@ -431,6 +431,6 @@
assertEquals( "Encryption type", EncryptionType.DES_CBC_MD5, reply.getEncPart().getEncryptionType() );
assertEquals( "Encryption type", EncryptionType.AES128_CTS_HMAC_SHA1_96, reply.getTicket().getEncPart()
- .getEncryptionType() );
+ .getEncryptionType() );
}
}
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingPolicyTest.java Wed Oct 10 22:10:48 2007
@@ -43,7 +43,7 @@
/**
* Tests configuration of Ticket-Granting Service (TGS) policy.
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
@@ -60,7 +60,7 @@
*/
public TicketGrantingPolicyTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration( null, null, null );
/*
* Body checksum verification must be disabled because we are bypassing
@@ -78,8 +78,8 @@
/**
* Tests when forwardable tickets are disallowed that requests for
* forwardable tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testForwardableTicket() throws Exception
{
@@ -127,8 +127,8 @@
/**
* Tests when forwardable tickets are disallowed that requests for
* forwarded tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testForwardedTicket() throws Exception
{
@@ -176,8 +176,8 @@
/**
* Tests when empty addresses are disallowed and forwarded tickets are requested
* that requests with no addresses fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testForwardedNoAddressesTicket() throws Exception
{
@@ -192,7 +192,7 @@
encTicketPartModifier.setFlag( TicketFlags.FORWARDABLE );
HostAddress[] address =
- { new HostAddress( InetAddress.getByAddress( new byte[4] ) ) };
+ {new HostAddress( InetAddress.getByAddress( new byte[4] ) )};
HostAddresses addresses = new HostAddresses( address );
encTicketPartModifier.setClientAddresses( addresses );
@@ -230,8 +230,8 @@
/**
* Tests when proxiable tickets are disallowed that requests for
* proxiable tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testProxiableTicket() throws Exception
{
@@ -279,8 +279,8 @@
/**
* Tests when proxiable tickets are disallowed that requests for
* proxy tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testProxyTicket() throws Exception
{
@@ -316,7 +316,7 @@
modifier.setTill( requestedEndTime );
HostAddress[] address =
- { new HostAddress( InetAddress.getLocalHost() ) };
+ {new HostAddress( InetAddress.getLocalHost() )};
HostAddresses addresses = new HostAddresses( address );
modifier.setAddresses( addresses );
@@ -333,8 +333,8 @@
/**
* Tests when empty addresses are disallowed and proxy tickets are requested
* that requests with no addresses fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testProxyNoAddressesTicket() throws Exception
{
@@ -349,7 +349,7 @@
encTicketPartModifier.setFlag( TicketFlags.PROXIABLE );
HostAddress[] address =
- { new HostAddress( InetAddress.getByAddress( new byte[4] ) ) };
+ {new HostAddress( InetAddress.getByAddress( new byte[4] ) )};
HostAddresses addresses = new HostAddresses( address );
encTicketPartModifier.setClientAddresses( addresses );
@@ -387,8 +387,8 @@
/**
* Tests when postdated tickets are disallowed that requests for
* ALLOW-POSTDATE tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testAllowPostdate() throws Exception
{
@@ -436,8 +436,8 @@
/**
* Tests when postdated tickets are disallowed that requests for
* postdated tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testPostdated() throws Exception
{
@@ -485,8 +485,8 @@
/**
* Tests when postdated tickets are disallowed that requests for
* validation of invalid tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testValidateInvalidTicket() throws Exception
{
@@ -535,8 +535,8 @@
/**
* Tests when renewable tickets are disallowed that requests for
* renewal of tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testRenewTicket() throws Exception
{
@@ -578,8 +578,8 @@
/**
* Tests when renewable tickets are disallowed that requests for
* RENEWABLE-OK tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testRenewableOk() throws Exception
{
@@ -627,8 +627,8 @@
/**
* Tests when renewable tickets are disallowed that requests for
* renewable tickets fail with the correct error message.
- *
- * @throws Exception
+ *
+ * @throws Exception
*/
public void testRenewableTicket() throws Exception
{
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java Wed Oct 10 22:10:48 2007
@@ -66,7 +66,7 @@
*/
public TicketGrantingServiceTest()
{
- config = new KdcConfiguration();
+ config = new KdcConfiguration(null, null, null);
/*
* Body checksum verification must be disabled because we are bypassing
Modified: directory/apacheds/branches/bigbang/protocol-ntp/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/pom.xml?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-ntp/pom.xml Wed Oct 10 22:10:48 2007
@@ -47,11 +47,6 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-server-jndi</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-unit</artifactId>
<version>${pom.version}</version>
<scope>test</scope>
Modified: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java Wed Oct 10 22:10:48 2007
@@ -20,47 +20,54 @@
package org.apache.directory.server.ntp;
-import java.net.InetSocketAddress;
import java.io.IOException;
+import java.net.InetSocketAddress;
-import org.apache.directory.server.protocol.shared.ServiceConfiguration;
import org.apache.directory.server.ntp.protocol.NtpProtocolHandler;
-import org.apache.directory.server.configuration.ApacheDS;
-import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.protocol.shared.ServiceConfiguration;
+import org.apache.mina.common.ThreadModel;
+import org.apache.mina.transport.socket.nio.DatagramAcceptor;
import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
-import org.apache.mina.common.ThreadModel;
/**
* Contains the configuration parameters for the NTP protocol provider.
*
- * @org.apache.xbean.XBean
- *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
+ * @org.apache.xbean.XBean
*/
public class NtpConfiguration extends ServiceConfiguration
{
private static final long serialVersionUID = 2961795205765175775L;
- /** The default IP port. */
+ /**
+ * The default IP port.
+ */
private static final int IP_PORT_DEFAULT = 123;
- /** The default service pid. */
+ /**
+ * The default service pid.
+ */
private static final String SERVICE_PID_DEFAULT = "org.apache.directory.server.ntp";
- /** The default service name. */
+ /**
+ * The default service name.
+ */
private static final String SERVICE_NAME_DEFAULT = "ApacheDS NTP Service";
- private final ApacheDS apacheDS;
+ private final DatagramAcceptor datagramAcceptor;
+ private final SocketAcceptor socketAcceptor;
/**
* Creates a new instance of NtpConfiguration.
*/
- public NtpConfiguration( ApacheDS apacheDS )
+ public NtpConfiguration( DatagramAcceptor datagramAcceptor, SocketAcceptor socketAcceptor )
{
- this.apacheDS = apacheDS;
+ this.datagramAcceptor = datagramAcceptor;
+ this.socketAcceptor = socketAcceptor;
super.setIpPort( IP_PORT_DEFAULT );
super.setServicePid( SERVICE_PID_DEFAULT );
super.setServiceName( SERVICE_NAME_DEFAULT );
@@ -72,11 +79,19 @@
public void start() throws IOException
{
//If appropriate, the udp and tcp servers could be enabled with boolean flags.
- DatagramAcceptorConfig udpConfig = getUdpConfig();
- apacheDS.getUdpAcceptor().bind( new InetSocketAddress( getIpPort() ), new NtpProtocolHandler(), udpConfig );
-
- SocketAcceptorConfig tcpConfig = getTcpConfig();
- apacheDS.getTcpAcceptor().bind( new InetSocketAddress( getIpPort() ), new NtpProtocolHandler(), tcpConfig );
+ if ( datagramAcceptor != null )
+ {
+ DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
+ datagramAcceptor.bind( new InetSocketAddress( getIpPort() ), new NtpProtocolHandler(), udpConfig );
+ }
+
+ if ( socketAcceptor != null )
+ {
+ SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
+ tcpConfig.setDisconnectOnUnbind( false );
+ tcpConfig.setReuseAddress( true );
+ socketAcceptor.bind( new InetSocketAddress( getIpPort() ), new NtpProtocolHandler(), tcpConfig );
+ }
}
/**
@@ -84,24 +99,14 @@
*/
public void stop()
{
- apacheDS.getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ) );
- apacheDS.getTcpAcceptor().unbind( new InetSocketAddress( getIpPort() ) );
- }
-
- private SocketAcceptorConfig getTcpConfig()
- {
- SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
- tcpConfig.setDisconnectOnUnbind( false );
- tcpConfig.setReuseAddress( true );
- tcpConfig.setThreadModel( ThreadModel.MANUAL );
- return tcpConfig;
- }
-
- private DatagramAcceptorConfig getUdpConfig()
- {
- DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
- udpConfig.setThreadModel( ThreadModel.MANUAL );
- return udpConfig;
+ if ( datagramAcceptor != null )
+ {
+ datagramAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
+ if ( socketAcceptor != null )
+ {
+ socketAcceptor.unbind( new InetSocketAddress( getIpPort() ));
+ }
}
}
Modified: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/package-info.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/package-info.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/package-info.java Wed Oct 10 22:10:48 2007
@@ -20,8 +20,7 @@
/**
* Provides the entry point to instances of the
- * {@link org.apache.directory.server.ntp.UdpNtpServer} and
- * {@link org.apache.directory.server.ntp.TcpNtpServer},
+ * {@link org.apache.directory.server.ntp.NtpConfiguration},
* as well as support for configuration and the root
* of the exception hierarchy.
*
Modified: directory/apacheds/branches/bigbang/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java Wed Oct 10 22:10:48 2007
@@ -26,20 +26,19 @@
import junit.framework.TestCase;
import org.apache.commons.net.ntp.NTPUDPClient;
import org.apache.commons.net.ntp.TimeInfo;
-import org.apache.directory.server.configuration.ApacheDS;
+import org.apache.directory.server.protocol.shared.DatagramAcceptor;
import org.apache.directory.server.unit.AbstractServerTest;
import org.apache.mina.util.AvailablePortFinder;
/**
* An {@link AbstractServerTest} testing the Network Time Protocol (NTP).
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
public class NtpITest extends TestCase
{
- private ApacheDS apacheDS;
private NtpConfiguration ntpConfig;
private int port;
@@ -49,8 +48,8 @@
*/
public void setUp() throws Exception
{
- apacheDS = new ApacheDS();
- ntpConfig = new NtpConfiguration( apacheDS );
+ DatagramAcceptor datagramAcceptor = new DatagramAcceptor( null );
+ ntpConfig = new NtpConfiguration( datagramAcceptor, null );
ntpConfig.setEnabled( true );
port = AvailablePortFinder.getNextAvailable( 10123 );
ntpConfig.setIpPort( port );
@@ -60,8 +59,8 @@
/**
* Tests to make sure NTP works when enabled in the server.
- *
- * @throws Exception if there are errors
+ *
+ * @throws Exception if there are errors
*/
public void testNtp() throws Exception
{
Modified: directory/apacheds/branches/bigbang/protocol-shared/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-shared/pom.xml?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-shared/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-shared/pom.xml Wed Oct 10 22:10:48 2007
@@ -39,6 +39,10 @@
<artifactId>apacheds-constants</artifactId>
<version>${pom.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.mina</groupId>
+ <artifactId>mina-core</artifactId>
+ </dependency>
</dependencies>
Added: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java?rev=583683&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java (added)
+++ directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java Wed Oct 10 22:10:48 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.protocol.shared;
+
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoServiceConfig;
+import org.apache.mina.common.ThreadModel;
+import org.apache.mina.filter.executor.ExecutorFilter;
+
+/**
+ * @version $Rev:$ $Date:$
+ * @org.apache.xbean.XBean
+ */
+public class DatagramAcceptor extends org.apache.mina.transport.socket.nio.DatagramAcceptor
+{
+ private static final int DEFAULT_THREADS = 10;
+
+ public DatagramAcceptor(Executor logicExecutor)
+ {
+ super();
+ if ( logicExecutor == null )
+ {
+ logicExecutor = Executors.newFixedThreadPool( DEFAULT_THREADS );
+ }
+ getFilterChain().addLast( "executor", new ExecutorFilter( logicExecutor ) );
+ }
+
+ public void bind( SocketAddress address, IoHandler ioHandler, IoServiceConfig udpConfig ) throws IOException
+ {
+ udpConfig.setThreadModel( ThreadModel.MANUAL );
+ super.bind( address, ioHandler, udpConfig );
+ }
+
+ public void unbind( SocketAddress address )
+ {
+ super.unbind(address);
+ }
+
+}
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/DatagramAcceptor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java?rev=583683&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java (added)
+++ directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java Wed Oct 10 22:10:48 2007
@@ -0,0 +1,69 @@
+/*
+ * 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.protocol.shared;
+
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoServiceConfig;
+import org.apache.mina.common.ThreadModel;
+import org.apache.mina.filter.executor.ExecutorFilter;
+
+/**
+ * @version $Rev:$ $Date:$
+ * @org.apache.xbean.XBean
+ */
+public class SocketAcceptor extends org.apache.mina.transport.socket.nio.SocketAcceptor
+{
+
+ private static final int DEFAULT_THREADS = 10;
+
+ public SocketAcceptor( Executor logicExecutor)
+ {
+ super( Runtime.getRuntime().availableProcessors(), getIOExecutor());
+ if ( logicExecutor == null )
+ {
+ logicExecutor = Executors.newFixedThreadPool( DEFAULT_THREADS );
+ }
+ getFilterChain().addLast( "executor", new ExecutorFilter( logicExecutor ) );
+ }
+
+ private static Executor getIOExecutor()
+ {
+ return Executors.newCachedThreadPool();
+ }
+
+ public void bind( SocketAddress address, IoHandler ioHandler, IoServiceConfig tcpConfig ) throws IOException
+ {
+ tcpConfig.setThreadModel( ThreadModel.MANUAL );
+ super.bind( address, ioHandler, tcpConfig );
+ }
+
+ public void unbind( SocketAddress address )
+ {
+ super.unbind(address);
+ }
+
+
+}
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/SocketAcceptor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java?rev=583683&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java (added)
+++ directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java Wed Oct 10 22:10:48 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.protocol.shared;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @version $Rev:$ $Date:$
+ * @org.apache.xbean.XBean
+ */
+public class StandardThreadPool implements Executor
+{
+
+ private final ExecutorService delegate;
+
+
+ public StandardThreadPool( int maxThreads )
+ {
+ delegate = Executors.newFixedThreadPool( maxThreads );
+ }
+
+ public void execute( Runnable command )
+ {
+ delegate.execute( command );
+ }
+
+ /**
+ * TODO wont this hang if some tasks are sufficiently badly behaved?
+ * @org.apache.xbean.DestroyMethod
+ */
+ public void stop()
+ {
+ delegate.shutdown();
+ for ( ; ; )
+ {
+ try
+ {
+ if ( delegate.awaitTermination( Integer.MAX_VALUE, TimeUnit.SECONDS ) )
+ {
+ break;
+ }
+ }
+ catch ( InterruptedException e )
+ {
+ //ignore
+ }
+ }
+
+ }
+}
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: directory/apacheds/branches/bigbang/server-xml/src/main/resources/server.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-xml/src/main/resources/server.xml?rev=583683&r1=583682&r2=583683&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-xml/src/main/resources/server.xml (original)
+++ directory/apacheds/branches/bigbang/server-xml/src/main/resources/server.xml Wed Oct 10 22:10:48 2007
@@ -147,26 +147,28 @@
</ldapConfiguration>
</apacheDS>
+ <standardThreadPool maxThreads="8"/>
+ <datagramAcceptor executor="#standardThreadPool"/>
+ <socketAcceptor executor="#standardThreadPool"/>
+
<changePasswordConfiguration ipPort="80464">
<directoryService>#directoryService</directoryService>
- <apacheDs>#apacheDS</apacheDs>
+ <datagramAcceptor>#datagramAcceptor</datagramAcceptor>
+ <socketAcceptor>#socketAcceptor</socketAcceptor>
</changePasswordConfiguration>
<kdcConfiguration ipPort="80088">
<directoryService>#directoryService</directoryService>
- <apacheDs>#apacheDS</apacheDs>
+ <datagramAcceptor>#datagramAcceptor</datagramAcceptor>
+ <socketAcceptor>#socketAcceptor</socketAcceptor>
</kdcConfiguration>
<ntpConfiguration ipPort="80123">
- <apacheDs>#apacheDS</apacheDs>
+ <datagramAcceptor>#datagramAcceptor</datagramAcceptor>
+ <socketAcceptor>#socketAcceptor</socketAcceptor>
</ntpConfiguration>
- <udpNtpConfiguration ipPort="81123">
- <apacheDs>#apacheDS</apacheDs>
- </udpNtpConfiguration>
- <tcpNtpConfiguration ipPort="81123">
- <apacheDs>#apacheDS</apacheDs>
- </tcpNtpConfiguration>
<dnsConfiguration ipPort="8053">
<directoryService>#directoryService</directoryService>
- <apacheDs>#apacheDS</apacheDs>
+ <datagramAcceptor>#datagramAcceptor</datagramAcceptor>
+ <socketAcceptor>#socketAcceptor</socketAcceptor>
</dnsConfiguration>
<!-- another bean I didn't convert -->