directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r325857 - in /directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server: configuration/MutableServerStartupConfiguration.java configuration/ServerStartupConfiguration.java jndi/ServerContextFactory.java
Date Mon, 17 Oct 2005 08:05:00 GMT
Author: trustin
Date: Mon Oct 17 01:04:54 2005
New Revision: 325857

URL: http://svn.apache.org/viewcvs?rev=325857&view=rev
Log:
Added ExtendedOperationHandlers property to ServerStartupConfiguration sothat users cn configure
LDAP extended operation handlers.

Modified:
    directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
    directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
    directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java

Modified: directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java?rev=325857&r1=325856&r2=325857&view=diff
==============================================================================
--- directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
(original)
+++ directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/MutableServerStartupConfiguration.java
Mon Oct 17 01:04:54 2005
@@ -19,6 +19,7 @@
 package org.apache.ldap.server.configuration;
 
 import java.io.File;
+import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
@@ -98,5 +99,9 @@
     public void setMinaServiceRegistry( ServiceRegistry minaServiceRegistry )
     {
         super.setMinaServiceRegistry( minaServiceRegistry );
+    }
+
+    public void setExtendedOperationHandlers(Collection handlers) {
+        super.setExtendedOperationHandlers(handlers);
     }
 }

Modified: directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java?rev=325857&r1=325856&r2=325857&view=diff
==============================================================================
--- directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
(original)
+++ directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/configuration/ServerStartupConfiguration.java
Mon Oct 17 01:04:54 2005
@@ -18,6 +18,11 @@
  */
 package org.apache.ldap.server.configuration;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.ldap.server.protocol.ExtendedOperationHandler;
 import org.apache.mina.registry.ServiceRegistry;
 import org.apache.mina.registry.SimpleServiceRegistry;
 
@@ -36,6 +41,7 @@
     private int ldapPort = 389;
     private int ldapsPort = 636;
     private boolean enableKerberos;
+    private final Collection extendedOperationHandlers = new ArrayList();
 
     protected ServerStartupConfiguration()
     {
@@ -127,5 +133,25 @@
             throw new ConfigurationException( "MinaServiceRegistry cannot be null" );
         }
         this.minaServiceRegistry = minaServiceRegistry;
+    }
+    
+    public Collection getExtendedOperationHandlers()
+    {
+        return new ArrayList( extendedOperationHandlers );
+    }
+    
+    protected void setExtendedOperationHandlers( Collection handlers )
+    {
+        for( Iterator i = handlers.iterator(); i.hasNext(); )
+        {
+            if( !( i.next() instanceof ExtendedOperationHandler ) )
+            {
+                throw new IllegalArgumentException(
+                        "The specified handler collection contains an element which is not
an ExtendedOperationHandler." );
+            }
+        }
+        
+        this.extendedOperationHandlers.clear();
+        this.extendedOperationHandlers.addAll( handlers );
     }
 }

Modified: directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java?rev=325857&r1=325856&r2=325857&view=diff
==============================================================================
--- directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
(original)
+++ directory/apacheds/trunk/main/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
Mon Oct 17 01:04:54 2005
@@ -40,6 +40,7 @@
 import org.apache.ldap.common.util.PropertiesUtils;
 import org.apache.ldap.server.DirectoryService;
 import org.apache.ldap.server.configuration.ServerStartupConfiguration;
+import org.apache.ldap.server.protocol.ExtendedOperationHandler;
 import org.apache.ldap.server.protocol.LdapProtocolProvider;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.registry.Service;
@@ -204,9 +205,17 @@
         int port = cfg.getLdapPort();
         Service service = new Service( "ldap", TransportType.SOCKET, new InetSocketAddress(
port ) );
 
+        // Register all extended operation handlers.
+        LdapProtocolProvider protocolProvider = new LdapProtocolProvider( ( Hashtable ) env.clone()
);
+        for( Iterator i = cfg.getExtendedOperationHandlers().iterator(); i.hasNext(); )
+        {
+            ExtendedOperationHandler h = ( ExtendedOperationHandler ) i.next();
+            protocolProvider.addExtendedOperationHandler( h );
+        }
+        
         try
         {
-            minaRegistry.bind( service, new LdapProtocolProvider( ( Hashtable ) env.clone()
) );
+            minaRegistry.bind( service, protocolProvider );
             ldapService = service;
             if ( log.isInfoEnabled() )
             {



Mime
View raw message