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/10 09:31:46 UTC

svn commit: r583375 [1/2] - in /directory/apacheds/branches/bigbang: core/src/main/java/org/apache/directory/server/core/ core/src/test/java/org/apache/directory/server/core/authz/support/ core/src/test/java/org/apache/directory/server/core/interceptor...

Author: djencks
Date: Wed Oct 10 00:31:43 2007
New Revision: 583375

URL: http://svn.apache.org/viewvc?rev=583375&view=rev
Log:
Intermediate checkin separating most protocol servers lifecycle from ApacheDS.  This includes 2 versions of the NTP server in the hopes code will help discussion of which alternative is better.  Several classes need to be renamed based on the outcome of this discussion.

Added:
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java   (contents, props changed)
      - copied, changed from r582886, directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordConfiguration.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java   (contents, props changed)
      - copied, changed from r582886, directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java
    directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java   (with props)
    directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java   (with props)
    directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java   (with props)
    directory/apacheds/branches/bigbang/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java   (contents, props changed)
      - copied, changed from r583207, directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NtpITest.java
Removed:
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordConfiguration.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordServer.java
    directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsServer.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KerberosServer.java
    directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpServer.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NtpITest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java
Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
    directory/apacheds/branches/bigbang/protocol-changepw/pom.xml
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/package-info.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
    directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.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-dns/src/main/java/org/apache/directory/server/dns/package-info.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/main/java/org/apache/directory/server/kerberos/kdc/package-info.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/server-jndi/pom.xml
    directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
    directory/apacheds/branches/bigbang/server-xml/src/main/resources/server.xml

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Wed Oct 10 00:31:43 2007
@@ -20,6 +20,21 @@
 package org.apache.directory.server.core;
 
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
@@ -29,7 +44,11 @@
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
-import org.apache.directory.server.core.interceptor.context.*;
+import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
 import org.apache.directory.server.core.jndi.DeadContext;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.normalization.NormalizationInterceptor;
@@ -43,16 +62,25 @@
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.core.referral.ReferralInterceptor;
 import org.apache.directory.server.core.schema.PartitionSchemaLoader;
+import org.apache.directory.server.core.schema.SchemaInterceptor;
 import org.apache.directory.server.core.schema.SchemaManager;
 import org.apache.directory.server.core.schema.SchemaPartitionDao;
-import org.apache.directory.server.core.schema.SchemaInterceptor;
 import org.apache.directory.server.core.subtree.SubentryInterceptor;
 import org.apache.directory.server.core.trigger.TriggerInterceptor;
 import org.apache.directory.server.schema.SerializableComparator;
-import org.apache.directory.server.schema.bootstrap.*;
+import org.apache.directory.server.schema.bootstrap.ApacheSchema;
+import org.apache.directory.server.schema.bootstrap.ApachemetaSchema;
+import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
+import org.apache.directory.server.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.schema.bootstrap.Schema;
+import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.bootstrap.partition.DbFileListing;
 import org.apache.directory.server.schema.bootstrap.partition.SchemaPartitionExtractor;
-import org.apache.directory.server.schema.registries.*;
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.DefaultOidRegistry;
+import org.apache.directory.server.schema.registries.DefaultRegistries;
+import org.apache.directory.server.schema.registries.OidRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -72,14 +100,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
 
 /**
  * Default implementation of {@link DirectoryService}.
@@ -476,13 +496,13 @@
     }
 
 
-    public Context getJndiContext( String rootDN ) throws NamingException
+    public DirContext getJndiContext( String rootDN ) throws NamingException
     {
         return this.getJndiContext( null, null, null, "none", rootDN );
     }
 
 
-    public synchronized Context getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
+    public synchronized DirContext getJndiContext( LdapDN principalDn, String principal, byte[] credential,
         String authentication, String rootDN ) throws NamingException
     {
         checkSecuritySettings( principal, credential, authentication );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java Wed Oct 10 00:31:43 2007
@@ -33,6 +33,8 @@
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+
 import java.io.File;
 import java.util.Hashtable;
 import java.util.List;
@@ -104,7 +106,7 @@
      * Returns an anonymous JNDI {@link Context} with the specified <tt>baseName</tt>
      * @throws NamingException if failed to create a context
      */
-    public abstract Context getJndiContext( String baseName ) throws NamingException;
+    public abstract DirContext getJndiContext( String baseName ) throws NamingException;
 
 
     /**
@@ -117,7 +119,7 @@
      * @param authentication {@link Context#SECURITY_AUTHENTICATION} value
      * @throws NamingException if failed to create a context
      */
-    public abstract Context getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
+    public abstract DirContext getJndiContext( LdapDN principalDn, String principal, byte[] credential,
         String authentication, String baseName ) throws NamingException;
 
 

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Wed Oct 10 00:31:43 2007
@@ -42,6 +42,8 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchResult;
+import javax.naming.directory.DirContext;
+
 import java.io.File;
 import java.util.*;
 
@@ -260,13 +262,13 @@
         }
 
 
-        public Context getJndiContext( String baseName ) throws NamingException
+        public DirContext getJndiContext( String baseName ) throws NamingException
         {
             return null;
         }
 
 
-        public Context getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
+        public DirContext getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
             String authentication, String baseName ) throws NamingException
         {
             return null;

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Wed Oct 10 00:31:43 2007
@@ -36,6 +36,8 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
 import java.io.File;
 import java.util.*;
 
@@ -323,13 +325,13 @@
         }
 
 
-        public Context getJndiContext( String baseName ) throws NamingException
+        public DirContext getJndiContext( String baseName ) throws NamingException
         {
             return null;
         }
 
 
-        public Context getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
+        public DirContext getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
             String authentication, String baseName ) throws NamingException
         {
             return null;

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java Wed Oct 10 00:31:43 2007
@@ -21,10 +21,10 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.protocol.shared.ServiceConfiguration;
-
 import javax.security.auth.kerberos.KerberosPrincipal;
 
+import org.apache.directory.server.protocol.shared.ServiceConfiguration;
+
 
 /**
  * A JNDI-backed implementation of the PrincipalStore interface.  This PrincipalStore uses
@@ -38,25 +38,20 @@
  */
 public class JndiPrincipalStoreImpl implements PrincipalStore
 {
-    /** a handle on the configuration */
-    private ServiceConfiguration config;
-    /** a handle on the core */
-    private DirectoryService directoryService;
     /** a handle on the search strategy */
-    private PrincipalStore store;
+    private final PrincipalStore store;
 
 
     /**
      * Creates a new instance of JndiPrincipalStoreImpl.
      *
-     * @param config the configuration
+     * @param catalogBaseDn dn for a catalog of search dns.
+     * @param searchBaseDn if no catalog, single search dn.
      * @param directoryService the core service
      */
-    public JndiPrincipalStoreImpl( ServiceConfiguration config, DirectoryService directoryService )
+    public JndiPrincipalStoreImpl( String catalogBaseDn, String searchBaseDn, DirectoryService directoryService )
     {
-        this.config = config;
-        this.directoryService = directoryService;
-        store = getStore();
+        store = getStore( catalogBaseDn, searchBaseDn, directoryService );
     }
 
 
@@ -90,15 +85,15 @@
     }
 
 
-    private PrincipalStore getStore()
+    private static PrincipalStore getStore( String catalogBaseDn, String searchBaseDn, DirectoryService directoryService )
     {
-        if ( config.getCatalogBaseDn() != null )
+        if ( catalogBaseDn != null )
         {
             // build a catalog from the backing store
-            return new MultiBaseSearch( config, directoryService );
+            return new MultiBaseSearch( catalogBaseDn, directoryService );
         }
 
         // search only the configured entry baseDN
-        return new SingleBaseSearch( config, directoryService );
+        return new SingleBaseSearch( searchBaseDn, directoryService );
     }
 }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java Wed Oct 10 00:31:43 2007
@@ -21,51 +21,51 @@
 package org.apache.directory.server.kerberos.shared.store;
 
 
+import java.util.Map;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.security.auth.kerberos.KerberosPrincipal;
+
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.kerberos.shared.store.operations.*;
-import org.apache.directory.server.protocol.shared.ServiceConfiguration;
+import org.apache.directory.server.kerberos.shared.store.operations.AddPrincipal;
+import org.apache.directory.server.kerberos.shared.store.operations.ChangePassword;
+import org.apache.directory.server.kerberos.shared.store.operations.DeletePrincipal;
+import org.apache.directory.server.kerberos.shared.store.operations.GetAllPrincipals;
+import org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal;
 import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
 import org.apache.directory.server.protocol.shared.catalog.Catalog;
 import org.apache.directory.server.protocol.shared.catalog.GetCatalog;
 import org.apache.directory.server.protocol.shared.store.ContextOperation;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.security.auth.kerberos.KerberosPrincipal;
-import java.util.Hashtable;
-import java.util.Map;
-
 
 /**
  * A JNDI-backed search strategy implementation.  This search strategy builds a
  * catalog from configuration in the DIT to determine where realms are to search
  * for Kerberos principals.
+ *
+ * TODO are exception messages reasonable? I changed them to use the catalog key rather than the catalog value.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 class MultiBaseSearch implements PrincipalStore
 {
-    private Hashtable<String, Object> env = new Hashtable<String, Object>();
-    private Catalog catalog;
+    private final Catalog catalog;
+    private final DirectoryService directoryService;
 
 
-    MultiBaseSearch( ServiceConfiguration config, DirectoryService directoryService )
+    MultiBaseSearch( String catalogBaseDn, DirectoryService directoryService )
     {
-        env.put( Context.INITIAL_CONTEXT_FACTORY, config.getInitialContextFactory() );
-        env.put( Context.PROVIDER_URL, config.getCatalogBaseDn() );
-        env.put( DirectoryService.JNDI_KEY, directoryService );
-
+        this.directoryService = directoryService;
         try
         {
-            DirContext ctx = new InitialDirContext( env );
+            DirContext ctx = directoryService.getJndiContext(catalogBaseDn);
             catalog = new KerberosCatalog( ( Map ) execute( ctx, new GetCatalog() ) );
         }
         catch ( Exception e )
         {
-            String message = "Failed to get catalog context " + env.get( Context.PROVIDER_URL );
+            String message = "Failed to get catalog context " + catalogBaseDn;
             throw new ServiceConfigurationException( message, e );
         }
     }
@@ -73,37 +73,26 @@
 
     public String addPrincipal( PrincipalStoreEntry entry ) throws Exception
     {
-        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
-        cloned.putAll( env );
-        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( entry.getRealmName() ) );
-
         try
         {
-            DirContext ctx = new InitialDirContext( cloned );
-            return ( String ) execute( ctx, new AddPrincipal( entry ) );
+            return ( String ) execute( getDirContext( entry.getRealmName() ), new AddPrincipal( entry ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + entry.getRealmName();
             throw new ServiceConfigurationException( message, ne );
         }
     }
 
-
     public String deletePrincipal( KerberosPrincipal principal ) throws Exception
     {
-        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
-        cloned.putAll( env );
-        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
-
         try
         {
-            DirContext ctx = new InitialDirContext( cloned );
-            return ( String ) execute( ctx, new DeletePrincipal( principal ) );
+            return ( String ) execute( getDirContext( principal.getRealm() ), new DeletePrincipal( principal ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + principal.getRealm();
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -111,18 +100,13 @@
 
     public PrincipalStoreEntry[] getAllPrincipals( String realm ) throws Exception
     {
-        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
-        cloned.putAll( env );
-        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( realm ) );
-
         try
         {
-            DirContext ctx = new InitialDirContext( cloned );
-            return ( PrincipalStoreEntry[] ) execute( ctx, new GetAllPrincipals() );
+            return ( PrincipalStoreEntry[] ) execute( getDirContext( realm ), new GetAllPrincipals() );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + realm;
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -130,18 +114,13 @@
 
     public PrincipalStoreEntry getPrincipal( KerberosPrincipal principal ) throws Exception
     {
-        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
-        cloned.putAll( env );
-        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
-
         try
         {
-            DirContext ctx = new InitialDirContext( cloned );
-            return ( PrincipalStoreEntry ) execute( ctx, new GetPrincipal( principal ) );
+            return ( PrincipalStoreEntry ) execute( getDirContext( principal.getRealm() ), new GetPrincipal( principal ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + principal.getRealm();
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -149,18 +128,13 @@
 
     public String changePassword( KerberosPrincipal principal, String newPassword ) throws Exception
     {
-        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
-        cloned.putAll( env );
-        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
-
         try
         {
-            DirContext ctx = new InitialDirContext( cloned );
-            return ( String ) execute( ctx, new ChangePassword( principal, newPassword ) );
+            return ( String ) execute( getDirContext( principal.getRealm() ), new ChangePassword( principal, newPassword ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + principal.getRealm();
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -170,4 +144,10 @@
     {
         return operation.execute( ctx, null );
     }
+
+    private DirContext getDirContext( String name ) throws NamingException
+    {
+        return directoryService.getJndiContext(catalog.getBaseDn( name ));
+    }
+
 }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java Wed Oct 10 00:31:43 2007
@@ -23,16 +23,10 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.kerberos.shared.store.operations.*;
-import org.apache.directory.server.protocol.shared.ServiceConfiguration;
-import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
-import org.apache.directory.server.protocol.shared.store.ContextOperation;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
+import javax.naming.NamingException;
 import javax.security.auth.kerberos.KerberosPrincipal;
-import java.util.Hashtable;
 
 
 /**
@@ -44,67 +38,56 @@
  */
 class SingleBaseSearch implements PrincipalStore
 {
-    private DirContext ctx;
-    private Hashtable<String, Object> env = new Hashtable<String, Object>();
+    private final DirContext ctx;
 
 
-    SingleBaseSearch( ServiceConfiguration config, DirectoryService directoryService )
+    SingleBaseSearch( String searchBaseDn, DirectoryService directoryService )
     {
-        env.put( Context.INITIAL_CONTEXT_FACTORY, config.getInitialContextFactory() );
-        env.put( Context.PROVIDER_URL, config.getSearchBaseDn() );
-        env.put( Context.SECURITY_AUTHENTICATION, config.getSecurityAuthentication() );
-        env.put( Context.SECURITY_CREDENTIALS, config.getSecurityCredentials() );
-        env.put( Context.SECURITY_PRINCIPAL, config.getSecurityPrincipal() );
-        env.put( DirectoryService.JNDI_KEY, directoryService );
+        try
+        {
+            ctx = directoryService.getJndiContext(searchBaseDn);
+        } catch ( NamingException e )
+        {
+            throw new IllegalStateException("Can't get context at" + searchBaseDn);
+        }
+//        env.put( Context.INITIAL_CONTEXT_FACTORY, config.getInitialContextFactory() );
+//        env.put( Context.PROVIDER_URL, config.getSearchBaseDn() );
+//        env.put( Context.SECURITY_AUTHENTICATION, config.getSecurityAuthentication() );
+//        env.put( Context.SECURITY_CREDENTIALS, config.getSecurityCredentials() );
+//        env.put( Context.SECURITY_PRINCIPAL, config.getSecurityPrincipal() );
+//        env.put( DirectoryService.JNDI_KEY, directoryService );
 
     }
 
 
     public String addPrincipal( PrincipalStoreEntry entry ) throws Exception
     {
-        return ( String ) execute( new AddPrincipal( entry ) );
+        return ( String ) new AddPrincipal( entry ).execute( ctx, null );
     }
 
 
     public String deletePrincipal( KerberosPrincipal principal ) throws Exception
     {
-        return ( String ) execute( new DeletePrincipal( principal ) );
+        return ( String ) new DeletePrincipal( principal ).execute( ctx, null );
     }
 
 
     public PrincipalStoreEntry[] getAllPrincipals( String realm ) throws Exception
     {
-        return ( PrincipalStoreEntry[] ) execute( new GetAllPrincipals() );
+        return ( PrincipalStoreEntry[] ) new GetAllPrincipals().execute( ctx, null );
     }
 
 
     public PrincipalStoreEntry getPrincipal( KerberosPrincipal principal ) throws Exception
     {
-        return ( PrincipalStoreEntry ) execute( new GetPrincipal( principal ) );
+        return ( PrincipalStoreEntry ) new GetPrincipal( principal ).execute( ctx, null );
     }
 
 
     public String changePassword( KerberosPrincipal principal, String newPassword ) throws Exception
     {
-        return ( String ) execute( new ChangePassword( principal, newPassword ) );
+        return ( String ) new ChangePassword( principal, newPassword ).execute( ctx, null );
     }
 
 
-    private Object execute( ContextOperation operation ) throws Exception
-    {
-        if ( ctx == null )
-        {
-            try
-            {
-                ctx = new InitialDirContext( env );
-            }
-            catch ( NamingException ne )
-            {
-                String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
-                throw new ServiceConfigurationException( message, ne );
-            }
-        }
-
-        return operation.execute( ctx, null );
-    }
 }

Modified: directory/apacheds/branches/bigbang/protocol-changepw/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/pom.xml?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/pom.xml Wed Oct 10 00:31:43 2007
@@ -38,6 +38,11 @@
       <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>
 

Copied: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java (from r582886, directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordConfiguration.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java?p2=directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java&p1=directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordConfiguration.java&r1=582886&r2=583375&rev=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordConfiguration.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java Wed Oct 10 00:31:43 2007
@@ -22,11 +22,21 @@
 
 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.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.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
 
 
 /**
@@ -37,7 +47,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ChangePasswordConfiguration extends ServiceConfiguration
+public class ChangePasswordLDAPServers extends ServiceConfiguration
 {
     private static final long serialVersionUID = 3509208713288140629L;
 
@@ -58,7 +68,7 @@
         { "des-cbc-md5" };
 
     /** The default changepw buffer size. */
-    private static final long DEFAULT_ALLOWABLE_CLOCKSKEW = 5 * MINUTE;
+    private static final long DEFAULT_ALLOWABLE_CLOCKSKEW = 5 * ServiceConfiguration.MINUTE;
 
     /** The default empty addresses. */
     private static final boolean DEFAULT_EMPTY_ADDRESSES_ALLOWED = true;
@@ -102,11 +112,15 @@
     /** The policy for token size. */
     private int policyTokenSize;
 
+    private DirectoryService directoryService;
+
+    private ApacheDS apacheDS;
+
 
     /**
      * Creates a new instance of ChangePasswordConfiguration.
      */
-    public ChangePasswordConfiguration()
+    public ChangePasswordLDAPServers()
     {
         super.setServiceName( SERVICE_NAME_DEFAULT );
         super.setIpPort( IP_PORT_DEFAULT );
@@ -249,6 +263,52 @@
         return policyTokenSize;
     }
 
+
+    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
+     */
+    public void start() throws IOException
+    {
+        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 );
+    }
+
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    public void stop() {
+        apacheDS.getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
+        apacheDS.getTcpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
+    }
 
     private void prepareEncryptionTypes()
     {

Propchange: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/ChangePasswordLDAPServers.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Oct 10 00:31:43 2007
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/package-info.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/package-info.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/package-info.java Wed Oct 10 00:31:43 2007
@@ -20,7 +20,7 @@
 
 /**
  * Provides the entry point to an instance of the
- * {@link org.apache.directory.server.changepw.ChangePasswordServer},
+ * {@link org.apache.directory.server.changepw.ChangePasswordLDAPServers},
  * as well as support for configuration.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java Wed Oct 10 00:31:43 2007
@@ -28,7 +28,7 @@
 
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.changepw.ChangePasswordLDAPServers;
 import org.apache.directory.server.changepw.exceptions.ChangePasswordException;
 import org.apache.directory.server.changepw.exceptions.ErrorType;
 import org.apache.directory.server.changepw.messages.ChangePasswordErrorModifier;
@@ -58,7 +58,7 @@
 {
     private static final Logger log = LoggerFactory.getLogger( ChangePasswordProtocolHandler.class );
 
-    private ChangePasswordConfiguration config;
+    private ChangePasswordLDAPServers config;
     private PrincipalStore store;
     private IoHandlerCommand changepwService;
     private String contextKey = "context";
@@ -70,7 +70,7 @@
      * @param config
      * @param store
      */
-    public ChangePasswordProtocolHandler( ChangePasswordConfiguration config, PrincipalStore store )
+    public ChangePasswordProtocolHandler( ChangePasswordLDAPServers config, PrincipalStore store )
     {
         this.config = config;
         this.store = store;

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java Wed Oct 10 00:31:43 2007
@@ -22,7 +22,7 @@
 
 import java.net.InetAddress;
 
-import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.changepw.ChangePasswordLDAPServers;
 import org.apache.directory.server.changepw.messages.AbstractPasswordMessage;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest;
@@ -41,7 +41,7 @@
 {
     private static final long serialVersionUID = -5124209294966799740L;
 
-    private ChangePasswordConfiguration config;
+    private ChangePasswordLDAPServers config;
     private PrincipalStore store;
     private AbstractPasswordMessage request;
     private AbstractPasswordMessage reply;
@@ -95,7 +95,7 @@
     /**
      * @return Returns the config.
      */
-    public ChangePasswordConfiguration getConfig()
+    public ChangePasswordLDAPServers getConfig()
     {
         return config;
     }
@@ -104,7 +104,7 @@
     /**
      * @param config The config to set.
      */
-    public void setConfig( ChangePasswordConfiguration config )
+    public void setConfig( ChangePasswordLDAPServers config )
     {
         this.config = config;
     }

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java Wed Oct 10 00:31:43 2007
@@ -25,7 +25,7 @@
 
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.changepw.ChangePasswordLDAPServers;
 import org.apache.directory.server.changepw.exceptions.ChangePasswordException;
 import org.apache.directory.server.changepw.exceptions.ErrorType;
 import org.apache.directory.server.kerberos.shared.messages.components.Authenticator;
@@ -53,7 +53,7 @@
     {
         ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute( getContextKey() );
 
-        ChangePasswordConfiguration config = changepwContext.getConfig();
+        ChangePasswordLDAPServers config = changepwContext.getConfig();
         Authenticator authenticator = changepwContext.getAuthenticator();
         KerberosPrincipal clientPrincipal = authenticator.getClientPrincipal();
 

Modified: directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java (original)
+++ directory/apacheds/branches/bigbang/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java Wed Oct 10 00:31:43 2007
@@ -22,7 +22,7 @@
 
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.changepw.ChangePasswordLDAPServers;
 import org.apache.directory.server.kerberos.shared.exceptions.ErrorType;
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
@@ -42,7 +42,7 @@
     public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
         ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute( getContextKey() );
-        ChangePasswordConfiguration config = changepwContext.getConfig();
+        ChangePasswordLDAPServers config = changepwContext.getConfig();
         Ticket ticket = changepwContext.getTicket();
         String primaryRealm = config.getPrimaryRealm();
         KerberosPrincipal changepwPrincipal = config.getServicePrincipal();

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=583375&r1=583374&r2=583375&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 00:31:43 2007
@@ -31,7 +31,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.changepw.ChangePasswordLDAPServers;
 import org.apache.directory.server.changepw.io.ChangePasswordDataEncoder;
 import org.apache.directory.server.changepw.messages.ChangePasswordError;
 import org.apache.directory.server.changepw.messages.ChangePasswordRequest;
@@ -83,7 +83,7 @@
     //private static final byte[] SUCCESS = new byte[]
     //    { ( byte ) 0x00, ( byte ) 0x00 };
 
-    private ChangePasswordConfiguration config;
+    private ChangePasswordLDAPServers config;
     private PrincipalStore store;
     private ChangePasswordProtocolHandler handler;
     private DummySession session;
@@ -96,7 +96,7 @@
      */
     public ChangepwProtocolHandlerTest()
     {
-        config = new ChangePasswordConfiguration();
+        config = new ChangePasswordLDAPServers();
         store = new MapPrincipalStoreImpl();
         handler = new ChangePasswordProtocolHandler( config, store );
         session = new DummySession();

Modified: directory/apacheds/branches/bigbang/protocol-dns/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/pom.xml?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-dns/pom.xml Wed Oct 10 00:31:43 2007
@@ -51,6 +51,11 @@
       <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>
 </project>
 

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=583375&r1=583374&r2=583375&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 00:31:43 2007
@@ -20,7 +20,18 @@
 package org.apache.directory.server.dns;
 
 
+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.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
+import org.apache.mina.common.ThreadModel;
 
 
 /**
@@ -44,14 +55,46 @@
     /** The default service name. */
     private static final String SERVICE_NAME_DEFAULT = "ApacheDS DNS Service";
 
+    private DirectoryService directoryService;
+
+    private ApacheDS apacheDS;
+
 
     /**
      * Creates a new instance of DnsConfiguration.
      */
-    public DnsConfiguration()
+    public DnsConfiguration( ApacheDS apacheDS, DirectoryService directoryService)
     {
+        this.apacheDS = apacheDS;
+        this.directoryService = directoryService;
         super.setIpPort( IP_PORT_DEFAULT );
         super.setServicePid( SERVICE_PID_DEFAULT );
         super.setServiceName( SERVICE_NAME_DEFAULT );
+    }
+
+    /**
+     * @org.apache.xbean.InitMethod
+     */
+    public void start() throws IOException
+    {
+        RecordStore store = new JndiRecordStoreImpl( this, 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 );
+    }
+
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    public void stop() {
+        apacheDS.getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
+        apacheDS.getTcpAcceptor().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=583375&r1=583374&r2=583375&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 00:31:43 2007
@@ -26,6 +26,9 @@
 
 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 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;
@@ -44,16 +47,7 @@
     /** Logger for this class */
     private static final Logger log = LoggerFactory.getLogger( Main.class );
 
-    private static final int MAX_THREADS_DEFAULT = 4;
-
-    protected static IoAcceptor udpAcceptor;
-    protected static IoAcceptor tcpAcceptor;
-    protected static ThreadPoolExecutor threadPoolExecutor;
-    protected static ExecutorThreadModel threadModel = ExecutorThreadModel.getInstance( "ApacheDS" );
-
-    private static DnsServer udpDnsServer;
-    private static DnsServer tcpDnsServer;
-
+    private static DnsConfiguration dnsConfiguration;
 
     /**
      * Entry point for the DNS server.
@@ -63,14 +57,6 @@
      */
     public static void main( String[] args ) throws Exception
     {
-        int maxThreads = MAX_THREADS_DEFAULT;
-        threadPoolExecutor = new ThreadPoolExecutor( maxThreads, maxThreads, 60, TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>() );
-        threadModel.setExecutor( threadPoolExecutor );
-
-        udpAcceptor = new DatagramAcceptor();
-        tcpAcceptor = new SocketAcceptor();
-
         new Main().go();
     }
 
@@ -80,63 +66,19 @@
      */
     public void go()
     {
-        DnsConfiguration dnsConfiguration = new DnsConfiguration();
+        ApacheDS apacheDS = new ApacheDS();
+        DirectoryService directoryService = new DefaultDirectoryService();
+        dnsConfiguration = new DnsConfiguration( apacheDS, directoryService );
         dnsConfiguration.setEnabled( true );
         dnsConfiguration.setIpPort( 10053 );
 
         RecordStore store = new RecordStoreStub();
 
-        startup( dnsConfiguration, store );
-    }
-
-
-    private void startup( DnsConfiguration dnsConfig, RecordStore store )
-    {
-        // Skip if disabled
-        if ( !dnsConfig.isEnabled() )
-        {
-            return;
-        }
-
-        try
-        {
-            DatagramAcceptorConfig serviceConfig = new DatagramAcceptorConfig();
-            serviceConfig.setThreadModel( threadModel );
-
-            udpDnsServer = new DnsServer( dnsConfig, udpAcceptor, serviceConfig, store );
-            tcpDnsServer = new DnsServer( dnsConfig, tcpAcceptor, serviceConfig, store );
-        }
-        catch ( Throwable t )
-        {
-            log.error( "Failed to start the DNS service", t );
-        }
     }
 
 
     protected void shutdown()
     {
-        if ( udpDnsServer != null )
-        {
-            udpDnsServer.destroy();
-
-            if ( log.isInfoEnabled() )
-            {
-                log.info( "Unbind of DNS Service complete: " + udpDnsServer );
-            }
-
-            udpDnsServer = null;
-        }
-
-        if ( tcpDnsServer != null )
-        {
-            tcpDnsServer.destroy();
-
-            if ( log.isInfoEnabled() )
-            {
-                log.info( "Unbind of DNS Service complete: " + tcpDnsServer );
-            }
-
-            tcpDnsServer = null;
-        }
+        dnsConfiguration.stop();
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/package-info.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/package-info.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dns/src/main/java/org/apache/directory/server/dns/package-info.java Wed Oct 10 00:31:43 2007
@@ -20,7 +20,7 @@
 
 /**
  * Provides the entry point to an instance of the
- * {@link org.apache.directory.server.dns.DnsServer},
+ * {@link org.apache.directory.server.dns.DnsConfiguration},
  * as well as support for configuration and the root
  * of the exception hierarchy.
  * 

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/pom.xml Wed Oct 10 00:31:43 2007
@@ -38,6 +38,23 @@
       <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>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-unit</artifactId>
+      <version>${pom.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-bootstrap-partition</artifactId>
+      <version>${pom.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

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=583375&r1=583374&r2=583375&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 00:31:43 2007
@@ -22,11 +22,21 @@
 
 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.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.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
 
 
 /**
@@ -132,6 +142,9 @@
     /** Whether to verify the body checksum. */
     private boolean isBodyChecksumVerified = DEFAULT_VERIFY_BODY_CHECKSUM;
 
+    private DirectoryService directoryService;
+
+    private ApacheDS apacheDS;
 
     /**
      * Creates a new instance of KdcConfiguration.
@@ -388,6 +401,53 @@
     public void setBodyChecksumVerified( boolean isBodyChecksumVerified )
     {
         this.isBodyChecksumVerified = isBodyChecksumVerified;
+    }
+
+
+    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
+     */
+    public void start() throws IOException
+    {
+        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 );
+    }
+
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    public void stop() {
+        apacheDS.getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
+        apacheDS.getTcpAcceptor().unbind( new InetSocketAddress( getIpPort() ));
     }
 
 

Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/package-info.java?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/package-info.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/package-info.java Wed Oct 10 00:31:43 2007
@@ -19,7 +19,7 @@
  */
 
 /**
- * Provides the entry point to an instance of the {@link KerberosServer}
+ * Provides the entry point to an instance of the {@link KdcConfiguration}
  * (KDC), as well as classes common to the KDC's two services:  the
  * Authentication Service (AS) and the Ticket-Granting Service (TGS).  The
  * AS and TGS service implementations follow the Chain of Responsibility

Copied: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java (from r582886, directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/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?p2=directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java&p1=directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java&r1=582886&r2=583375&rev=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslGssapiBindITest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java Wed Oct 10 00:31:43 2007
@@ -17,17 +17,27 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server;
+package org.apache.directory.server.kerberos.kdc;
 
 
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.Interceptor;
-import org.apache.directory.server.core.kerberos.KeyDerivationService;
+import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-import org.apache.directory.server.kerberos.kdc.KdcConfiguration;
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
 import org.apache.directory.server.ldap.LdapConfiguration;
 import org.apache.directory.server.unit.AbstractServerTest;
@@ -36,16 +46,6 @@
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.mina.util.AvailablePortFinder;
 
-import javax.naming.Context;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-
 
 /**
  * An {@link AbstractServerTest} testing SASL GSSAPI authentication
@@ -85,7 +85,7 @@
         ldapConfig.setSaslHost( "localhost" );
         ldapConfig.setSaslPrincipal( "ldap/localhost@EXAMPLE.COM" );
 
-        KdcConfiguration kdcConfig = apacheDS.getKdcConfiguration();
+        KdcConfiguration kdcConfig = new KdcConfiguration();
         kdcConfig.setEnabled( true );
         kdcConfig.setSearchBaseDn( "ou=users,dc=example,dc=com" );
         kdcConfig.setSecurityAuthentication( "simple" );
@@ -120,7 +120,7 @@
         apacheDS.getDirectoryService().setPartitions( partitions );
 
         List<Interceptor> list = apacheDS.getDirectoryService().getInterceptors();
-        list.add( new KeyDerivationService() );
+        list.add( new KeyDerivationInterceptor() );
         apacheDS.getDirectoryService().setInterceptors( list );
 
         doDelete( apacheDS.getDirectoryService().getWorkingDirectory() );

Propchange: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/apacheds/branches/bigbang/protocol-ntp/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/pom.xml?rev=583375&r1=583374&r2=583375&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/pom.xml (original)
+++ directory/apacheds/branches/bigbang/protocol-ntp/pom.xml Wed Oct 10 00:31:43 2007
@@ -44,6 +44,29 @@
       <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>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-unit</artifactId>
+      <version>${pom.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-bootstrap-partition</artifactId>
+      <version>${pom.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-net</groupId>
+      <artifactId>commons-net</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>
 

Added: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java?rev=583375&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java (added)
+++ directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java Wed Oct 10 00:31:43 2007
@@ -0,0 +1,86 @@
+/*
+ * 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.ntp;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+import org.apache.directory.server.protocol.shared.ServiceConfiguration;
+import org.apache.directory.server.configuration.ApacheDS;
+import org.apache.directory.server.ntp.protocol.NtpProtocolHandler;
+import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
+import org.apache.mina.common.ThreadModel;
+
+/**
+ * Contains the configuration parameters for the NTP protocol provider.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractNtpServer extends ServiceConfiguration
+{
+    private static final long serialVersionUID = 2961795205765175775L;
+
+    /** The default IP port. */
+    private static final int IP_PORT_DEFAULT = 123;
+
+    /** The default service pid. */
+    private static final String SERVICE_PID_DEFAULT = "org.apache.directory.server.ntp";
+
+    /** The default service name. */
+    private static final String SERVICE_NAME_DEFAULT = "ApacheDS NTP Service";
+
+    private final ApacheDS apacheDS;
+
+    /**
+     * Creates a new instance of NtpConfiguration.
+     */
+    public AbstractNtpServer( ApacheDS apacheDS )
+    {
+        this.apacheDS = apacheDS;
+        super.setIpPort( IP_PORT_DEFAULT );
+        super.setServicePid( SERVICE_PID_DEFAULT );
+        super.setServiceName( SERVICE_NAME_DEFAULT );
+    }
+
+    protected ApacheDS getApacheDS()
+    {
+        return apacheDS;
+    }
+
+    protected SocketAcceptorConfig getTcpConfig()
+    {
+        SocketAcceptorConfig tcpConfig = new SocketAcceptorConfig();
+        tcpConfig.setDisconnectOnUnbind( false );
+        tcpConfig.setReuseAddress( true );
+        tcpConfig.setThreadModel( ThreadModel.MANUAL );
+        return tcpConfig;
+    }
+
+    protected DatagramAcceptorConfig getUdpConfig()
+    {
+        DatagramAcceptorConfig udpConfig = new DatagramAcceptorConfig();
+        udpConfig.setThreadModel( ThreadModel.MANUAL );
+        return udpConfig;
+    }
+
+}

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/AbstractNtpServer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=583375&r1=583374&r2=583375&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 00:31:43 2007
@@ -20,7 +20,16 @@
 package org.apache.directory.server.ntp;
 
 
+import java.net.InetSocketAddress;
+import java.io.IOException;
+
 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.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
+import org.apache.mina.common.ThreadModel;
 
 
 /**
@@ -44,14 +53,55 @@
     /** The default service name. */
     private static final String SERVICE_NAME_DEFAULT = "ApacheDS NTP Service";
 
+    private final ApacheDS apacheDS;
 
     /**
      * Creates a new instance of NtpConfiguration.
      */
-    public NtpConfiguration()
+    public NtpConfiguration( ApacheDS apacheDS )
     {
+        this.apacheDS = apacheDS;
         super.setIpPort( IP_PORT_DEFAULT );
         super.setServicePid( SERVICE_PID_DEFAULT );
         super.setServiceName( SERVICE_NAME_DEFAULT );
     }
+
+    /**
+     * @org.apache.xbean.InitMethod
+     */
+    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 );
+    }
+
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    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;
+    }
+
 }

Added: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java?rev=583375&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java (added)
+++ directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java Wed Oct 10 00:31:43 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.ntp;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+import org.apache.directory.server.configuration.ApacheDS;
+import org.apache.directory.server.ntp.protocol.NtpProtocolHandler;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
+
+/**
+ * @version $Rev$ $Date$
+ * @org.apache.xbean.XBean
+ */
+public class TcpNtpServer extends AbstractNtpServer
+{
+    /**
+     * Creates a new instance of NtpConfiguration.
+     */
+    public TcpNtpServer( ApacheDS apacheDS )
+    {
+        super( apacheDS );
+    }
+
+    /**
+     * @org.apache.xbean.InitMethod
+     */
+    public void start() throws IOException
+        {
+        SocketAcceptorConfig tcpConfig = getTcpConfig();
+        getApacheDS().getTcpAcceptor().bind( new InetSocketAddress( getIpPort() ), new NtpProtocolHandler(), tcpConfig );
+    }
+
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    public void stop()
+    {
+        getApacheDS().getTcpAcceptor().unbind( new InetSocketAddress( getIpPort() ) );
+    }
+
+}

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/TcpNtpServer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java?rev=583375&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java (added)
+++ directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java Wed Oct 10 00:31:43 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.ntp;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+import org.apache.directory.server.configuration.ApacheDS;
+import org.apache.directory.server.ntp.protocol.NtpProtocolHandler;
+import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
+
+/**
+ * @version $Rev$ $Date$
+ * @org.apache.xbean.XBean
+ */
+public class UdpNtpServer extends AbstractNtpServer
+{
+    /**
+     * Creates a new instance of NtpConfiguration.
+     */
+    public UdpNtpServer( ApacheDS apacheDS )
+    {
+        super( apacheDS );
+    }
+
+    /**
+     * @org.apache.xbean.InitMethod
+     */
+    public void start() throws IOException
+    {
+        //If appropriate, the udp and tcp servers could be enabled with boolean flags.
+        DatagramAcceptorConfig udpConfig = getUdpConfig();
+        getApacheDS().getUdpAcceptor().bind( new InetSocketAddress( getIpPort() ), new NtpProtocolHandler(), udpConfig );
+    }
+
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    public void stop()
+    {
+        getApacheDS().getUdpAcceptor().unbind( new InetSocketAddress( getIpPort() ) );
+    }
+
+}

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: directory/apacheds/branches/bigbang/protocol-ntp/src/main/java/org/apache/directory/server/ntp/UdpNtpServer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=583375&r1=583374&r2=583375&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 00:31:43 2007
@@ -19,8 +19,9 @@
  */
 
 /**
- * Provides the entry point to an instance of the
- * {@link org.apache.directory.server.ntp.NtpServer},
+ * Provides the entry point to instances of the
+ * {@link org.apache.directory.server.ntp.UdpNtpServer} and
+ * {@link org.apache.directory.server.ntp.TcpNtpServer},
  * as well as support for configuration and the root
  * of the exception hierarchy.
  *