You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/08/06 23:05:38 UTC

svn commit: r230589 - in /geronimo/trunk/modules: assembly/src/plan/ jetty/src/java/org/apache/geronimo/jetty/ jetty/src/java/org/apache/geronimo/jetty/connector/ jetty/src/test/org/apache/geronimo/jetty/connector/

Author: ammulder
Date: Sat Aug  6 14:05:32 2005
New Revision: 230589

URL: http://svn.apache.org/viewcvs?rev=230589&view=rev
Log:
Start work on implementing management API in Jetty
 - standardize network/SSL properties
 - container can add/remove connectors

Added:
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java
Modified:
    geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
    geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainer.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
    geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml Sat Aug  6 14:05:32 2005
@@ -228,7 +228,7 @@
     <gbean gbeanName="openejb:type=NetworkService,name=EJB" class="org.openejb.server.StandardServiceStackGBean">
         <attribute name="name">EJB</attribute>
         <attribute name="port">${PlanOpenEJBPort}</attribute>
-        <attribute name="address">${PlanServerHostname}</attribute>
+        <attribute name="host">${PlanServerHostname}</attribute>
         <attribute name="allowHosts">${PlanClientAddresses}</attribute>
         <attribute name="logOnSuccess">HOST,NAME,THREADID,USERID</attribute>
         <attribute name="logOnFailure">HOST,NAME</attribute>

Modified: geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/jetty-config.xml?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/jetty-config.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/jetty-config.xml Sat Aug  6 14:05:32 2005
@@ -53,7 +53,7 @@
         <attribute name="password">secret</attribute>
         <attribute name="keyPassword">secret</attribute>
         <attribute name="needClientAuth">false</attribute>
-        <attribute name="protocol">TLS</attribute>
+        <attribute name="secureProtocol">TLS</attribute>
         <attribute name="maxThreads">50</attribute>
         <attribute name="minThreads">10</attribute>
         <reference name="JettyContainer"><name>WebContainer</name></reference>

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainer.java?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainer.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainer.java Sat Aug  6 14:05:32 2005
@@ -21,11 +21,12 @@
 import org.mortbay.http.HttpListener;
 import org.mortbay.http.RequestLog;
 import org.mortbay.http.UserRealm;
+import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
 
 /**
  * @version $Rev$ $Date$
  */
-public interface JettyContainer {
+public interface JettyContainer extends WebContainer {
     void addListener(HttpListener listener);
 
     void removeListener(HttpListener listener);

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyContainerImpl.java Sat Aug  6 14:05:32 2005
@@ -19,25 +19,54 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.ArrayList;
 
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.webservices.SoapHandler;
 import org.apache.geronimo.webservices.WebServiceContainer;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.NoSuchOperationException;
+import org.apache.geronimo.kernel.management.StateManageable;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.Util;
+import org.apache.geronimo.jetty.connector.HTTPConnector;
+import org.apache.geronimo.jetty.connector.HTTPSConnector;
+import org.apache.geronimo.jetty.connector.AJP13Connector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.mortbay.http.*;
 import org.mortbay.jetty.Server;
 
 /**
  * @version $Rev$ $Date$
  */
-public class JettyContainerImpl implements JettyContainer, SoapHandler, GBeanLifecycle {
+public class JettyContainerImpl implements JettyContainer, SoapHandler, StateManageable, GBeanLifecycle {
+    private final static Log log = LogFactory.getLog(JettyContainerImpl.class);
     private final Server server;
     private final Map webServices = new HashMap();
+    private Kernel kernel;
+    private ObjectName myName;
 
-
-    public JettyContainerImpl() {
+    public JettyContainerImpl(Kernel kernel, String objectName) {
         server = new JettyServer();
+        this.kernel = kernel;
+        try {
+            myName = ObjectName.getInstance(objectName);
+        } catch (MalformedObjectNameException e) {
+            log.error(e);
+        }
     }
 
     public void resetStatistics() {
@@ -148,6 +177,129 @@
         server.setRequestLog(log);
     }
 
+    /**
+     * Gets the protocols which this container can configure connectors for.
+     */
+    public String[] getSupportedProtocols() {
+        return new String[]{PROTOCOL_HTTP, PROTOCOL_HTTPS, PROTOCOL_AJP};
+    }
+
+    /**
+     * Gets the ObjectNames of any existing connectors for the specified
+     * protocol.
+     *
+     * @param protocol A protocol as returned by getSupportedProtocols
+     */
+    public String[] getConnectors(String protocol) {
+        GBeanQuery query = new GBeanQuery(null, JettyWebConnector.class.getName());
+        Set names = kernel.listGBeans(query);
+        List result = new ArrayList();
+        for (Iterator it = names.iterator(); it.hasNext();) {
+            ObjectName name = (ObjectName) it.next();
+            try {
+                if(kernel.getAttribute(name, "protocol").equals(protocol)) {
+                    result.add(name.getCanonicalName());
+                }
+            } catch (Exception e) {
+                log.error("Unable to check the protocol for a connector", e);
+            }
+        }
+        return (String[]) result.toArray(new String[result.size()]);
+    }
+
+    /**
+     * Gets the ObjectNames of any existing connectors.
+     */
+    public String[] getConnectors() {
+        GBeanQuery query = new GBeanQuery(null, JettyWebConnector.class.getName());
+        Set names = kernel.listGBeans(query);
+        String[] result = new String[names.size()];
+        int i=0;
+        for (Iterator it = names.iterator(); it.hasNext();) {
+            ObjectName name = (ObjectName) it.next();
+            result[i++] = name.getCanonicalName();
+        }
+        return result;
+    }
+
+    /**
+     * Creates a new connector, and returns the ObjectName for it.  Note that
+     * the connector may well require further customization before being fully
+     * functional (e.g. SSL settings for an HTTPS connector).
+     */
+    public String addConnector(String uniqueName, String protocol, String host, int port) {
+        ObjectName name = getConnectorName(protocol, uniqueName);
+        GBeanData connector;
+        if(protocol.equals(PROTOCOL_HTTP)) {
+            connector = new GBeanData(name, HTTPConnector.GBEAN_INFO);
+        } else if(protocol.equals(PROTOCOL_HTTPS)) {
+            connector = new GBeanData(name, HTTPSConnector.GBEAN_INFO);
+        } else if(protocol.equals(PROTOCOL_AJP)) {
+            connector = new GBeanData(name, AJP13Connector.GBEAN_INFO);
+        } else {
+            throw new IllegalArgumentException("Invalid protocol '"+protocol+"'");
+        }
+        connector.setAttribute("host", host);
+        connector.setAttribute("port", new Integer(port));
+        connector.setReferencePattern("JettyContainer", myName);
+        ObjectName config = Util.getConfiguration(kernel, myName);
+        try {
+            kernel.invoke(config, "addGBean", new Object[]{connector, Boolean.FALSE}, new String[]{GBeanData.class.getName(), boolean.class.getName()});
+        } catch (Exception e) {
+            log.error("Unable to add GBean ", e);
+            return null;
+        }
+        return name.getCanonicalName();
+    }
+
+    private ObjectName getConnectorName(String protocol, String uniqueName) {
+        Hashtable table = new Hashtable();
+        table.put(NameFactory.J2EE_APPLICATION, myName.getKeyProperty(NameFactory.J2EE_APPLICATION));
+        table.put(NameFactory.J2EE_SERVER, myName.getKeyProperty(NameFactory.J2EE_SERVER));
+        table.put(NameFactory.J2EE_MODULE, myName.getKeyProperty(NameFactory.J2EE_MODULE));
+        table.put(NameFactory.J2EE_TYPE, myName.getKeyProperty(NameFactory.J2EE_TYPE));
+        table.put(NameFactory.J2EE_NAME, "JettyWebConnector-"+protocol+"-"+uniqueName);
+        try {
+            return ObjectName.getInstance(myName.getDomain(), table);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalStateException("Never should have failed: "+e.getMessage());
+        }
+    }
+
+    /**
+     * Removes a connector.  This shuts it down if necessary, and removes it
+     * from the server environment.  It must be a connector that this container
+     * is responsible for.
+     */
+    public void removeConnector(String objectName) {
+        ObjectName name = null;
+        try {
+            name = ObjectName.getInstance(objectName);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException("Invalid object name '"+objectName+"': "+e.getMessage());
+        }
+        try {
+            GBeanInfo info = kernel.getGBeanInfo(name);
+            boolean found = false;
+            Set intfs = info.getInterfaces();
+            for (Iterator it = intfs.iterator(); it.hasNext();) {
+                String intf = (String) it.next();
+                if(intf.equals(JettyWebConnector.class.getName())) {
+                    found = true;
+                }
+            }
+            if(!found) {
+                throw new GBeanNotFoundException(name);
+            }
+            ObjectName config = Util.getConfiguration(kernel, name);
+            kernel.invoke(config, "removeGBean", new Object[]{name}, new String[]{ObjectName.class.getName()});
+        } catch (GBeanNotFoundException e) {
+            log.warn("No such GBean '"+objectName+"'"); //todo: what if we want to remove a failed GBean?
+        } catch (Exception e) {
+            log.error(e);
+        }
+    }
+
     /* ------------------------------------------------------------ */
     public RequestLog getRequestLog() {
         return server.getRequestLog();
@@ -172,10 +324,44 @@
         }
     }
 
+    public int getState() {
+        try {
+            return kernel.getGBeanState(myName);
+        } catch (GBeanNotFoundException e) {
+            return State.STOPPED_INDEX;
+        }
+    }
+
+    public State getStateInstance() {
+        return State.fromInt(getState());
+    }
+
+    public long getStartTime() {
+        try {
+            return kernel.getGBeanStartTime(myName);
+        } catch (GBeanNotFoundException e) {
+            return -1;
+        }
+    }
+
+    public void start() throws Exception, IllegalStateException {
+        // Kernel intercepts this
+    }
+
+    public void startRecursive() throws Exception, IllegalStateException {
+        // Kernel intercepts this
+    }
+
+    public void stop() throws Exception, IllegalStateException {
+        kernel.stopGBean(myName);
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder("Jetty Web Container", JettyContainerImpl.class);
+        infoBuilder.addAttribute("kernel", Kernel.class, false);
+        infoBuilder.addAttribute("objectName", String.class, false);
         infoBuilder.addAttribute("collectStatistics", Boolean.TYPE, true);
         infoBuilder.addAttribute("collectStatisticsStarted", Long.TYPE, false);
         infoBuilder.addAttribute("connections", Integer.TYPE, false);
@@ -203,6 +389,9 @@
         infoBuilder.addOperation("removeRealm", new Class[]{UserRealm.class});
 
         infoBuilder.addInterface(SoapHandler.class);
+        infoBuilder.addInterface(JettyContainer.class);
+        infoBuilder.addInterface(StateManageable.class);
+        infoBuilder.setConstructor(new String[]{"kernel","objectName"});
 
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }

Added: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java?rev=230589&view=auto
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java (added)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java Sat Aug  6 14:05:32 2005
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed 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.geronimo.jetty;
+
+import org.apache.geronimo.j2ee.management.geronimo.WebConnector;
+
+/**
+ * A Jetty-specific extension to the standard Geronimo web connector interface.
+ *
+ * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
+ */
+public interface JettyWebConnector extends WebConnector {
+    /**
+     * Gets the minimum number of threads used to service connections from
+     * this connector.
+     */
+    public int getMinThreads();
+    /**
+     * Sets the minimum number of threads used to service connections from
+     * this connector.
+     */
+    public void setMinThreads(int threads);
+
+    public int getThreads();
+
+    public int getIdlethreads();
+
+    public String getDefaultScheme();
+}

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java Sat Aug  6 14:05:32 2005
@@ -20,21 +20,27 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.jetty.JettyContainer;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
 import org.mortbay.http.ajp.AJP13Listener;
 
 /**
  * @version $Rev$ $Date$
  */
 public class AJP13Connector extends JettyConnector {
-    public AJP13Connector(JettyContainer container) {
-        super(container, new AJP13Listener());
+    public AJP13Connector(JettyContainer container, String objectName, Kernel kernel) {
+        super(container, new AJP13Listener(), objectName, kernel);
+    }
+
+    public String getProtocol() {
+        return WebContainer.PROTOCOL_AJP;
     }
 
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector AJP13", AJP13Connector.class, JettyConnector.GBEAN_INFO);
-        infoFactory.setConstructor(new String[]{"JettyContainer"});
+        infoFactory.setConstructor(new String[]{"JettyContainer","objectName","kernel"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java Sat Aug  6 14:05:32 2005
@@ -20,21 +20,27 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.jetty.JettyContainer;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
 import org.mortbay.http.SocketListener;
 
 /**
  * @version $Rev$ $Date$
  */
 public class HTTPConnector extends JettyConnector {
-    public HTTPConnector(JettyContainer container) {
-        super(container, new SocketListener());
+    public HTTPConnector(JettyContainer container, String objectName, Kernel kernel) {
+        super(container, new SocketListener(), objectName, kernel);
+    }
+
+    public String getProtocol() {
+        return WebContainer.PROTOCOL_HTTP;
     }
 
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector HTTP", HTTPConnector.class, JettyConnector.GBEAN_INFO);
-        infoFactory.setConstructor(new String[]{"JettyContainer"});
+        infoFactory.setConstructor(new String[]{"JettyContainer","objectName","kernel"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java Sat Aug  6 14:05:32 2005
@@ -24,8 +24,10 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
 import org.apache.geronimo.jetty.JettyContainer;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.kernel.Kernel;
 
 /**
  * Implementation of a HTTPS connector based on Jetty's SslConnector (which uses pure JSSE).
@@ -38,12 +40,16 @@
     private String keystore;
     private String algorithm;
 
-    public HTTPSConnector(JettyContainer container, ServerInfo serverInfo) {
-        super(container, new SslListener());
+    public HTTPSConnector(JettyContainer container, ServerInfo serverInfo, String objectName, Kernel kernel) {
+        super(container, new SslListener(), objectName, kernel);
         this.serverInfo = serverInfo;
         https = (SslListener) listener;
     }
 
+    public String getProtocol() {
+        return WebContainer.PROTOCOL_HTTPS;
+    }
+
     public String getKeystore() {
         // this does not delegate to https as it needs to be resolved against ServerInfo
         return keystore;
@@ -82,11 +88,11 @@
         https.setKeyPassword(password);
     }
 
-    public String getProtocol() {
+    public String getSecureProtocol() {
         return https.getProtocol();
     }
 
-    public void setProtocol(String protocol) {
+    public void setSecureProtocol(String protocol) {
         https.setProtocol(protocol);
     }
 
@@ -121,9 +127,9 @@
         infoFactory.addAttribute("keystoreType", String.class, true);
         infoFactory.addAttribute("needClientAuth", boolean.class, true);
         infoFactory.addAttribute("password", String.class, true);
-        infoFactory.addAttribute("protocol", String.class, true);
+        infoFactory.addAttribute("secureProtocol", String.class, true);
         infoFactory.addReference("ServerInfo", ServerInfo.class, NameFactory.GERONIMO_SERVICE);
-        infoFactory.setConstructor(new String[]{"JettyContainer", "ServerInfo"});
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ServerInfo", "objectName", "kernel"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java (original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java Sat Aug  6 14:05:32 2005
@@ -20,21 +20,29 @@
 import java.net.UnknownHostException;
 import java.net.InetSocketAddress;
 
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.jetty.JettyContainer;
+import org.apache.geronimo.jetty.JettyWebConnector;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.management.StateManageable;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
 import org.mortbay.http.HttpListener;
-import org.mortbay.http.SocketListener;
 import org.mortbay.util.ThreadedServer;
 
 /**
  * @version $Rev$ $Date$
  */
-public abstract class JettyConnector implements GBeanLifecycle {
+public abstract class JettyConnector implements GBeanLifecycle, JettyWebConnector {
     private final JettyContainer container;
     protected final HttpListener listener;
+    private final ObjectName objectName;
+    private final Kernel kernel;
 
     /**
      * Only used to allow declaration as a reference.
@@ -42,16 +50,34 @@
     public JettyConnector() {
         container = null;
         listener = null;
+        objectName = null;
+        kernel = null;
     }
 
-    public JettyConnector(JettyContainer container) {
+    public JettyConnector(JettyContainer container, String objectName, Kernel kernel) {
         this.container = container;
-        this.listener = null; 
+        this.listener = null;
+        this.kernel = kernel;
+        try {
+            this.objectName = ObjectName.getInstance(objectName);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
     }
 
-    public JettyConnector(JettyContainer container, HttpListener listener) {
+    public JettyConnector(JettyContainer container, HttpListener listener, String objectName, Kernel kernel) {
         this.container = container;
-        this.listener = listener; 
+        this.listener = listener;
+        this.kernel = kernel;
+        try {
+            this.objectName = ObjectName.getInstance(objectName);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
+    }
+
+    public String getObjectName() {
+        return objectName.getCanonicalName();
     }
 
     public String getDefaultScheme() {
@@ -101,10 +127,52 @@
       return ((ThreadedServer)listener).getIdleThreads();
     }
     
-    public InetSocketAddress getAddress() {
+    public InetSocketAddress getListenAddress() {
         return new InetSocketAddress(getHost(), getPort());
     }
 
+    public int getBufferSizeBytes() {
+        return listener.getBufferSize();
+    }
+
+    public void setBufferSizeBytes(int bytes) {
+        throw new UnsupportedOperationException(); //todo: is this supported?
+    }
+
+    public int getAcceptQueueSize() {
+        throw new UnsupportedOperationException(); //todo: where does this come from?
+    }
+
+    public void setAcceptQueueSize(int size) {
+        throw new UnsupportedOperationException(); //todo: where does this come from?
+    }
+
+    public int getLingerMillis() {
+        throw new UnsupportedOperationException(); //todo: where does this come from?
+    }
+
+    public void setLingerMillis(int millis) {
+        throw new UnsupportedOperationException(); //todo: where does this come from?
+    }
+
+    public boolean isTcpNoDelay() {
+        throw new UnsupportedOperationException(); //todo: where does this come from?
+    }
+
+    public void setTcpNoDelay(boolean enable) {
+        throw new UnsupportedOperationException(); //todo: where does this come from?
+    }
+
+    public int getRedirectPort() {
+        return listener.getConfidentialPort();
+    }
+
+    public void setRedirectPort(int port) {
+        throw new UnsupportedOperationException(); //todo: is this supported?
+    }
+
+    public abstract String getProtocol();
+
     public void doStart() throws Exception {
         container.addListener(listener);
         ((ThreadedServer) listener).open();
@@ -134,20 +202,57 @@
             }
         }
     }
+
+    public int getState() {
+        try {
+            return kernel.getGBeanState(objectName);
+        } catch (GBeanNotFoundException e) {
+            return State.STOPPED_INDEX;
+        }
+    }
+
+    public State getStateInstance() {
+        return State.fromInt(getState());
+    }
+
+    public long getStartTime() {
+        try {
+            return kernel.getGBeanStartTime(objectName);
+        } catch (GBeanNotFoundException e) {
+            return -1;
+        }
+    }
+
+    public void start() throws Exception, IllegalStateException {
+        // Kernel intercepts this
+    }
+
+    public void startRecursive() throws Exception, IllegalStateException {
+        // Kernel intercepts this
+    }
+
+    public void stop() throws Exception, IllegalStateException {
+        kernel.stopGBean(objectName);
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty HTTP Connector", JettyConnector.class);
         infoFactory.addAttribute("defaultScheme", String.class, false);
+        infoFactory.addAttribute("objectName", String.class, false);
+        infoFactory.addAttribute("kernel", Kernel.class, false);
         infoFactory.addAttribute("host", String.class, true);
         infoFactory.addAttribute("port", int.class, true);
         infoFactory.addAttribute("minThreads", int.class, true);
         infoFactory.addAttribute("maxThreads", int.class, true);
         infoFactory.addAttribute("threads", int.class, false);
         infoFactory.addAttribute("idleThreads", int.class, false);
-        infoFactory.addAttribute("address", InetSocketAddress.class, false);
+        infoFactory.addAttribute("listenAddress", InetSocketAddress.class, false);
         infoFactory.addReference("JettyContainer", JettyContainer.class, NameFactory.GERONIMO_SERVICE);
-        infoFactory.setConstructor(new String[] {"JettyContainer"});
+        infoFactory.addInterface(JettyWebConnector.class);
+        infoFactory.addInterface(StateManageable.class);
+        infoFactory.setConstructor(new String[] {"JettyContainer","objectName","kernel"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 }

Modified: geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java?rev=230589&r1=230588&r2=230589&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java (original)
+++ geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java Sat Aug  6 14:05:32 2005
@@ -30,11 +30,11 @@
     public void testAddress() throws UnknownHostException {
         connector.setHost("localhost");
         connector.setPort(1234);
-        assertEquals(new InetSocketAddress("localhost", 1234), connector.getAddress());
+        assertEquals(new InetSocketAddress("localhost", 1234), connector.getListenAddress());
     }
 
     protected void setUp() throws Exception {
         super.setUp();
-        connector = new HTTPConnector(null);
+        connector = new HTTPConnector(null, "foo:bar=baz", null);
     }
 }



Re: svn commit: r230589 - in /geronimo/trunk/modules: assembly/src/plan/ jetty/src/java/org/apache/geronimo/jetty/ jetty/src/java/org/apache/geronimo/jetty/connector/ jetty/src/test/org/apache/geronimo/jetty/connector/

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
	We talked on IRC and concluded that the code in question is really 
part of a "runtime management" feature for the module in question.  So at 
some point, each module might be broken into something like:

module/runtime (the GBeans)
module/management (the add/remove/lookup GBean mgmt features)
module/builder (the app deployers and deployment time code)
module/console (portlets/pages for the web console)

	For now, I'm going to separate the runtime management code into 
separate GBeans, but leave it in the main module.  If we get to this level 
of organization later we can move it around.

	Also, the main point of contact for the management API will be the 
runtime management GBean, which will then be able to point to the runtime 
GBeans (containers, connectors, pools, whatever).

	Finally, I'm going to start this somewhere other than the web 
containers so that David J can wrap up the work he's doing in that area.

Aaron

On Sat, 20 Aug 2005, Aaron Mulder wrote:
> 	Well, let's talk about it.  I think it's most appropriate for some
> part of the Jetty code to know how to add and remove Jetty components.  I
> don't think it makes sense for all the Tomcat, Jetty, OpenEJB, TranQL,
> etc. code to go into the console (especially since that prevents any other 
> management tool from using it without web/portal dependencies).
> 
> 	If you wanted each product to have a "Manager" or "server
> component Builder" or something, I'm OK with that, we just have to agree
> what it should look like.  We could also have a fat management package,
> but again, I question whether this code is better centralized vs kept with
> the modules it belongs to.  The only place this style of code has been
> used so far is for web container network connectors (you'll see the same
> ing Tomcat, for example), but I see it expanding to cover things like:
> 
>  - TranQL database pools
>  - Geronimo security realms
>  - Tomcat valves and security realms
>  - ActiveMQ connection factories & destinations
>  - OpenEJB and ActiveMQ network "connectors"
>  - Geronimo thread pools / work managers
>  - keystores / socket factories (eventually)
> 
> 	It seemed to me to make the most sense to put this stuff in the 
> "container" class for each, since that's kind of the master of the domain, 
> but that doesn't work as well for, say, TranQL.
> 
> 	And I'm course aware of the "more than one container running"
> issue, but I think it's lower priority for now.
> 
> Aaron
> 
> On Sat, 20 Aug 2005, David Jencks wrote:
> > I apologize for the delay, but I must object to most of the code  
> > included in JettyContainerImpl that has to do with constructing and  
> > manipulating other gbeans for connectors.  This needs to be in a  
> > separate class, outside of the jetty runtime.  It is essentially a  
> > small builder module.  I think the most appropriate place for it is in  
> > the web console, but I might be convinced otherwise.  In any case it is  
> > not acceptable to me for builder code such as this to be in a runtime  
> > module.  I have no problem with the being in a module not required for  
> > runtime use of the component being reconfigured, here jetty.
> > 
> > In addition, I think that the getConnectors() method assumes that there  
> > is only one JettyContainer running.  I don't think this is necessarily  
> > valid.
> > 
> > Sorry for the delay,
> > david jencks
> > 
> > On Aug 6, 2005, at 2:05 PM, ammulder@apache.org wrote:
> > 
> > > Author: ammulder
> > > Date: Sat Aug  6 14:05:32 2005
> > > New Revision: 230589
> > >
> > > URL: http://svn.apache.org/viewcvs?rev=230589&view=rev
> > > Log:
> > > Start work on implementing management API in Jetty
> > >  - standardize network/SSL properties
> > >  - container can add/remove connectors
> > >
> > > Added:
> > >      
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyWebConnector.java
> > > Modified:
> > >     geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
> > >     geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
> > >      
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainer.java
> > >      
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainerImpl.java
> > >      
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/AJP13Connector.java
> > >      
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnector.java
> > >      
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPSConnector.java
> > >      
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/JettyConnector.java
> > >      
> > > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnectorTest.java
> > >
> > > Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/ 
> > > plan/j2ee-server-plan.xml?rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > --- geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml  
> > > (original)
> > > +++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml Sat  
> > > Aug  6 14:05:32 2005
> > > @@ -228,7 +228,7 @@
> > >      <gbean gbeanName="openejb:type=NetworkService,name=EJB"  
> > > class="org.openejb.server.StandardServiceStackGBean">
> > >          <attribute name="name">EJB</attribute>
> > >          <attribute name="port">${PlanOpenEJBPort}</attribute>
> > > -        <attribute name="address">${PlanServerHostname}</attribute>
> > > +        <attribute name="host">${PlanServerHostname}</attribute>
> > >          <attribute  
> > > name="allowHosts">${PlanClientAddresses}</attribute>
> > >          <attribute  
> > > name="logOnSuccess">HOST,NAME,THREADID,USERID</attribute>
> > >          <attribute name="logOnFailure">HOST,NAME</attribute>
> > >
> > > Modified: geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/ 
> > > plan/jetty-config.xml?rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > --- geronimo/trunk/modules/assembly/src/plan/jetty-config.xml  
> > > (original)
> > > +++ geronimo/trunk/modules/assembly/src/plan/jetty-config.xml Sat Aug   
> > > 6 14:05:32 2005
> > > @@ -53,7 +53,7 @@
> > >          <attribute name="password">secret</attribute>
> > >          <attribute name="keyPassword">secret</attribute>
> > >          <attribute name="needClientAuth">false</attribute>
> > > -        <attribute name="protocol">TLS</attribute>
> > > +        <attribute name="secureProtocol">TLS</attribute>
> > >          <attribute name="maxThreads">50</attribute>
> > >          <attribute name="minThreads">10</attribute>
> > >          <reference  
> > > name="JettyContainer"><name>WebContainer</name></reference>
> > >
> > > Modified:  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainer.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > > org/apache/geronimo/jetty/JettyContainer.java? 
> > > rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainer.java (original)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainer.java Sat Aug  6 14:05:32 2005
> > > @@ -21,11 +21,12 @@
> > >  import org.mortbay.http.HttpListener;
> > >  import org.mortbay.http.RequestLog;
> > >  import org.mortbay.http.UserRealm;
> > > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> > >
> > >  /**
> > >   * @version $Rev$ $Date$
> > >   */
> > > -public interface JettyContainer {
> > > +public interface JettyContainer extends WebContainer {
> > >      void addListener(HttpListener listener);
> > >
> > >      void removeListener(HttpListener listener);
> > >
> > > Modified:  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainerImpl.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > > org/apache/geronimo/jetty/JettyContainerImpl.java? 
> > > rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainerImpl.java (original)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyContainerImpl.java Sat Aug  6 14:05:32 2005
> > > @@ -19,25 +19,54 @@
> > >
> > >  import java.util.HashMap;
> > >  import java.util.Map;
> > > +import java.util.Set;
> > > +import java.util.Iterator;
> > > +import java.util.Hashtable;
> > > +import java.util.List;
> > > +import java.util.ArrayList;
> > >
> > > +import javax.management.ObjectName;
> > > +import javax.management.MalformedObjectNameException;
> > >  import org.apache.geronimo.gbean.GBeanInfo;
> > >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > >  import org.apache.geronimo.gbean.GBeanLifecycle;
> > > +import org.apache.geronimo.gbean.GBeanQuery;
> > > +import org.apache.geronimo.gbean.GBeanData;
> > >  import org.apache.geronimo.webservices.SoapHandler;
> > >  import org.apache.geronimo.webservices.WebServiceContainer;
> > > +import org.apache.geronimo.kernel.Kernel;
> > > +import org.apache.geronimo.kernel.GBeanNotFoundException;
> > > +import org.apache.geronimo.kernel.NoSuchOperationException;
> > > +import org.apache.geronimo.kernel.management.StateManageable;
> > > +import org.apache.geronimo.kernel.management.State;
> > > +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > > +import org.apache.geronimo.j2ee.management.impl.Util;
> > > +import org.apache.geronimo.jetty.connector.HTTPConnector;
> > > +import org.apache.geronimo.jetty.connector.HTTPSConnector;
> > > +import org.apache.geronimo.jetty.connector.AJP13Connector;
> > > +import org.apache.commons.logging.Log;
> > > +import org.apache.commons.logging.LogFactory;
> > >  import org.mortbay.http.*;
> > >  import org.mortbay.jetty.Server;
> > >
> > >  /**
> > >   * @version $Rev$ $Date$
> > >   */
> > > -public class JettyContainerImpl implements JettyContainer,  
> > > SoapHandler, GBeanLifecycle {
> > > +public class JettyContainerImpl implements JettyContainer,  
> > > SoapHandler, StateManageable, GBeanLifecycle {
> > > +    private final static Log log =  
> > > LogFactory.getLog(JettyContainerImpl.class);
> > >      private final Server server;
> > >      private final Map webServices = new HashMap();
> > > +    private Kernel kernel;
> > > +    private ObjectName myName;
> > >
> > > -
> > > -    public JettyContainerImpl() {
> > > +    public JettyContainerImpl(Kernel kernel, String objectName) {
> > >          server = new JettyServer();
> > > +        this.kernel = kernel;
> > > +        try {
> > > +            myName = ObjectName.getInstance(objectName);
> > > +        } catch (MalformedObjectNameException e) {
> > > +            log.error(e);
> > > +        }
> > >      }
> > >
> > >      public void resetStatistics() {
> > > @@ -148,6 +177,129 @@
> > >          server.setRequestLog(log);
> > >      }
> > >
> > > +    /**
> > > +     * Gets the protocols which this container can configure  
> > > connectors for.
> > > +     */
> > > +    public String[] getSupportedProtocols() {
> > > +        return new String[]{PROTOCOL_HTTP, PROTOCOL_HTTPS,  
> > > PROTOCOL_AJP};
> > > +    }
> > > +
> > > +    /**
> > > +     * Gets the ObjectNames of any existing connectors for the  
> > > specified
> > > +     * protocol.
> > > +     *
> > > +     * @param protocol A protocol as returned by getSupportedProtocols
> > > +     */
> > > +    public String[] getConnectors(String protocol) {
> > > +        GBeanQuery query = new GBeanQuery(null,  
> > > JettyWebConnector.class.getName());
> > > +        Set names = kernel.listGBeans(query);
> > > +        List result = new ArrayList();
> > > +        for (Iterator it = names.iterator(); it.hasNext();) {
> > > +            ObjectName name = (ObjectName) it.next();
> > > +            try {
> > > +                if(kernel.getAttribute(name,  
> > > "protocol").equals(protocol)) {
> > > +                    result.add(name.getCanonicalName());
> > > +                }
> > > +            } catch (Exception e) {
> > > +                log.error("Unable to check the protocol for a  
> > > connector", e);
> > > +            }
> > > +        }
> > > +        return (String[]) result.toArray(new String[result.size()]);
> > > +    }
> > > +
> > > +    /**
> > > +     * Gets the ObjectNames of any existing connectors.
> > > +     */
> > > +    public String[] getConnectors() {
> > > +        GBeanQuery query = new GBeanQuery(null,  
> > > JettyWebConnector.class.getName());
> > > +        Set names = kernel.listGBeans(query);
> > > +        String[] result = new String[names.size()];
> > > +        int i=0;
> > > +        for (Iterator it = names.iterator(); it.hasNext();) {
> > > +            ObjectName name = (ObjectName) it.next();
> > > +            result[i++] = name.getCanonicalName();
> > > +        }
> > > +        return result;
> > > +    }
> > > +
> > > +    /**
> > > +     * Creates a new connector, and returns the ObjectName for it.   
> > > Note that
> > > +     * the connector may well require further customization before  
> > > being fully
> > > +     * functional (e.g. SSL settings for an HTTPS connector).
> > > +     */
> > > +    public String addConnector(String uniqueName, String protocol,  
> > > String host, int port) {
> > > +        ObjectName name = getConnectorName(protocol, uniqueName);
> > > +        GBeanData connector;
> > > +        if(protocol.equals(PROTOCOL_HTTP)) {
> > > +            connector = new GBeanData(name, HTTPConnector.GBEAN_INFO);
> > > +        } else if(protocol.equals(PROTOCOL_HTTPS)) {
> > > +            connector = new GBeanData(name,  
> > > HTTPSConnector.GBEAN_INFO);
> > > +        } else if(protocol.equals(PROTOCOL_AJP)) {
> > > +            connector = new GBeanData(name,  
> > > AJP13Connector.GBEAN_INFO);
> > > +        } else {
> > > +            throw new IllegalArgumentException("Invalid protocol  
> > > '"+protocol+"'");
> > > +        }
> > > +        connector.setAttribute("host", host);
> > > +        connector.setAttribute("port", new Integer(port));
> > > +        connector.setReferencePattern("JettyContainer", myName);
> > > +        ObjectName config = Util.getConfiguration(kernel, myName);
> > > +        try {
> > > +            kernel.invoke(config, "addGBean", new Object[]{connector,  
> > > Boolean.FALSE}, new String[]{GBeanData.class.getName(),  
> > > boolean.class.getName()});
> > > +        } catch (Exception e) {
> > > +            log.error("Unable to add GBean ", e);
> > > +            return null;
> > > +        }
> > > +        return name.getCanonicalName();
> > > +    }
> > > +
> > > +    private ObjectName getConnectorName(String protocol, String  
> > > uniqueName) {
> > > +        Hashtable table = new Hashtable();
> > > +        table.put(NameFactory.J2EE_APPLICATION,  
> > > myName.getKeyProperty(NameFactory.J2EE_APPLICATION));
> > > +        table.put(NameFactory.J2EE_SERVER,  
> > > myName.getKeyProperty(NameFactory.J2EE_SERVER));
> > > +        table.put(NameFactory.J2EE_MODULE,  
> > > myName.getKeyProperty(NameFactory.J2EE_MODULE));
> > > +        table.put(NameFactory.J2EE_TYPE,  
> > > myName.getKeyProperty(NameFactory.J2EE_TYPE));
> > > +        table.put(NameFactory.J2EE_NAME,  
> > > "JettyWebConnector-"+protocol+"-"+uniqueName);
> > > +        try {
> > > +            return ObjectName.getInstance(myName.getDomain(), table);
> > > +        } catch (MalformedObjectNameException e) {
> > > +            throw new IllegalStateException("Never should have  
> > > failed: "+e.getMessage());
> > > +        }
> > > +    }
> > > +
> > > +    /**
> > > +     * Removes a connector.  This shuts it down if necessary, and  
> > > removes it
> > > +     * from the server environment.  It must be a connector that this  
> > > container
> > > +     * is responsible for.
> > > +     */
> > > +    public void removeConnector(String objectName) {
> > > +        ObjectName name = null;
> > > +        try {
> > > +            name = ObjectName.getInstance(objectName);
> > > +        } catch (MalformedObjectNameException e) {
> > > +            throw new IllegalArgumentException("Invalid object name  
> > > '"+objectName+"': "+e.getMessage());
> > > +        }
> > > +        try {
> > > +            GBeanInfo info = kernel.getGBeanInfo(name);
> > > +            boolean found = false;
> > > +            Set intfs = info.getInterfaces();
> > > +            for (Iterator it = intfs.iterator(); it.hasNext();) {
> > > +                String intf = (String) it.next();
> > > +                if(intf.equals(JettyWebConnector.class.getName())) {
> > > +                    found = true;
> > > +                }
> > > +            }
> > > +            if(!found) {
> > > +                throw new GBeanNotFoundException(name);
> > > +            }
> > > +            ObjectName config = Util.getConfiguration(kernel, name);
> > > +            kernel.invoke(config, "removeGBean", new Object[]{name},  
> > > new String[]{ObjectName.class.getName()});
> > > +        } catch (GBeanNotFoundException e) {
> > > +            log.warn("No such GBean '"+objectName+"'"); //todo: what  
> > > if we want to remove a failed GBean?
> > > +        } catch (Exception e) {
> > > +            log.error(e);
> > > +        }
> > > +    }
> > > +
> > >      /* ------------------------------------------------------------ */
> > >      public RequestLog getRequestLog() {
> > >          return server.getRequestLog();
> > > @@ -172,10 +324,44 @@
> > >          }
> > >      }
> > >
> > > +    public int getState() {
> > > +        try {
> > > +            return kernel.getGBeanState(myName);
> > > +        } catch (GBeanNotFoundException e) {
> > > +            return State.STOPPED_INDEX;
> > > +        }
> > > +    }
> > > +
> > > +    public State getStateInstance() {
> > > +        return State.fromInt(getState());
> > > +    }
> > > +
> > > +    public long getStartTime() {
> > > +        try {
> > > +            return kernel.getGBeanStartTime(myName);
> > > +        } catch (GBeanNotFoundException e) {
> > > +            return -1;
> > > +        }
> > > +    }
> > > +
> > > +    public void start() throws Exception, IllegalStateException {
> > > +        // Kernel intercepts this
> > > +    }
> > > +
> > > +    public void startRecursive() throws Exception,  
> > > IllegalStateException {
> > > +        // Kernel intercepts this
> > > +    }
> > > +
> > > +    public void stop() throws Exception, IllegalStateException {
> > > +        kernel.stopGBean(myName);
> > > +    }
> > > +
> > >      public static final GBeanInfo GBEAN_INFO;
> > >
> > >      static {
> > >          GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder("Jetty  
> > > Web Container", JettyContainerImpl.class);
> > > +        infoBuilder.addAttribute("kernel", Kernel.class, false);
> > > +        infoBuilder.addAttribute("objectName", String.class, false);
> > >          infoBuilder.addAttribute("collectStatistics", Boolean.TYPE,  
> > > true);
> > >          infoBuilder.addAttribute("collectStatisticsStarted",  
> > > Long.TYPE, false);
> > >          infoBuilder.addAttribute("connections", Integer.TYPE, false);
> > > @@ -203,6 +389,9 @@
> > >          infoBuilder.addOperation("removeRealm", new  
> > > Class[]{UserRealm.class});
> > >
> > >          infoBuilder.addInterface(SoapHandler.class);
> > > +        infoBuilder.addInterface(JettyContainer.class);
> > > +        infoBuilder.addInterface(StateManageable.class);
> > > +        infoBuilder.setConstructor(new  
> > > String[]{"kernel","objectName"});
> > >
> > >          GBEAN_INFO = infoBuilder.getBeanInfo();
> > >      }
> > >
> > > Added:  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyWebConnector.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > > org/apache/geronimo/jetty/JettyWebConnector.java?rev=230589&view=auto
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyWebConnector.java (added)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > JettyWebConnector.java Sat Aug  6 14:05:32 2005
> > > @@ -0,0 +1,43 @@
> > > +/**
> > > + *
> > > + * Copyright 2003-2004 The Apache Software Foundation
> > > + *
> > > + *  Licensed 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.geronimo.jetty;
> > > +
> > > +import org.apache.geronimo.j2ee.management.geronimo.WebConnector;
> > > +
> > > +/**
> > > + * A Jetty-specific extension to the standard Geronimo web connector  
> > > interface.
> > > + *
> > > + * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16  
> > > Sep 2004) $
> > > + */
> > > +public interface JettyWebConnector extends WebConnector {
> > > +    /**
> > > +     * Gets the minimum number of threads used to service connections  
> > > from
> > > +     * this connector.
> > > +     */
> > > +    public int getMinThreads();
> > > +    /**
> > > +     * Sets the minimum number of threads used to service connections  
> > > from
> > > +     * this connector.
> > > +     */
> > > +    public void setMinThreads(int threads);
> > > +
> > > +    public int getThreads();
> > > +
> > > +    public int getIdlethreads();
> > > +
> > > +    public String getDefaultScheme();
> > > +}
> > >
> > > Modified:  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/AJP13Connector.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > > org/apache/geronimo/jetty/connector/AJP13Connector.java? 
> > > rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/AJP13Connector.java (original)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/AJP13Connector.java Sat Aug  6 14:05:32 2005
> > > @@ -20,21 +20,27 @@
> > >  import org.apache.geronimo.gbean.GBeanInfo;
> > >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > >  import org.apache.geronimo.jetty.JettyContainer;
> > > +import org.apache.geronimo.kernel.Kernel;
> > > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> > >  import org.mortbay.http.ajp.AJP13Listener;
> > >
> > >  /**
> > >   * @version $Rev$ $Date$
> > >   */
> > >  public class AJP13Connector extends JettyConnector {
> > > -    public AJP13Connector(JettyContainer container) {
> > > -        super(container, new AJP13Listener());
> > > +    public AJP13Connector(JettyContainer container, String  
> > > objectName, Kernel kernel) {
> > > +        super(container, new AJP13Listener(), objectName, kernel);
> > > +    }
> > > +
> > > +    public String getProtocol() {
> > > +        return WebContainer.PROTOCOL_AJP;
> > >      }
> > >
> > >      public static final GBeanInfo GBEAN_INFO;
> > >
> > >      static {
> > >          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> > > Connector AJP13", AJP13Connector.class, JettyConnector.GBEAN_INFO);
> > > -        infoFactory.setConstructor(new String[]{"JettyContainer"});
> > > +        infoFactory.setConstructor(new  
> > > String[]{"JettyContainer","objectName","kernel"});
> > >          GBEAN_INFO = infoFactory.getBeanInfo();
> > >      }
> > >
> > >
> > > Modified:  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnector.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > > org/apache/geronimo/jetty/connector/HTTPConnector.java? 
> > > rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnector.java (original)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnector.java Sat Aug  6 14:05:32 2005
> > > @@ -20,21 +20,27 @@
> > >  import org.apache.geronimo.gbean.GBeanInfo;
> > >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > >  import org.apache.geronimo.jetty.JettyContainer;
> > > +import org.apache.geronimo.kernel.Kernel;
> > > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> > >  import org.mortbay.http.SocketListener;
> > >
> > >  /**
> > >   * @version $Rev$ $Date$
> > >   */
> > >  public class HTTPConnector extends JettyConnector {
> > > -    public HTTPConnector(JettyContainer container) {
> > > -        super(container, new SocketListener());
> > > +    public HTTPConnector(JettyContainer container, String objectName,  
> > > Kernel kernel) {
> > > +        super(container, new SocketListener(), objectName, kernel);
> > > +    }
> > > +
> > > +    public String getProtocol() {
> > > +        return WebContainer.PROTOCOL_HTTP;
> > >      }
> > >
> > >      public static final GBeanInfo GBEAN_INFO;
> > >
> > >      static {
> > >          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> > > Connector HTTP", HTTPConnector.class, JettyConnector.GBEAN_INFO);
> > > -        infoFactory.setConstructor(new String[]{"JettyContainer"});
> > > +        infoFactory.setConstructor(new  
> > > String[]{"JettyContainer","objectName","kernel"});
> > >          GBEAN_INFO = infoFactory.getBeanInfo();
> > >      }
> > >
> > >
> > > Modified:  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPSConnector.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > > org/apache/geronimo/jetty/connector/HTTPSConnector.java? 
> > > rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPSConnector.java (original)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/HTTPSConnector.java Sat Aug  6 14:05:32 2005
> > > @@ -24,8 +24,10 @@
> > >  import org.apache.geronimo.gbean.GBeanInfo;
> > >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > >  import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> > >  import org.apache.geronimo.jetty.JettyContainer;
> > >  import org.apache.geronimo.system.serverinfo.ServerInfo;
> > > +import org.apache.geronimo.kernel.Kernel;
> > >
> > >  /**
> > >   * Implementation of a HTTPS connector based on Jetty's SslConnector  
> > > (which uses pure JSSE).
> > > @@ -38,12 +40,16 @@
> > >      private String keystore;
> > >      private String algorithm;
> > >
> > > -    public HTTPSConnector(JettyContainer container, ServerInfo  
> > > serverInfo) {
> > > -        super(container, new SslListener());
> > > +    public HTTPSConnector(JettyContainer container, ServerInfo  
> > > serverInfo, String objectName, Kernel kernel) {
> > > +        super(container, new SslListener(), objectName, kernel);
> > >          this.serverInfo = serverInfo;
> > >          https = (SslListener) listener;
> > >      }
> > >
> > > +    public String getProtocol() {
> > > +        return WebContainer.PROTOCOL_HTTPS;
> > > +    }
> > > +
> > >      public String getKeystore() {
> > >          // this does not delegate to https as it needs to be resolved  
> > > against ServerInfo
> > >          return keystore;
> > > @@ -82,11 +88,11 @@
> > >          https.setKeyPassword(password);
> > >      }
> > >
> > > -    public String getProtocol() {
> > > +    public String getSecureProtocol() {
> > >          return https.getProtocol();
> > >      }
> > >
> > > -    public void setProtocol(String protocol) {
> > > +    public void setSecureProtocol(String protocol) {
> > >          https.setProtocol(protocol);
> > >      }
> > >
> > > @@ -121,9 +127,9 @@
> > >          infoFactory.addAttribute("keystoreType", String.class, true);
> > >          infoFactory.addAttribute("needClientAuth", boolean.class,  
> > > true);
> > >          infoFactory.addAttribute("password", String.class, true);
> > > -        infoFactory.addAttribute("protocol", String.class, true);
> > > +        infoFactory.addAttribute("secureProtocol", String.class,  
> > > true);
> > >          infoFactory.addReference("ServerInfo", ServerInfo.class,  
> > > NameFactory.GERONIMO_SERVICE);
> > > -        infoFactory.setConstructor(new String[]{"JettyContainer",  
> > > "ServerInfo"});
> > > +        infoFactory.setConstructor(new String[]{"JettyContainer",  
> > > "ServerInfo", "objectName", "kernel"});
> > >          GBEAN_INFO = infoFactory.getBeanInfo();
> > >      }
> > >
> > >
> > > Modified:  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/JettyConnector.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > > org/apache/geronimo/jetty/connector/JettyConnector.java? 
> > > rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/JettyConnector.java (original)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > > connector/JettyConnector.java Sat Aug  6 14:05:32 2005
> > > @@ -20,21 +20,29 @@
> > >  import java.net.UnknownHostException;
> > >  import java.net.InetSocketAddress;
> > >
> > > +import javax.management.ObjectName;
> > > +import javax.management.MalformedObjectNameException;
> > >  import org.apache.geronimo.gbean.GBeanInfo;
> > >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > >  import org.apache.geronimo.gbean.GBeanLifecycle;
> > >  import org.apache.geronimo.jetty.JettyContainer;
> > > +import org.apache.geronimo.jetty.JettyWebConnector;
> > >  import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > > +import org.apache.geronimo.kernel.management.StateManageable;
> > > +import org.apache.geronimo.kernel.management.State;
> > > +import org.apache.geronimo.kernel.GBeanNotFoundException;
> > > +import org.apache.geronimo.kernel.Kernel;
> > >  import org.mortbay.http.HttpListener;
> > > -import org.mortbay.http.SocketListener;
> > >  import org.mortbay.util.ThreadedServer;
> > >
> > >  /**
> > >   * @version $Rev$ $Date$
> > >   */
> > > -public abstract class JettyConnector implements GBeanLifecycle {
> > > +public abstract class JettyConnector implements GBeanLifecycle,  
> > > JettyWebConnector {
> > >      private final JettyContainer container;
> > >      protected final HttpListener listener;
> > > +    private final ObjectName objectName;
> > > +    private final Kernel kernel;
> > >
> > >      /**
> > >       * Only used to allow declaration as a reference.
> > > @@ -42,16 +50,34 @@
> > >      public JettyConnector() {
> > >          container = null;
> > >          listener = null;
> > > +        objectName = null;
> > > +        kernel = null;
> > >      }
> > >
> > > -    public JettyConnector(JettyContainer container) {
> > > +    public JettyConnector(JettyContainer container, String  
> > > objectName, Kernel kernel) {
> > >          this.container = container;
> > > -        this.listener = null;
> > > +        this.listener = null;
> > > +        this.kernel = kernel;
> > > +        try {
> > > +            this.objectName = ObjectName.getInstance(objectName);
> > > +        } catch (MalformedObjectNameException e) {
> > > +            throw new IllegalArgumentException(e.getMessage());
> > > +        }
> > >      }
> > >
> > > -    public JettyConnector(JettyContainer container, HttpListener  
> > > listener) {
> > > +    public JettyConnector(JettyContainer container, HttpListener  
> > > listener, String objectName, Kernel kernel) {
> > >          this.container = container;
> > > -        this.listener = listener;
> > > +        this.listener = listener;
> > > +        this.kernel = kernel;
> > > +        try {
> > > +            this.objectName = ObjectName.getInstance(objectName);
> > > +        } catch (MalformedObjectNameException e) {
> > > +            throw new IllegalArgumentException(e.getMessage());
> > > +        }
> > > +    }
> > > +
> > > +    public String getObjectName() {
> > > +        return objectName.getCanonicalName();
> > >      }
> > >
> > >      public String getDefaultScheme() {
> > > @@ -101,10 +127,52 @@
> > >        return ((ThreadedServer)listener).getIdleThreads();
> > >      }
> > >
> > > -    public InetSocketAddress getAddress() {
> > > +    public InetSocketAddress getListenAddress() {
> > >          return new InetSocketAddress(getHost(), getPort());
> > >      }
> > >
> > > +    public int getBufferSizeBytes() {
> > > +        return listener.getBufferSize();
> > > +    }
> > > +
> > > +    public void setBufferSizeBytes(int bytes) {
> > > +        throw new UnsupportedOperationException(); //todo: is this  
> > > supported?
> > > +    }
> > > +
> > > +    public int getAcceptQueueSize() {
> > > +        throw new UnsupportedOperationException(); //todo: where does  
> > > this come from?
> > > +    }
> > > +
> > > +    public void setAcceptQueueSize(int size) {
> > > +        throw new UnsupportedOperationException(); //todo: where does  
> > > this come from?
> > > +    }
> > > +
> > > +    public int getLingerMillis() {
> > > +        throw new UnsupportedOperationException(); //todo: where does  
> > > this come from?
> > > +    }
> > > +
> > > +    public void setLingerMillis(int millis) {
> > > +        throw new UnsupportedOperationException(); //todo: where does  
> > > this come from?
> > > +    }
> > > +
> > > +    public boolean isTcpNoDelay() {
> > > +        throw new UnsupportedOperationException(); //todo: where does  
> > > this come from?
> > > +    }
> > > +
> > > +    public void setTcpNoDelay(boolean enable) {
> > > +        throw new UnsupportedOperationException(); //todo: where does  
> > > this come from?
> > > +    }
> > > +
> > > +    public int getRedirectPort() {
> > > +        return listener.getConfidentialPort();
> > > +    }
> > > +
> > > +    public void setRedirectPort(int port) {
> > > +        throw new UnsupportedOperationException(); //todo: is this  
> > > supported?
> > > +    }
> > > +
> > > +    public abstract String getProtocol();
> > > +
> > >      public void doStart() throws Exception {
> > >          container.addListener(listener);
> > >          ((ThreadedServer) listener).open();
> > > @@ -134,20 +202,57 @@
> > >              }
> > >          }
> > >      }
> > > +
> > > +    public int getState() {
> > > +        try {
> > > +            return kernel.getGBeanState(objectName);
> > > +        } catch (GBeanNotFoundException e) {
> > > +            return State.STOPPED_INDEX;
> > > +        }
> > > +    }
> > > +
> > > +    public State getStateInstance() {
> > > +        return State.fromInt(getState());
> > > +    }
> > > +
> > > +    public long getStartTime() {
> > > +        try {
> > > +            return kernel.getGBeanStartTime(objectName);
> > > +        } catch (GBeanNotFoundException e) {
> > > +            return -1;
> > > +        }
> > > +    }
> > > +
> > > +    public void start() throws Exception, IllegalStateException {
> > > +        // Kernel intercepts this
> > > +    }
> > > +
> > > +    public void startRecursive() throws Exception,  
> > > IllegalStateException {
> > > +        // Kernel intercepts this
> > > +    }
> > > +
> > > +    public void stop() throws Exception, IllegalStateException {
> > > +        kernel.stopGBean(objectName);
> > > +    }
> > > +
> > >      public static final GBeanInfo GBEAN_INFO;
> > >
> > >      static {
> > >          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> > > HTTP Connector", JettyConnector.class);
> > >          infoFactory.addAttribute("defaultScheme", String.class,  
> > > false);
> > > +        infoFactory.addAttribute("objectName", String.class, false);
> > > +        infoFactory.addAttribute("kernel", Kernel.class, false);
> > >          infoFactory.addAttribute("host", String.class, true);
> > >          infoFactory.addAttribute("port", int.class, true);
> > >          infoFactory.addAttribute("minThreads", int.class, true);
> > >          infoFactory.addAttribute("maxThreads", int.class, true);
> > >          infoFactory.addAttribute("threads", int.class, false);
> > >          infoFactory.addAttribute("idleThreads", int.class, false);
> > > -        infoFactory.addAttribute("address", InetSocketAddress.class,  
> > > false);
> > > +        infoFactory.addAttribute("listenAddress",  
> > > InetSocketAddress.class, false);
> > >          infoFactory.addReference("JettyContainer",  
> > > JettyContainer.class, NameFactory.GERONIMO_SERVICE);
> > > -        infoFactory.setConstructor(new String[] {"JettyContainer"});
> > > +        infoFactory.addInterface(JettyWebConnector.class);
> > > +        infoFactory.addInterface(StateManageable.class);
> > > +        infoFactory.setConstructor(new String[]  
> > > {"JettyContainer","objectName","kernel"});
> > >          GBEAN_INFO = infoFactory.getBeanInfo();
> > >      }
> > >  }
> > >
> > > Modified:  
> > > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnectorTest.java
> > > URL:  
> > > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/ 
> > > org/apache/geronimo/jetty/connector/HTTPConnectorTest.java? 
> > > rev=230589&r1=230588&r2=230589&view=diff
> > > ======================================================================= 
> > > =======
> > > ---  
> > > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnectorTest.java (original)
> > > +++  
> > > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > > connector/HTTPConnectorTest.java Sat Aug  6 14:05:32 2005
> > > @@ -30,11 +30,11 @@
> > >      public void testAddress() throws UnknownHostException {
> > >          connector.setHost("localhost");
> > >          connector.setPort(1234);
> > > -        assertEquals(new InetSocketAddress("localhost", 1234),  
> > > connector.getAddress());
> > > +        assertEquals(new InetSocketAddress("localhost", 1234),  
> > > connector.getListenAddress());
> > >      }
> > >
> > >      protected void setUp() throws Exception {
> > >          super.setUp();
> > > -        connector = new HTTPConnector(null);
> > > +        connector = new HTTPConnector(null, "foo:bar=baz", null);
> > >      }
> > >  }
> > >
> > >
> > 
> > 
> 

Re: svn commit: r230589 - in /geronimo/trunk/modules: assembly/src/plan/ jetty/src/java/org/apache/geronimo/jetty/ jetty/src/java/org/apache/geronimo/jetty/connector/ jetty/src/test/org/apache/geronimo/jetty/connector/

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
	Well, let's talk about it.  I think it's most appropriate for some
part of the Jetty code to know how to add and remove Jetty components.  I
don't think it makes sense for all the Tomcat, Jetty, OpenEJB, TranQL,
etc. code to go into the console (especially since that prevents any other 
management tool from using it without web/portal dependencies).

	If you wanted each product to have a "Manager" or "server
component Builder" or something, I'm OK with that, we just have to agree
what it should look like.  We could also have a fat management package,
but again, I question whether this code is better centralized vs kept with
the modules it belongs to.  The only place this style of code has been
used so far is for web container network connectors (you'll see the same
ing Tomcat, for example), but I see it expanding to cover things like:

 - TranQL database pools
 - Geronimo security realms
 - Tomcat valves and security realms
 - ActiveMQ connection factories & destinations
 - OpenEJB and ActiveMQ network "connectors"
 - Geronimo thread pools / work managers
 - keystores / socket factories (eventually)

	It seemed to me to make the most sense to put this stuff in the 
"container" class for each, since that's kind of the master of the domain, 
but that doesn't work as well for, say, TranQL.

	And I'm course aware of the "more than one container running"
issue, but I think it's lower priority for now.

Aaron

On Sat, 20 Aug 2005, David Jencks wrote:
> I apologize for the delay, but I must object to most of the code  
> included in JettyContainerImpl that has to do with constructing and  
> manipulating other gbeans for connectors.  This needs to be in a  
> separate class, outside of the jetty runtime.  It is essentially a  
> small builder module.  I think the most appropriate place for it is in  
> the web console, but I might be convinced otherwise.  In any case it is  
> not acceptable to me for builder code such as this to be in a runtime  
> module.  I have no problem with the being in a module not required for  
> runtime use of the component being reconfigured, here jetty.
> 
> In addition, I think that the getConnectors() method assumes that there  
> is only one JettyContainer running.  I don't think this is necessarily  
> valid.
> 
> Sorry for the delay,
> david jencks
> 
> On Aug 6, 2005, at 2:05 PM, ammulder@apache.org wrote:
> 
> > Author: ammulder
> > Date: Sat Aug  6 14:05:32 2005
> > New Revision: 230589
> >
> > URL: http://svn.apache.org/viewcvs?rev=230589&view=rev
> > Log:
> > Start work on implementing management API in Jetty
> >  - standardize network/SSL properties
> >  - container can add/remove connectors
> >
> > Added:
> >      
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyWebConnector.java
> > Modified:
> >     geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
> >     geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
> >      
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainer.java
> >      
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainerImpl.java
> >      
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/AJP13Connector.java
> >      
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPConnector.java
> >      
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPSConnector.java
> >      
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/JettyConnector.java
> >      
> > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > connector/HTTPConnectorTest.java
> >
> > Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/ 
> > plan/j2ee-server-plan.xml?rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > --- geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml  
> > (original)
> > +++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml Sat  
> > Aug  6 14:05:32 2005
> > @@ -228,7 +228,7 @@
> >      <gbean gbeanName="openejb:type=NetworkService,name=EJB"  
> > class="org.openejb.server.StandardServiceStackGBean">
> >          <attribute name="name">EJB</attribute>
> >          <attribute name="port">${PlanOpenEJBPort}</attribute>
> > -        <attribute name="address">${PlanServerHostname}</attribute>
> > +        <attribute name="host">${PlanServerHostname}</attribute>
> >          <attribute  
> > name="allowHosts">${PlanClientAddresses}</attribute>
> >          <attribute  
> > name="logOnSuccess">HOST,NAME,THREADID,USERID</attribute>
> >          <attribute name="logOnFailure">HOST,NAME</attribute>
> >
> > Modified: geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/ 
> > plan/jetty-config.xml?rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > --- geronimo/trunk/modules/assembly/src/plan/jetty-config.xml  
> > (original)
> > +++ geronimo/trunk/modules/assembly/src/plan/jetty-config.xml Sat Aug   
> > 6 14:05:32 2005
> > @@ -53,7 +53,7 @@
> >          <attribute name="password">secret</attribute>
> >          <attribute name="keyPassword">secret</attribute>
> >          <attribute name="needClientAuth">false</attribute>
> > -        <attribute name="protocol">TLS</attribute>
> > +        <attribute name="secureProtocol">TLS</attribute>
> >          <attribute name="maxThreads">50</attribute>
> >          <attribute name="minThreads">10</attribute>
> >          <reference  
> > name="JettyContainer"><name>WebContainer</name></reference>
> >
> > Modified:  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainer.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > org/apache/geronimo/jetty/JettyContainer.java? 
> > rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainer.java (original)
> > +++  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainer.java Sat Aug  6 14:05:32 2005
> > @@ -21,11 +21,12 @@
> >  import org.mortbay.http.HttpListener;
> >  import org.mortbay.http.RequestLog;
> >  import org.mortbay.http.UserRealm;
> > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> >
> >  /**
> >   * @version $Rev$ $Date$
> >   */
> > -public interface JettyContainer {
> > +public interface JettyContainer extends WebContainer {
> >      void addListener(HttpListener listener);
> >
> >      void removeListener(HttpListener listener);
> >
> > Modified:  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainerImpl.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > org/apache/geronimo/jetty/JettyContainerImpl.java? 
> > rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainerImpl.java (original)
> > +++  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyContainerImpl.java Sat Aug  6 14:05:32 2005
> > @@ -19,25 +19,54 @@
> >
> >  import java.util.HashMap;
> >  import java.util.Map;
> > +import java.util.Set;
> > +import java.util.Iterator;
> > +import java.util.Hashtable;
> > +import java.util.List;
> > +import java.util.ArrayList;
> >
> > +import javax.management.ObjectName;
> > +import javax.management.MalformedObjectNameException;
> >  import org.apache.geronimo.gbean.GBeanInfo;
> >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> >  import org.apache.geronimo.gbean.GBeanLifecycle;
> > +import org.apache.geronimo.gbean.GBeanQuery;
> > +import org.apache.geronimo.gbean.GBeanData;
> >  import org.apache.geronimo.webservices.SoapHandler;
> >  import org.apache.geronimo.webservices.WebServiceContainer;
> > +import org.apache.geronimo.kernel.Kernel;
> > +import org.apache.geronimo.kernel.GBeanNotFoundException;
> > +import org.apache.geronimo.kernel.NoSuchOperationException;
> > +import org.apache.geronimo.kernel.management.StateManageable;
> > +import org.apache.geronimo.kernel.management.State;
> > +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > +import org.apache.geronimo.j2ee.management.impl.Util;
> > +import org.apache.geronimo.jetty.connector.HTTPConnector;
> > +import org.apache.geronimo.jetty.connector.HTTPSConnector;
> > +import org.apache.geronimo.jetty.connector.AJP13Connector;
> > +import org.apache.commons.logging.Log;
> > +import org.apache.commons.logging.LogFactory;
> >  import org.mortbay.http.*;
> >  import org.mortbay.jetty.Server;
> >
> >  /**
> >   * @version $Rev$ $Date$
> >   */
> > -public class JettyContainerImpl implements JettyContainer,  
> > SoapHandler, GBeanLifecycle {
> > +public class JettyContainerImpl implements JettyContainer,  
> > SoapHandler, StateManageable, GBeanLifecycle {
> > +    private final static Log log =  
> > LogFactory.getLog(JettyContainerImpl.class);
> >      private final Server server;
> >      private final Map webServices = new HashMap();
> > +    private Kernel kernel;
> > +    private ObjectName myName;
> >
> > -
> > -    public JettyContainerImpl() {
> > +    public JettyContainerImpl(Kernel kernel, String objectName) {
> >          server = new JettyServer();
> > +        this.kernel = kernel;
> > +        try {
> > +            myName = ObjectName.getInstance(objectName);
> > +        } catch (MalformedObjectNameException e) {
> > +            log.error(e);
> > +        }
> >      }
> >
> >      public void resetStatistics() {
> > @@ -148,6 +177,129 @@
> >          server.setRequestLog(log);
> >      }
> >
> > +    /**
> > +     * Gets the protocols which this container can configure  
> > connectors for.
> > +     */
> > +    public String[] getSupportedProtocols() {
> > +        return new String[]{PROTOCOL_HTTP, PROTOCOL_HTTPS,  
> > PROTOCOL_AJP};
> > +    }
> > +
> > +    /**
> > +     * Gets the ObjectNames of any existing connectors for the  
> > specified
> > +     * protocol.
> > +     *
> > +     * @param protocol A protocol as returned by getSupportedProtocols
> > +     */
> > +    public String[] getConnectors(String protocol) {
> > +        GBeanQuery query = new GBeanQuery(null,  
> > JettyWebConnector.class.getName());
> > +        Set names = kernel.listGBeans(query);
> > +        List result = new ArrayList();
> > +        for (Iterator it = names.iterator(); it.hasNext();) {
> > +            ObjectName name = (ObjectName) it.next();
> > +            try {
> > +                if(kernel.getAttribute(name,  
> > "protocol").equals(protocol)) {
> > +                    result.add(name.getCanonicalName());
> > +                }
> > +            } catch (Exception e) {
> > +                log.error("Unable to check the protocol for a  
> > connector", e);
> > +            }
> > +        }
> > +        return (String[]) result.toArray(new String[result.size()]);
> > +    }
> > +
> > +    /**
> > +     * Gets the ObjectNames of any existing connectors.
> > +     */
> > +    public String[] getConnectors() {
> > +        GBeanQuery query = new GBeanQuery(null,  
> > JettyWebConnector.class.getName());
> > +        Set names = kernel.listGBeans(query);
> > +        String[] result = new String[names.size()];
> > +        int i=0;
> > +        for (Iterator it = names.iterator(); it.hasNext();) {
> > +            ObjectName name = (ObjectName) it.next();
> > +            result[i++] = name.getCanonicalName();
> > +        }
> > +        return result;
> > +    }
> > +
> > +    /**
> > +     * Creates a new connector, and returns the ObjectName for it.   
> > Note that
> > +     * the connector may well require further customization before  
> > being fully
> > +     * functional (e.g. SSL settings for an HTTPS connector).
> > +     */
> > +    public String addConnector(String uniqueName, String protocol,  
> > String host, int port) {
> > +        ObjectName name = getConnectorName(protocol, uniqueName);
> > +        GBeanData connector;
> > +        if(protocol.equals(PROTOCOL_HTTP)) {
> > +            connector = new GBeanData(name, HTTPConnector.GBEAN_INFO);
> > +        } else if(protocol.equals(PROTOCOL_HTTPS)) {
> > +            connector = new GBeanData(name,  
> > HTTPSConnector.GBEAN_INFO);
> > +        } else if(protocol.equals(PROTOCOL_AJP)) {
> > +            connector = new GBeanData(name,  
> > AJP13Connector.GBEAN_INFO);
> > +        } else {
> > +            throw new IllegalArgumentException("Invalid protocol  
> > '"+protocol+"'");
> > +        }
> > +        connector.setAttribute("host", host);
> > +        connector.setAttribute("port", new Integer(port));
> > +        connector.setReferencePattern("JettyContainer", myName);
> > +        ObjectName config = Util.getConfiguration(kernel, myName);
> > +        try {
> > +            kernel.invoke(config, "addGBean", new Object[]{connector,  
> > Boolean.FALSE}, new String[]{GBeanData.class.getName(),  
> > boolean.class.getName()});
> > +        } catch (Exception e) {
> > +            log.error("Unable to add GBean ", e);
> > +            return null;
> > +        }
> > +        return name.getCanonicalName();
> > +    }
> > +
> > +    private ObjectName getConnectorName(String protocol, String  
> > uniqueName) {
> > +        Hashtable table = new Hashtable();
> > +        table.put(NameFactory.J2EE_APPLICATION,  
> > myName.getKeyProperty(NameFactory.J2EE_APPLICATION));
> > +        table.put(NameFactory.J2EE_SERVER,  
> > myName.getKeyProperty(NameFactory.J2EE_SERVER));
> > +        table.put(NameFactory.J2EE_MODULE,  
> > myName.getKeyProperty(NameFactory.J2EE_MODULE));
> > +        table.put(NameFactory.J2EE_TYPE,  
> > myName.getKeyProperty(NameFactory.J2EE_TYPE));
> > +        table.put(NameFactory.J2EE_NAME,  
> > "JettyWebConnector-"+protocol+"-"+uniqueName);
> > +        try {
> > +            return ObjectName.getInstance(myName.getDomain(), table);
> > +        } catch (MalformedObjectNameException e) {
> > +            throw new IllegalStateException("Never should have  
> > failed: "+e.getMessage());
> > +        }
> > +    }
> > +
> > +    /**
> > +     * Removes a connector.  This shuts it down if necessary, and  
> > removes it
> > +     * from the server environment.  It must be a connector that this  
> > container
> > +     * is responsible for.
> > +     */
> > +    public void removeConnector(String objectName) {
> > +        ObjectName name = null;
> > +        try {
> > +            name = ObjectName.getInstance(objectName);
> > +        } catch (MalformedObjectNameException e) {
> > +            throw new IllegalArgumentException("Invalid object name  
> > '"+objectName+"': "+e.getMessage());
> > +        }
> > +        try {
> > +            GBeanInfo info = kernel.getGBeanInfo(name);
> > +            boolean found = false;
> > +            Set intfs = info.getInterfaces();
> > +            for (Iterator it = intfs.iterator(); it.hasNext();) {
> > +                String intf = (String) it.next();
> > +                if(intf.equals(JettyWebConnector.class.getName())) {
> > +                    found = true;
> > +                }
> > +            }
> > +            if(!found) {
> > +                throw new GBeanNotFoundException(name);
> > +            }
> > +            ObjectName config = Util.getConfiguration(kernel, name);
> > +            kernel.invoke(config, "removeGBean", new Object[]{name},  
> > new String[]{ObjectName.class.getName()});
> > +        } catch (GBeanNotFoundException e) {
> > +            log.warn("No such GBean '"+objectName+"'"); //todo: what  
> > if we want to remove a failed GBean?
> > +        } catch (Exception e) {
> > +            log.error(e);
> > +        }
> > +    }
> > +
> >      /* ------------------------------------------------------------ */
> >      public RequestLog getRequestLog() {
> >          return server.getRequestLog();
> > @@ -172,10 +324,44 @@
> >          }
> >      }
> >
> > +    public int getState() {
> > +        try {
> > +            return kernel.getGBeanState(myName);
> > +        } catch (GBeanNotFoundException e) {
> > +            return State.STOPPED_INDEX;
> > +        }
> > +    }
> > +
> > +    public State getStateInstance() {
> > +        return State.fromInt(getState());
> > +    }
> > +
> > +    public long getStartTime() {
> > +        try {
> > +            return kernel.getGBeanStartTime(myName);
> > +        } catch (GBeanNotFoundException e) {
> > +            return -1;
> > +        }
> > +    }
> > +
> > +    public void start() throws Exception, IllegalStateException {
> > +        // Kernel intercepts this
> > +    }
> > +
> > +    public void startRecursive() throws Exception,  
> > IllegalStateException {
> > +        // Kernel intercepts this
> > +    }
> > +
> > +    public void stop() throws Exception, IllegalStateException {
> > +        kernel.stopGBean(myName);
> > +    }
> > +
> >      public static final GBeanInfo GBEAN_INFO;
> >
> >      static {
> >          GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder("Jetty  
> > Web Container", JettyContainerImpl.class);
> > +        infoBuilder.addAttribute("kernel", Kernel.class, false);
> > +        infoBuilder.addAttribute("objectName", String.class, false);
> >          infoBuilder.addAttribute("collectStatistics", Boolean.TYPE,  
> > true);
> >          infoBuilder.addAttribute("collectStatisticsStarted",  
> > Long.TYPE, false);
> >          infoBuilder.addAttribute("connections", Integer.TYPE, false);
> > @@ -203,6 +389,9 @@
> >          infoBuilder.addOperation("removeRealm", new  
> > Class[]{UserRealm.class});
> >
> >          infoBuilder.addInterface(SoapHandler.class);
> > +        infoBuilder.addInterface(JettyContainer.class);
> > +        infoBuilder.addInterface(StateManageable.class);
> > +        infoBuilder.setConstructor(new  
> > String[]{"kernel","objectName"});
> >
> >          GBEAN_INFO = infoBuilder.getBeanInfo();
> >      }
> >
> > Added:  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyWebConnector.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > org/apache/geronimo/jetty/JettyWebConnector.java?rev=230589&view=auto
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyWebConnector.java (added)
> > +++  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > JettyWebConnector.java Sat Aug  6 14:05:32 2005
> > @@ -0,0 +1,43 @@
> > +/**
> > + *
> > + * Copyright 2003-2004 The Apache Software Foundation
> > + *
> > + *  Licensed 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.geronimo.jetty;
> > +
> > +import org.apache.geronimo.j2ee.management.geronimo.WebConnector;
> > +
> > +/**
> > + * A Jetty-specific extension to the standard Geronimo web connector  
> > interface.
> > + *
> > + * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16  
> > Sep 2004) $
> > + */
> > +public interface JettyWebConnector extends WebConnector {
> > +    /**
> > +     * Gets the minimum number of threads used to service connections  
> > from
> > +     * this connector.
> > +     */
> > +    public int getMinThreads();
> > +    /**
> > +     * Sets the minimum number of threads used to service connections  
> > from
> > +     * this connector.
> > +     */
> > +    public void setMinThreads(int threads);
> > +
> > +    public int getThreads();
> > +
> > +    public int getIdlethreads();
> > +
> > +    public String getDefaultScheme();
> > +}
> >
> > Modified:  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/AJP13Connector.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > org/apache/geronimo/jetty/connector/AJP13Connector.java? 
> > rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/AJP13Connector.java (original)
> > +++  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/AJP13Connector.java Sat Aug  6 14:05:32 2005
> > @@ -20,21 +20,27 @@
> >  import org.apache.geronimo.gbean.GBeanInfo;
> >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> >  import org.apache.geronimo.jetty.JettyContainer;
> > +import org.apache.geronimo.kernel.Kernel;
> > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> >  import org.mortbay.http.ajp.AJP13Listener;
> >
> >  /**
> >   * @version $Rev$ $Date$
> >   */
> >  public class AJP13Connector extends JettyConnector {
> > -    public AJP13Connector(JettyContainer container) {
> > -        super(container, new AJP13Listener());
> > +    public AJP13Connector(JettyContainer container, String  
> > objectName, Kernel kernel) {
> > +        super(container, new AJP13Listener(), objectName, kernel);
> > +    }
> > +
> > +    public String getProtocol() {
> > +        return WebContainer.PROTOCOL_AJP;
> >      }
> >
> >      public static final GBeanInfo GBEAN_INFO;
> >
> >      static {
> >          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> > Connector AJP13", AJP13Connector.class, JettyConnector.GBEAN_INFO);
> > -        infoFactory.setConstructor(new String[]{"JettyContainer"});
> > +        infoFactory.setConstructor(new  
> > String[]{"JettyContainer","objectName","kernel"});
> >          GBEAN_INFO = infoFactory.getBeanInfo();
> >      }
> >
> >
> > Modified:  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPConnector.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > org/apache/geronimo/jetty/connector/HTTPConnector.java? 
> > rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPConnector.java (original)
> > +++  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPConnector.java Sat Aug  6 14:05:32 2005
> > @@ -20,21 +20,27 @@
> >  import org.apache.geronimo.gbean.GBeanInfo;
> >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> >  import org.apache.geronimo.jetty.JettyContainer;
> > +import org.apache.geronimo.kernel.Kernel;
> > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> >  import org.mortbay.http.SocketListener;
> >
> >  /**
> >   * @version $Rev$ $Date$
> >   */
> >  public class HTTPConnector extends JettyConnector {
> > -    public HTTPConnector(JettyContainer container) {
> > -        super(container, new SocketListener());
> > +    public HTTPConnector(JettyContainer container, String objectName,  
> > Kernel kernel) {
> > +        super(container, new SocketListener(), objectName, kernel);
> > +    }
> > +
> > +    public String getProtocol() {
> > +        return WebContainer.PROTOCOL_HTTP;
> >      }
> >
> >      public static final GBeanInfo GBEAN_INFO;
> >
> >      static {
> >          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> > Connector HTTP", HTTPConnector.class, JettyConnector.GBEAN_INFO);
> > -        infoFactory.setConstructor(new String[]{"JettyContainer"});
> > +        infoFactory.setConstructor(new  
> > String[]{"JettyContainer","objectName","kernel"});
> >          GBEAN_INFO = infoFactory.getBeanInfo();
> >      }
> >
> >
> > Modified:  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPSConnector.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > org/apache/geronimo/jetty/connector/HTTPSConnector.java? 
> > rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPSConnector.java (original)
> > +++  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/HTTPSConnector.java Sat Aug  6 14:05:32 2005
> > @@ -24,8 +24,10 @@
> >  import org.apache.geronimo.gbean.GBeanInfo;
> >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> >  import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
> >  import org.apache.geronimo.jetty.JettyContainer;
> >  import org.apache.geronimo.system.serverinfo.ServerInfo;
> > +import org.apache.geronimo.kernel.Kernel;
> >
> >  /**
> >   * Implementation of a HTTPS connector based on Jetty's SslConnector  
> > (which uses pure JSSE).
> > @@ -38,12 +40,16 @@
> >      private String keystore;
> >      private String algorithm;
> >
> > -    public HTTPSConnector(JettyContainer container, ServerInfo  
> > serverInfo) {
> > -        super(container, new SslListener());
> > +    public HTTPSConnector(JettyContainer container, ServerInfo  
> > serverInfo, String objectName, Kernel kernel) {
> > +        super(container, new SslListener(), objectName, kernel);
> >          this.serverInfo = serverInfo;
> >          https = (SslListener) listener;
> >      }
> >
> > +    public String getProtocol() {
> > +        return WebContainer.PROTOCOL_HTTPS;
> > +    }
> > +
> >      public String getKeystore() {
> >          // this does not delegate to https as it needs to be resolved  
> > against ServerInfo
> >          return keystore;
> > @@ -82,11 +88,11 @@
> >          https.setKeyPassword(password);
> >      }
> >
> > -    public String getProtocol() {
> > +    public String getSecureProtocol() {
> >          return https.getProtocol();
> >      }
> >
> > -    public void setProtocol(String protocol) {
> > +    public void setSecureProtocol(String protocol) {
> >          https.setProtocol(protocol);
> >      }
> >
> > @@ -121,9 +127,9 @@
> >          infoFactory.addAttribute("keystoreType", String.class, true);
> >          infoFactory.addAttribute("needClientAuth", boolean.class,  
> > true);
> >          infoFactory.addAttribute("password", String.class, true);
> > -        infoFactory.addAttribute("protocol", String.class, true);
> > +        infoFactory.addAttribute("secureProtocol", String.class,  
> > true);
> >          infoFactory.addReference("ServerInfo", ServerInfo.class,  
> > NameFactory.GERONIMO_SERVICE);
> > -        infoFactory.setConstructor(new String[]{"JettyContainer",  
> > "ServerInfo"});
> > +        infoFactory.setConstructor(new String[]{"JettyContainer",  
> > "ServerInfo", "objectName", "kernel"});
> >          GBEAN_INFO = infoFactory.getBeanInfo();
> >      }
> >
> >
> > Modified:  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/JettyConnector.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> > org/apache/geronimo/jetty/connector/JettyConnector.java? 
> > rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/JettyConnector.java (original)
> > +++  
> > geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> > connector/JettyConnector.java Sat Aug  6 14:05:32 2005
> > @@ -20,21 +20,29 @@
> >  import java.net.UnknownHostException;
> >  import java.net.InetSocketAddress;
> >
> > +import javax.management.ObjectName;
> > +import javax.management.MalformedObjectNameException;
> >  import org.apache.geronimo.gbean.GBeanInfo;
> >  import org.apache.geronimo.gbean.GBeanInfoBuilder;
> >  import org.apache.geronimo.gbean.GBeanLifecycle;
> >  import org.apache.geronimo.jetty.JettyContainer;
> > +import org.apache.geronimo.jetty.JettyWebConnector;
> >  import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> > +import org.apache.geronimo.kernel.management.StateManageable;
> > +import org.apache.geronimo.kernel.management.State;
> > +import org.apache.geronimo.kernel.GBeanNotFoundException;
> > +import org.apache.geronimo.kernel.Kernel;
> >  import org.mortbay.http.HttpListener;
> > -import org.mortbay.http.SocketListener;
> >  import org.mortbay.util.ThreadedServer;
> >
> >  /**
> >   * @version $Rev$ $Date$
> >   */
> > -public abstract class JettyConnector implements GBeanLifecycle {
> > +public abstract class JettyConnector implements GBeanLifecycle,  
> > JettyWebConnector {
> >      private final JettyContainer container;
> >      protected final HttpListener listener;
> > +    private final ObjectName objectName;
> > +    private final Kernel kernel;
> >
> >      /**
> >       * Only used to allow declaration as a reference.
> > @@ -42,16 +50,34 @@
> >      public JettyConnector() {
> >          container = null;
> >          listener = null;
> > +        objectName = null;
> > +        kernel = null;
> >      }
> >
> > -    public JettyConnector(JettyContainer container) {
> > +    public JettyConnector(JettyContainer container, String  
> > objectName, Kernel kernel) {
> >          this.container = container;
> > -        this.listener = null;
> > +        this.listener = null;
> > +        this.kernel = kernel;
> > +        try {
> > +            this.objectName = ObjectName.getInstance(objectName);
> > +        } catch (MalformedObjectNameException e) {
> > +            throw new IllegalArgumentException(e.getMessage());
> > +        }
> >      }
> >
> > -    public JettyConnector(JettyContainer container, HttpListener  
> > listener) {
> > +    public JettyConnector(JettyContainer container, HttpListener  
> > listener, String objectName, Kernel kernel) {
> >          this.container = container;
> > -        this.listener = listener;
> > +        this.listener = listener;
> > +        this.kernel = kernel;
> > +        try {
> > +            this.objectName = ObjectName.getInstance(objectName);
> > +        } catch (MalformedObjectNameException e) {
> > +            throw new IllegalArgumentException(e.getMessage());
> > +        }
> > +    }
> > +
> > +    public String getObjectName() {
> > +        return objectName.getCanonicalName();
> >      }
> >
> >      public String getDefaultScheme() {
> > @@ -101,10 +127,52 @@
> >        return ((ThreadedServer)listener).getIdleThreads();
> >      }
> >
> > -    public InetSocketAddress getAddress() {
> > +    public InetSocketAddress getListenAddress() {
> >          return new InetSocketAddress(getHost(), getPort());
> >      }
> >
> > +    public int getBufferSizeBytes() {
> > +        return listener.getBufferSize();
> > +    }
> > +
> > +    public void setBufferSizeBytes(int bytes) {
> > +        throw new UnsupportedOperationException(); //todo: is this  
> > supported?
> > +    }
> > +
> > +    public int getAcceptQueueSize() {
> > +        throw new UnsupportedOperationException(); //todo: where does  
> > this come from?
> > +    }
> > +
> > +    public void setAcceptQueueSize(int size) {
> > +        throw new UnsupportedOperationException(); //todo: where does  
> > this come from?
> > +    }
> > +
> > +    public int getLingerMillis() {
> > +        throw new UnsupportedOperationException(); //todo: where does  
> > this come from?
> > +    }
> > +
> > +    public void setLingerMillis(int millis) {
> > +        throw new UnsupportedOperationException(); //todo: where does  
> > this come from?
> > +    }
> > +
> > +    public boolean isTcpNoDelay() {
> > +        throw new UnsupportedOperationException(); //todo: where does  
> > this come from?
> > +    }
> > +
> > +    public void setTcpNoDelay(boolean enable) {
> > +        throw new UnsupportedOperationException(); //todo: where does  
> > this come from?
> > +    }
> > +
> > +    public int getRedirectPort() {
> > +        return listener.getConfidentialPort();
> > +    }
> > +
> > +    public void setRedirectPort(int port) {
> > +        throw new UnsupportedOperationException(); //todo: is this  
> > supported?
> > +    }
> > +
> > +    public abstract String getProtocol();
> > +
> >      public void doStart() throws Exception {
> >          container.addListener(listener);
> >          ((ThreadedServer) listener).open();
> > @@ -134,20 +202,57 @@
> >              }
> >          }
> >      }
> > +
> > +    public int getState() {
> > +        try {
> > +            return kernel.getGBeanState(objectName);
> > +        } catch (GBeanNotFoundException e) {
> > +            return State.STOPPED_INDEX;
> > +        }
> > +    }
> > +
> > +    public State getStateInstance() {
> > +        return State.fromInt(getState());
> > +    }
> > +
> > +    public long getStartTime() {
> > +        try {
> > +            return kernel.getGBeanStartTime(objectName);
> > +        } catch (GBeanNotFoundException e) {
> > +            return -1;
> > +        }
> > +    }
> > +
> > +    public void start() throws Exception, IllegalStateException {
> > +        // Kernel intercepts this
> > +    }
> > +
> > +    public void startRecursive() throws Exception,  
> > IllegalStateException {
> > +        // Kernel intercepts this
> > +    }
> > +
> > +    public void stop() throws Exception, IllegalStateException {
> > +        kernel.stopGBean(objectName);
> > +    }
> > +
> >      public static final GBeanInfo GBEAN_INFO;
> >
> >      static {
> >          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> > HTTP Connector", JettyConnector.class);
> >          infoFactory.addAttribute("defaultScheme", String.class,  
> > false);
> > +        infoFactory.addAttribute("objectName", String.class, false);
> > +        infoFactory.addAttribute("kernel", Kernel.class, false);
> >          infoFactory.addAttribute("host", String.class, true);
> >          infoFactory.addAttribute("port", int.class, true);
> >          infoFactory.addAttribute("minThreads", int.class, true);
> >          infoFactory.addAttribute("maxThreads", int.class, true);
> >          infoFactory.addAttribute("threads", int.class, false);
> >          infoFactory.addAttribute("idleThreads", int.class, false);
> > -        infoFactory.addAttribute("address", InetSocketAddress.class,  
> > false);
> > +        infoFactory.addAttribute("listenAddress",  
> > InetSocketAddress.class, false);
> >          infoFactory.addReference("JettyContainer",  
> > JettyContainer.class, NameFactory.GERONIMO_SERVICE);
> > -        infoFactory.setConstructor(new String[] {"JettyContainer"});
> > +        infoFactory.addInterface(JettyWebConnector.class);
> > +        infoFactory.addInterface(StateManageable.class);
> > +        infoFactory.setConstructor(new String[]  
> > {"JettyContainer","objectName","kernel"});
> >          GBEAN_INFO = infoFactory.getBeanInfo();
> >      }
> >  }
> >
> > Modified:  
> > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > connector/HTTPConnectorTest.java
> > URL:  
> > http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/ 
> > org/apache/geronimo/jetty/connector/HTTPConnectorTest.java? 
> > rev=230589&r1=230588&r2=230589&view=diff
> > ======================================================================= 
> > =======
> > ---  
> > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > connector/HTTPConnectorTest.java (original)
> > +++  
> > geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> > connector/HTTPConnectorTest.java Sat Aug  6 14:05:32 2005
> > @@ -30,11 +30,11 @@
> >      public void testAddress() throws UnknownHostException {
> >          connector.setHost("localhost");
> >          connector.setPort(1234);
> > -        assertEquals(new InetSocketAddress("localhost", 1234),  
> > connector.getAddress());
> > +        assertEquals(new InetSocketAddress("localhost", 1234),  
> > connector.getListenAddress());
> >      }
> >
> >      protected void setUp() throws Exception {
> >          super.setUp();
> > -        connector = new HTTPConnector(null);
> > +        connector = new HTTPConnector(null, "foo:bar=baz", null);
> >      }
> >  }
> >
> >
> 
> 

Re: svn commit: r230589 - in /geronimo/trunk/modules: assembly/src/plan/ jetty/src/java/org/apache/geronimo/jetty/ jetty/src/java/org/apache/geronimo/jetty/connector/ jetty/src/test/org/apache/geronimo/jetty/connector/

Posted by David Jencks <da...@yahoo.com>.
I apologize for the delay, but I must object to most of the code  
included in JettyContainerImpl that has to do with constructing and  
manipulating other gbeans for connectors.  This needs to be in a  
separate class, outside of the jetty runtime.  It is essentially a  
small builder module.  I think the most appropriate place for it is in  
the web console, but I might be convinced otherwise.  In any case it is  
not acceptable to me for builder code such as this to be in a runtime  
module.  I have no problem with the being in a module not required for  
runtime use of the component being reconfigured, here jetty.

In addition, I think that the getConnectors() method assumes that there  
is only one JettyContainer running.  I don't think this is necessarily  
valid.

Sorry for the delay,
david jencks

On Aug 6, 2005, at 2:05 PM, ammulder@apache.org wrote:

> Author: ammulder
> Date: Sat Aug  6 14:05:32 2005
> New Revision: 230589
>
> URL: http://svn.apache.org/viewcvs?rev=230589&view=rev
> Log:
> Start work on implementing management API in Jetty
>  - standardize network/SSL properties
>  - container can add/remove connectors
>
> Added:
>      
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyWebConnector.java
> Modified:
>     geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
>     geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
>      
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainer.java
>      
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainerImpl.java
>      
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/AJP13Connector.java
>      
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPConnector.java
>      
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPSConnector.java
>      
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/JettyConnector.java
>      
> geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> connector/HTTPConnectorTest.java
>
> Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/ 
> plan/j2ee-server-plan.xml?rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> --- geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml  
> (original)
> +++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml Sat  
> Aug  6 14:05:32 2005
> @@ -228,7 +228,7 @@
>      <gbean gbeanName="openejb:type=NetworkService,name=EJB"  
> class="org.openejb.server.StandardServiceStackGBean">
>          <attribute name="name">EJB</attribute>
>          <attribute name="port">${PlanOpenEJBPort}</attribute>
> -        <attribute name="address">${PlanServerHostname}</attribute>
> +        <attribute name="host">${PlanServerHostname}</attribute>
>          <attribute  
> name="allowHosts">${PlanClientAddresses}</attribute>
>          <attribute  
> name="logOnSuccess">HOST,NAME,THREADID,USERID</attribute>
>          <attribute name="logOnFailure">HOST,NAME</attribute>
>
> Modified: geronimo/trunk/modules/assembly/src/plan/jetty-config.xml
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/ 
> plan/jetty-config.xml?rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> --- geronimo/trunk/modules/assembly/src/plan/jetty-config.xml  
> (original)
> +++ geronimo/trunk/modules/assembly/src/plan/jetty-config.xml Sat Aug   
> 6 14:05:32 2005
> @@ -53,7 +53,7 @@
>          <attribute name="password">secret</attribute>
>          <attribute name="keyPassword">secret</attribute>
>          <attribute name="needClientAuth">false</attribute>
> -        <attribute name="protocol">TLS</attribute>
> +        <attribute name="secureProtocol">TLS</attribute>
>          <attribute name="maxThreads">50</attribute>
>          <attribute name="minThreads">10</attribute>
>          <reference  
> name="JettyContainer"><name>WebContainer</name></reference>
>
> Modified:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainer.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> org/apache/geronimo/jetty/JettyContainer.java? 
> rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainer.java (original)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainer.java Sat Aug  6 14:05:32 2005
> @@ -21,11 +21,12 @@
>  import org.mortbay.http.HttpListener;
>  import org.mortbay.http.RequestLog;
>  import org.mortbay.http.UserRealm;
> +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
>
>  /**
>   * @version $Rev$ $Date$
>   */
> -public interface JettyContainer {
> +public interface JettyContainer extends WebContainer {
>      void addListener(HttpListener listener);
>
>      void removeListener(HttpListener listener);
>
> Modified:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainerImpl.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> org/apache/geronimo/jetty/JettyContainerImpl.java? 
> rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainerImpl.java (original)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyContainerImpl.java Sat Aug  6 14:05:32 2005
> @@ -19,25 +19,54 @@
>
>  import java.util.HashMap;
>  import java.util.Map;
> +import java.util.Set;
> +import java.util.Iterator;
> +import java.util.Hashtable;
> +import java.util.List;
> +import java.util.ArrayList;
>
> +import javax.management.ObjectName;
> +import javax.management.MalformedObjectNameException;
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.GBeanInfoBuilder;
>  import org.apache.geronimo.gbean.GBeanLifecycle;
> +import org.apache.geronimo.gbean.GBeanQuery;
> +import org.apache.geronimo.gbean.GBeanData;
>  import org.apache.geronimo.webservices.SoapHandler;
>  import org.apache.geronimo.webservices.WebServiceContainer;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.kernel.GBeanNotFoundException;
> +import org.apache.geronimo.kernel.NoSuchOperationException;
> +import org.apache.geronimo.kernel.management.StateManageable;
> +import org.apache.geronimo.kernel.management.State;
> +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> +import org.apache.geronimo.j2ee.management.impl.Util;
> +import org.apache.geronimo.jetty.connector.HTTPConnector;
> +import org.apache.geronimo.jetty.connector.HTTPSConnector;
> +import org.apache.geronimo.jetty.connector.AJP13Connector;
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
>  import org.mortbay.http.*;
>  import org.mortbay.jetty.Server;
>
>  /**
>   * @version $Rev$ $Date$
>   */
> -public class JettyContainerImpl implements JettyContainer,  
> SoapHandler, GBeanLifecycle {
> +public class JettyContainerImpl implements JettyContainer,  
> SoapHandler, StateManageable, GBeanLifecycle {
> +    private final static Log log =  
> LogFactory.getLog(JettyContainerImpl.class);
>      private final Server server;
>      private final Map webServices = new HashMap();
> +    private Kernel kernel;
> +    private ObjectName myName;
>
> -
> -    public JettyContainerImpl() {
> +    public JettyContainerImpl(Kernel kernel, String objectName) {
>          server = new JettyServer();
> +        this.kernel = kernel;
> +        try {
> +            myName = ObjectName.getInstance(objectName);
> +        } catch (MalformedObjectNameException e) {
> +            log.error(e);
> +        }
>      }
>
>      public void resetStatistics() {
> @@ -148,6 +177,129 @@
>          server.setRequestLog(log);
>      }
>
> +    /**
> +     * Gets the protocols which this container can configure  
> connectors for.
> +     */
> +    public String[] getSupportedProtocols() {
> +        return new String[]{PROTOCOL_HTTP, PROTOCOL_HTTPS,  
> PROTOCOL_AJP};
> +    }
> +
> +    /**
> +     * Gets the ObjectNames of any existing connectors for the  
> specified
> +     * protocol.
> +     *
> +     * @param protocol A protocol as returned by getSupportedProtocols
> +     */
> +    public String[] getConnectors(String protocol) {
> +        GBeanQuery query = new GBeanQuery(null,  
> JettyWebConnector.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        List result = new ArrayList();
> +        for (Iterator it = names.iterator(); it.hasNext();) {
> +            ObjectName name = (ObjectName) it.next();
> +            try {
> +                if(kernel.getAttribute(name,  
> "protocol").equals(protocol)) {
> +                    result.add(name.getCanonicalName());
> +                }
> +            } catch (Exception e) {
> +                log.error("Unable to check the protocol for a  
> connector", e);
> +            }
> +        }
> +        return (String[]) result.toArray(new String[result.size()]);
> +    }
> +
> +    /**
> +     * Gets the ObjectNames of any existing connectors.
> +     */
> +    public String[] getConnectors() {
> +        GBeanQuery query = new GBeanQuery(null,  
> JettyWebConnector.class.getName());
> +        Set names = kernel.listGBeans(query);
> +        String[] result = new String[names.size()];
> +        int i=0;
> +        for (Iterator it = names.iterator(); it.hasNext();) {
> +            ObjectName name = (ObjectName) it.next();
> +            result[i++] = name.getCanonicalName();
> +        }
> +        return result;
> +    }
> +
> +    /**
> +     * Creates a new connector, and returns the ObjectName for it.   
> Note that
> +     * the connector may well require further customization before  
> being fully
> +     * functional (e.g. SSL settings for an HTTPS connector).
> +     */
> +    public String addConnector(String uniqueName, String protocol,  
> String host, int port) {
> +        ObjectName name = getConnectorName(protocol, uniqueName);
> +        GBeanData connector;
> +        if(protocol.equals(PROTOCOL_HTTP)) {
> +            connector = new GBeanData(name, HTTPConnector.GBEAN_INFO);
> +        } else if(protocol.equals(PROTOCOL_HTTPS)) {
> +            connector = new GBeanData(name,  
> HTTPSConnector.GBEAN_INFO);
> +        } else if(protocol.equals(PROTOCOL_AJP)) {
> +            connector = new GBeanData(name,  
> AJP13Connector.GBEAN_INFO);
> +        } else {
> +            throw new IllegalArgumentException("Invalid protocol  
> '"+protocol+"'");
> +        }
> +        connector.setAttribute("host", host);
> +        connector.setAttribute("port", new Integer(port));
> +        connector.setReferencePattern("JettyContainer", myName);
> +        ObjectName config = Util.getConfiguration(kernel, myName);
> +        try {
> +            kernel.invoke(config, "addGBean", new Object[]{connector,  
> Boolean.FALSE}, new String[]{GBeanData.class.getName(),  
> boolean.class.getName()});
> +        } catch (Exception e) {
> +            log.error("Unable to add GBean ", e);
> +            return null;
> +        }
> +        return name.getCanonicalName();
> +    }
> +
> +    private ObjectName getConnectorName(String protocol, String  
> uniqueName) {
> +        Hashtable table = new Hashtable();
> +        table.put(NameFactory.J2EE_APPLICATION,  
> myName.getKeyProperty(NameFactory.J2EE_APPLICATION));
> +        table.put(NameFactory.J2EE_SERVER,  
> myName.getKeyProperty(NameFactory.J2EE_SERVER));
> +        table.put(NameFactory.J2EE_MODULE,  
> myName.getKeyProperty(NameFactory.J2EE_MODULE));
> +        table.put(NameFactory.J2EE_TYPE,  
> myName.getKeyProperty(NameFactory.J2EE_TYPE));
> +        table.put(NameFactory.J2EE_NAME,  
> "JettyWebConnector-"+protocol+"-"+uniqueName);
> +        try {
> +            return ObjectName.getInstance(myName.getDomain(), table);
> +        } catch (MalformedObjectNameException e) {
> +            throw new IllegalStateException("Never should have  
> failed: "+e.getMessage());
> +        }
> +    }
> +
> +    /**
> +     * Removes a connector.  This shuts it down if necessary, and  
> removes it
> +     * from the server environment.  It must be a connector that this  
> container
> +     * is responsible for.
> +     */
> +    public void removeConnector(String objectName) {
> +        ObjectName name = null;
> +        try {
> +            name = ObjectName.getInstance(objectName);
> +        } catch (MalformedObjectNameException e) {
> +            throw new IllegalArgumentException("Invalid object name  
> '"+objectName+"': "+e.getMessage());
> +        }
> +        try {
> +            GBeanInfo info = kernel.getGBeanInfo(name);
> +            boolean found = false;
> +            Set intfs = info.getInterfaces();
> +            for (Iterator it = intfs.iterator(); it.hasNext();) {
> +                String intf = (String) it.next();
> +                if(intf.equals(JettyWebConnector.class.getName())) {
> +                    found = true;
> +                }
> +            }
> +            if(!found) {
> +                throw new GBeanNotFoundException(name);
> +            }
> +            ObjectName config = Util.getConfiguration(kernel, name);
> +            kernel.invoke(config, "removeGBean", new Object[]{name},  
> new String[]{ObjectName.class.getName()});
> +        } catch (GBeanNotFoundException e) {
> +            log.warn("No such GBean '"+objectName+"'"); //todo: what  
> if we want to remove a failed GBean?
> +        } catch (Exception e) {
> +            log.error(e);
> +        }
> +    }
> +
>      /* ------------------------------------------------------------ */
>      public RequestLog getRequestLog() {
>          return server.getRequestLog();
> @@ -172,10 +324,44 @@
>          }
>      }
>
> +    public int getState() {
> +        try {
> +            return kernel.getGBeanState(myName);
> +        } catch (GBeanNotFoundException e) {
> +            return State.STOPPED_INDEX;
> +        }
> +    }
> +
> +    public State getStateInstance() {
> +        return State.fromInt(getState());
> +    }
> +
> +    public long getStartTime() {
> +        try {
> +            return kernel.getGBeanStartTime(myName);
> +        } catch (GBeanNotFoundException e) {
> +            return -1;
> +        }
> +    }
> +
> +    public void start() throws Exception, IllegalStateException {
> +        // Kernel intercepts this
> +    }
> +
> +    public void startRecursive() throws Exception,  
> IllegalStateException {
> +        // Kernel intercepts this
> +    }
> +
> +    public void stop() throws Exception, IllegalStateException {
> +        kernel.stopGBean(myName);
> +    }
> +
>      public static final GBeanInfo GBEAN_INFO;
>
>      static {
>          GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder("Jetty  
> Web Container", JettyContainerImpl.class);
> +        infoBuilder.addAttribute("kernel", Kernel.class, false);
> +        infoBuilder.addAttribute("objectName", String.class, false);
>          infoBuilder.addAttribute("collectStatistics", Boolean.TYPE,  
> true);
>          infoBuilder.addAttribute("collectStatisticsStarted",  
> Long.TYPE, false);
>          infoBuilder.addAttribute("connections", Integer.TYPE, false);
> @@ -203,6 +389,9 @@
>          infoBuilder.addOperation("removeRealm", new  
> Class[]{UserRealm.class});
>
>          infoBuilder.addInterface(SoapHandler.class);
> +        infoBuilder.addInterface(JettyContainer.class);
> +        infoBuilder.addInterface(StateManageable.class);
> +        infoBuilder.setConstructor(new  
> String[]{"kernel","objectName"});
>
>          GBEAN_INFO = infoBuilder.getBeanInfo();
>      }
>
> Added:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyWebConnector.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> org/apache/geronimo/jetty/JettyWebConnector.java?rev=230589&view=auto
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyWebConnector.java (added)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> JettyWebConnector.java Sat Aug  6 14:05:32 2005
> @@ -0,0 +1,43 @@
> +/**
> + *
> + * Copyright 2003-2004 The Apache Software Foundation
> + *
> + *  Licensed 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.geronimo.jetty;
> +
> +import org.apache.geronimo.j2ee.management.geronimo.WebConnector;
> +
> +/**
> + * A Jetty-specific extension to the standard Geronimo web connector  
> interface.
> + *
> + * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16  
> Sep 2004) $
> + */
> +public interface JettyWebConnector extends WebConnector {
> +    /**
> +     * Gets the minimum number of threads used to service connections  
> from
> +     * this connector.
> +     */
> +    public int getMinThreads();
> +    /**
> +     * Sets the minimum number of threads used to service connections  
> from
> +     * this connector.
> +     */
> +    public void setMinThreads(int threads);
> +
> +    public int getThreads();
> +
> +    public int getIdlethreads();
> +
> +    public String getDefaultScheme();
> +}
>
> Modified:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/AJP13Connector.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> org/apache/geronimo/jetty/connector/AJP13Connector.java? 
> rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/AJP13Connector.java (original)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/AJP13Connector.java Sat Aug  6 14:05:32 2005
> @@ -20,21 +20,27 @@
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.GBeanInfoBuilder;
>  import org.apache.geronimo.jetty.JettyContainer;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
>  import org.mortbay.http.ajp.AJP13Listener;
>
>  /**
>   * @version $Rev$ $Date$
>   */
>  public class AJP13Connector extends JettyConnector {
> -    public AJP13Connector(JettyContainer container) {
> -        super(container, new AJP13Listener());
> +    public AJP13Connector(JettyContainer container, String  
> objectName, Kernel kernel) {
> +        super(container, new AJP13Listener(), objectName, kernel);
> +    }
> +
> +    public String getProtocol() {
> +        return WebContainer.PROTOCOL_AJP;
>      }
>
>      public static final GBeanInfo GBEAN_INFO;
>
>      static {
>          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> Connector AJP13", AJP13Connector.class, JettyConnector.GBEAN_INFO);
> -        infoFactory.setConstructor(new String[]{"JettyContainer"});
> +        infoFactory.setConstructor(new  
> String[]{"JettyContainer","objectName","kernel"});
>          GBEAN_INFO = infoFactory.getBeanInfo();
>      }
>
>
> Modified:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPConnector.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> org/apache/geronimo/jetty/connector/HTTPConnector.java? 
> rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPConnector.java (original)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPConnector.java Sat Aug  6 14:05:32 2005
> @@ -20,21 +20,27 @@
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.GBeanInfoBuilder;
>  import org.apache.geronimo.jetty.JettyContainer;
> +import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
>  import org.mortbay.http.SocketListener;
>
>  /**
>   * @version $Rev$ $Date$
>   */
>  public class HTTPConnector extends JettyConnector {
> -    public HTTPConnector(JettyContainer container) {
> -        super(container, new SocketListener());
> +    public HTTPConnector(JettyContainer container, String objectName,  
> Kernel kernel) {
> +        super(container, new SocketListener(), objectName, kernel);
> +    }
> +
> +    public String getProtocol() {
> +        return WebContainer.PROTOCOL_HTTP;
>      }
>
>      public static final GBeanInfo GBEAN_INFO;
>
>      static {
>          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> Connector HTTP", HTTPConnector.class, JettyConnector.GBEAN_INFO);
> -        infoFactory.setConstructor(new String[]{"JettyContainer"});
> +        infoFactory.setConstructor(new  
> String[]{"JettyContainer","objectName","kernel"});
>          GBEAN_INFO = infoFactory.getBeanInfo();
>      }
>
>
> Modified:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPSConnector.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> org/apache/geronimo/jetty/connector/HTTPSConnector.java? 
> rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPSConnector.java (original)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/HTTPSConnector.java Sat Aug  6 14:05:32 2005
> @@ -24,8 +24,10 @@
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.GBeanInfoBuilder;
>  import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> +import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
>  import org.apache.geronimo.jetty.JettyContainer;
>  import org.apache.geronimo.system.serverinfo.ServerInfo;
> +import org.apache.geronimo.kernel.Kernel;
>
>  /**
>   * Implementation of a HTTPS connector based on Jetty's SslConnector  
> (which uses pure JSSE).
> @@ -38,12 +40,16 @@
>      private String keystore;
>      private String algorithm;
>
> -    public HTTPSConnector(JettyContainer container, ServerInfo  
> serverInfo) {
> -        super(container, new SslListener());
> +    public HTTPSConnector(JettyContainer container, ServerInfo  
> serverInfo, String objectName, Kernel kernel) {
> +        super(container, new SslListener(), objectName, kernel);
>          this.serverInfo = serverInfo;
>          https = (SslListener) listener;
>      }
>
> +    public String getProtocol() {
> +        return WebContainer.PROTOCOL_HTTPS;
> +    }
> +
>      public String getKeystore() {
>          // this does not delegate to https as it needs to be resolved  
> against ServerInfo
>          return keystore;
> @@ -82,11 +88,11 @@
>          https.setKeyPassword(password);
>      }
>
> -    public String getProtocol() {
> +    public String getSecureProtocol() {
>          return https.getProtocol();
>      }
>
> -    public void setProtocol(String protocol) {
> +    public void setSecureProtocol(String protocol) {
>          https.setProtocol(protocol);
>      }
>
> @@ -121,9 +127,9 @@
>          infoFactory.addAttribute("keystoreType", String.class, true);
>          infoFactory.addAttribute("needClientAuth", boolean.class,  
> true);
>          infoFactory.addAttribute("password", String.class, true);
> -        infoFactory.addAttribute("protocol", String.class, true);
> +        infoFactory.addAttribute("secureProtocol", String.class,  
> true);
>          infoFactory.addReference("ServerInfo", ServerInfo.class,  
> NameFactory.GERONIMO_SERVICE);
> -        infoFactory.setConstructor(new String[]{"JettyContainer",  
> "ServerInfo"});
> +        infoFactory.setConstructor(new String[]{"JettyContainer",  
> "ServerInfo", "objectName", "kernel"});
>          GBEAN_INFO = infoFactory.getBeanInfo();
>      }
>
>
> Modified:  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/JettyConnector.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/ 
> org/apache/geronimo/jetty/connector/JettyConnector.java? 
> rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/JettyConnector.java (original)
> +++  
> geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/ 
> connector/JettyConnector.java Sat Aug  6 14:05:32 2005
> @@ -20,21 +20,29 @@
>  import java.net.UnknownHostException;
>  import java.net.InetSocketAddress;
>
> +import javax.management.ObjectName;
> +import javax.management.MalformedObjectNameException;
>  import org.apache.geronimo.gbean.GBeanInfo;
>  import org.apache.geronimo.gbean.GBeanInfoBuilder;
>  import org.apache.geronimo.gbean.GBeanLifecycle;
>  import org.apache.geronimo.jetty.JettyContainer;
> +import org.apache.geronimo.jetty.JettyWebConnector;
>  import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> +import org.apache.geronimo.kernel.management.StateManageable;
> +import org.apache.geronimo.kernel.management.State;
> +import org.apache.geronimo.kernel.GBeanNotFoundException;
> +import org.apache.geronimo.kernel.Kernel;
>  import org.mortbay.http.HttpListener;
> -import org.mortbay.http.SocketListener;
>  import org.mortbay.util.ThreadedServer;
>
>  /**
>   * @version $Rev$ $Date$
>   */
> -public abstract class JettyConnector implements GBeanLifecycle {
> +public abstract class JettyConnector implements GBeanLifecycle,  
> JettyWebConnector {
>      private final JettyContainer container;
>      protected final HttpListener listener;
> +    private final ObjectName objectName;
> +    private final Kernel kernel;
>
>      /**
>       * Only used to allow declaration as a reference.
> @@ -42,16 +50,34 @@
>      public JettyConnector() {
>          container = null;
>          listener = null;
> +        objectName = null;
> +        kernel = null;
>      }
>
> -    public JettyConnector(JettyContainer container) {
> +    public JettyConnector(JettyContainer container, String  
> objectName, Kernel kernel) {
>          this.container = container;
> -        this.listener = null;
> +        this.listener = null;
> +        this.kernel = kernel;
> +        try {
> +            this.objectName = ObjectName.getInstance(objectName);
> +        } catch (MalformedObjectNameException e) {
> +            throw new IllegalArgumentException(e.getMessage());
> +        }
>      }
>
> -    public JettyConnector(JettyContainer container, HttpListener  
> listener) {
> +    public JettyConnector(JettyContainer container, HttpListener  
> listener, String objectName, Kernel kernel) {
>          this.container = container;
> -        this.listener = listener;
> +        this.listener = listener;
> +        this.kernel = kernel;
> +        try {
> +            this.objectName = ObjectName.getInstance(objectName);
> +        } catch (MalformedObjectNameException e) {
> +            throw new IllegalArgumentException(e.getMessage());
> +        }
> +    }
> +
> +    public String getObjectName() {
> +        return objectName.getCanonicalName();
>      }
>
>      public String getDefaultScheme() {
> @@ -101,10 +127,52 @@
>        return ((ThreadedServer)listener).getIdleThreads();
>      }
>
> -    public InetSocketAddress getAddress() {
> +    public InetSocketAddress getListenAddress() {
>          return new InetSocketAddress(getHost(), getPort());
>      }
>
> +    public int getBufferSizeBytes() {
> +        return listener.getBufferSize();
> +    }
> +
> +    public void setBufferSizeBytes(int bytes) {
> +        throw new UnsupportedOperationException(); //todo: is this  
> supported?
> +    }
> +
> +    public int getAcceptQueueSize() {
> +        throw new UnsupportedOperationException(); //todo: where does  
> this come from?
> +    }
> +
> +    public void setAcceptQueueSize(int size) {
> +        throw new UnsupportedOperationException(); //todo: where does  
> this come from?
> +    }
> +
> +    public int getLingerMillis() {
> +        throw new UnsupportedOperationException(); //todo: where does  
> this come from?
> +    }
> +
> +    public void setLingerMillis(int millis) {
> +        throw new UnsupportedOperationException(); //todo: where does  
> this come from?
> +    }
> +
> +    public boolean isTcpNoDelay() {
> +        throw new UnsupportedOperationException(); //todo: where does  
> this come from?
> +    }
> +
> +    public void setTcpNoDelay(boolean enable) {
> +        throw new UnsupportedOperationException(); //todo: where does  
> this come from?
> +    }
> +
> +    public int getRedirectPort() {
> +        return listener.getConfidentialPort();
> +    }
> +
> +    public void setRedirectPort(int port) {
> +        throw new UnsupportedOperationException(); //todo: is this  
> supported?
> +    }
> +
> +    public abstract String getProtocol();
> +
>      public void doStart() throws Exception {
>          container.addListener(listener);
>          ((ThreadedServer) listener).open();
> @@ -134,20 +202,57 @@
>              }
>          }
>      }
> +
> +    public int getState() {
> +        try {
> +            return kernel.getGBeanState(objectName);
> +        } catch (GBeanNotFoundException e) {
> +            return State.STOPPED_INDEX;
> +        }
> +    }
> +
> +    public State getStateInstance() {
> +        return State.fromInt(getState());
> +    }
> +
> +    public long getStartTime() {
> +        try {
> +            return kernel.getGBeanStartTime(objectName);
> +        } catch (GBeanNotFoundException e) {
> +            return -1;
> +        }
> +    }
> +
> +    public void start() throws Exception, IllegalStateException {
> +        // Kernel intercepts this
> +    }
> +
> +    public void startRecursive() throws Exception,  
> IllegalStateException {
> +        // Kernel intercepts this
> +    }
> +
> +    public void stop() throws Exception, IllegalStateException {
> +        kernel.stopGBean(objectName);
> +    }
> +
>      public static final GBeanInfo GBEAN_INFO;
>
>      static {
>          GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty  
> HTTP Connector", JettyConnector.class);
>          infoFactory.addAttribute("defaultScheme", String.class,  
> false);
> +        infoFactory.addAttribute("objectName", String.class, false);
> +        infoFactory.addAttribute("kernel", Kernel.class, false);
>          infoFactory.addAttribute("host", String.class, true);
>          infoFactory.addAttribute("port", int.class, true);
>          infoFactory.addAttribute("minThreads", int.class, true);
>          infoFactory.addAttribute("maxThreads", int.class, true);
>          infoFactory.addAttribute("threads", int.class, false);
>          infoFactory.addAttribute("idleThreads", int.class, false);
> -        infoFactory.addAttribute("address", InetSocketAddress.class,  
> false);
> +        infoFactory.addAttribute("listenAddress",  
> InetSocketAddress.class, false);
>          infoFactory.addReference("JettyContainer",  
> JettyContainer.class, NameFactory.GERONIMO_SERVICE);
> -        infoFactory.setConstructor(new String[] {"JettyContainer"});
> +        infoFactory.addInterface(JettyWebConnector.class);
> +        infoFactory.addInterface(StateManageable.class);
> +        infoFactory.setConstructor(new String[]  
> {"JettyContainer","objectName","kernel"});
>          GBEAN_INFO = infoFactory.getBeanInfo();
>      }
>  }
>
> Modified:  
> geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> connector/HTTPConnectorTest.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/ 
> org/apache/geronimo/jetty/connector/HTTPConnectorTest.java? 
> rev=230589&r1=230588&r2=230589&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> connector/HTTPConnectorTest.java (original)
> +++  
> geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/ 
> connector/HTTPConnectorTest.java Sat Aug  6 14:05:32 2005
> @@ -30,11 +30,11 @@
>      public void testAddress() throws UnknownHostException {
>          connector.setHost("localhost");
>          connector.setPort(1234);
> -        assertEquals(new InetSocketAddress("localhost", 1234),  
> connector.getAddress());
> +        assertEquals(new InetSocketAddress("localhost", 1234),  
> connector.getListenAddress());
>      }
>
>      protected void setUp() throws Exception {
>          super.setUp();
> -        connector = new HTTPConnector(null);
> +        connector = new HTTPConnector(null, "foo:bar=baz", null);
>      }
>  }
>
>