geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r264066 - in /geronimo/trunk/modules/directory/src: java/org/apache/geronimo/directory/ test/org/apache/geronimo/directory/
Date Mon, 29 Aug 2005 05:19:12 GMT
Author: jgenender
Date: Sun Aug 28 22:19:07 2005
New Revision: 264066

URL: http://svn.apache.org/viewcvs?rev=264066&view=rev
Log:
Added host listener capabilities

Modified:
    geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/DirectoryGBean.java
    geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/MutableServerStartupConfiguration.java
    geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerContextFactory.java
    geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerStartupConfiguration.java
    geronimo/trunk/modules/directory/src/test/org/apache/geronimo/directory/RunningTest.java

Modified: geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/DirectoryGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/DirectoryGBean.java?rev=264066&r1=264065&r2=264066&view=diff
==============================================================================
--- geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/DirectoryGBean.java
(original)
+++ geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/DirectoryGBean.java
Sun Aug 28 22:19:07 2005
@@ -17,6 +17,7 @@
 
 package org.apache.geronimo.directory;
 
+import java.net.InetAddress;
 import java.util.Properties;
 
 import javax.naming.Context;
@@ -47,7 +48,8 @@
     private String securityPrincipal;
     private String securityCredentials;
     private String securityAuthentication;
-    private int ldapPort = 389;
+    private int port = 389;
+    private InetAddress host = null;
     private boolean enableNetworking;
     
     /**
@@ -70,6 +72,7 @@
         this.classLoader = classLoader;
         this.anonymousAccess = anonymousAccess;
         this.serverInfo = serverInfo;
+        setHost("0.0.0.0");
     }
 
     public String getProviderURL() {
@@ -112,12 +115,38 @@
         this.enableNetworking = enableNetworking;
     }
 
-    public int getLdapPort() {
-        return ldapPort;
+    public String getHost() {
+        if (host == null){
+            return "0.0.0.0";
+        }
+        
+        return host.getHostAddress();
+    }
+
+    public void setHost(String host) {
+        try{
+            if (host == null )
+                this.host = null;
+            
+            String strHost = host.trim();
+            if (strHost.equals("0.0.0.0")){
+                this.host = null;
+                return;
+            }
+
+            this.host = InetAddress.getByName(strHost);
+
+        } catch (Exception e){
+            throw new RuntimeException(e);
+        }
+    }
+
+    public int getPort() {
+        return port;
     }
 
-    public void setLdapPort(int ldapPort) {
-        this.ldapPort = ldapPort;
+    public void setPort(int port) {
+        this.port = port;
     }
 
     public void doFail() {
@@ -151,8 +180,9 @@
         // put some mandatory JNDI properties here
         startup.setWorkingDirectory(serverInfo.resolve(workingDir));
         startup.setAllowAnonymousAccess(anonymousAccess);
-        startup.setLdapPort(ldapPort);
+        startup.setLdapPort(port);
         startup.setEnableNetworking(enableNetworking);
+        startup.setHost(host);
         
         Properties env = new Properties();
         env.putAll(startup.toJndiEnvironment());
@@ -203,7 +233,8 @@
         infoFactory.addAttribute("securityAuthentication", String.class, true, true);
         infoFactory.addAttribute("securityPrincipal", String.class, true, true);
         infoFactory.addAttribute("securityCredentials", String.class, true, true);
-        infoFactory.addAttribute("ldapPort", int.class, true, true);
+        infoFactory.addAttribute("port", int.class, true, true);
+        infoFactory.addAttribute("host", String.class, true, true);
         infoFactory.addAttribute("enableNetworking", boolean.class, true, true);
         
         infoFactory.addAttribute("workingDir", String.class, true);

Modified: geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/MutableServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/MutableServerStartupConfiguration.java?rev=264066&r1=264065&r2=264066&view=diff
==============================================================================
--- geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/MutableServerStartupConfiguration.java
(original)
+++ geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/MutableServerStartupConfiguration.java
Sun Aug 28 22:19:07 2005
@@ -18,6 +18,7 @@
 package org.apache.geronimo.directory;
 
 import java.io.File;
+import java.net.InetAddress;
 import java.util.List;
 import java.util.Set;
 
@@ -78,6 +79,10 @@
         super.setEnableKerberos( enableKerberos );
     }
 
+    public void setHost(InetAddress host){        
+        super.setHost(host);
+    }
+    
     public void setLdapPort( int ldapPort )
     {
         super.setLdapPort( ldapPort );

Modified: geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerContextFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerContextFactory.java?rev=264066&r1=264065&r2=264066&view=diff
==============================================================================
--- geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerContextFactory.java
(original)
+++ geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerContextFactory.java
Sun Aug 28 22:19:07 2005
@@ -17,6 +17,7 @@
 package org.apache.geronimo.directory;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -200,7 +201,9 @@
     private void startLdapProtocol( ServerStartupConfiguration cfg, Hashtable env ) throws
NamingException
     {
         int port = cfg.getLdapPort();
-        Service service = new Service( "ldap", TransportType.SOCKET, new InetSocketAddress(
port ) );
+        InetAddress host = cfg.getHost();
+        Service service = new Service( "ldap", TransportType.SOCKET, new InetSocketAddress(
host, port ) );
+//        Service service = new Service( "ldap", TransportType.SOCKET, new InetSocketAddress(
port ) );
 
         try
         {

Modified: geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerStartupConfiguration.java?rev=264066&r1=264065&r2=264066&view=diff
==============================================================================
--- geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerStartupConfiguration.java
(original)
+++ geronimo/trunk/modules/directory/src/java/org/apache/geronimo/directory/ServerStartupConfiguration.java
Sun Aug 28 22:19:07 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.directory;
 
+import java.net.InetAddress;
+
 import org.apache.ldap.server.configuration.ConfigurationException;
 import org.apache.ldap.server.configuration.StartupConfiguration;
 import org.apache.mina.registry.ServiceRegistry;
@@ -34,10 +36,19 @@
     private ServiceRegistry minaServiceRegistry = new SimpleServiceRegistry();
     private int ldapPort = 389;
     private int ldapsPort = 636;
+    private InetAddress host = null;
     private boolean enableKerberos;
 
     protected ServerStartupConfiguration()
     {
+    }
+
+    protected InetAddress getHost() {
+        return host;
+    }
+
+    protected void setHost(InetAddress host) {
+        this.host = host;
     }
 
     /**

Modified: geronimo/trunk/modules/directory/src/test/org/apache/geronimo/directory/RunningTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/directory/src/test/org/apache/geronimo/directory/RunningTest.java?rev=264066&r1=264065&r2=264066&view=diff
==============================================================================
--- geronimo/trunk/modules/directory/src/test/org/apache/geronimo/directory/RunningTest.java
(original)
+++ geronimo/trunk/modules/directory/src/test/org/apache/geronimo/directory/RunningTest.java
Sun Aug 28 22:19:07 2005
@@ -115,7 +115,7 @@
         directoryGBean.setAttribute("securityCredentials", CREDENTIALS);
         directoryGBean.setAttribute("anonymousAccess", new Boolean(true));
         directoryGBean.setAttribute("enableNetworking", new Boolean(true));
-        directoryGBean.setAttribute("ldapPort", new Integer(9389));
+        directoryGBean.setAttribute("port", new Integer(9389));
 
         start(directoryGBean);
 



Mime
View raw message