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 22:59:52 UTC

svn commit: r230587 - in /geronimo/trunk/modules: core/src/java/org/apache/geronimo/pool/ core/src/test/org/apache/geronimo/pool/ j2ee/ j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/ j2ee/src/java/org/apache/geronimo/j2ee/management/impl/ ...

Author: ammulder
Date: Sat Aug  6 13:59:42 2005
New Revision: 230587

URL: http://svn.apache.org/viewcvs?rev=230587&view=rev
Log:
More work on managment API
 - Add a management interface for Geronimo thread pools
 - Break out a generic network connector/container management interface to
     make it common between Web and EJB containers
 - Add basic EJB connector/container management interfaces
 - Utility method to look up a configuration for a GBean
 - Extend JSR-77 J2EEServer to expose Web/EJB containers and thread pools

Added:
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBConnector.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBContainer.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/J2EEServer.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkContainer.java
Modified:
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java
    geronimo/trunk/modules/core/src/test/org/apache/geronimo/pool/ThreadPoolTest.java
    geronimo/trunk/modules/j2ee/project.xml
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebConnector.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebContainer.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
    geronimo/trunk/modules/timer/project.xml
    geronimo/trunk/modules/timer/src/test/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java

Added: geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java?rev=230587&view=auto
==============================================================================
--- geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java (added)
+++ geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/GeronimoExecutor.java Sat Aug  6 13:59:42 2005
@@ -0,0 +1,40 @@
+/**
+ *
+ * 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.pool;
+
+import EDU.oswego.cs.dl.util.concurrent.Executor;
+
+/**
+ * A Geronimo-specific extension that contributes a little extra manageability
+ * to the standard Executor interface.
+ *
+ * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
+ */
+public interface GeronimoExecutor extends Executor {
+    /**
+     * Gets a human-readable name identifying this object.
+     */
+    String getName();
+
+    /**
+     * Gets the unique name of this object.  The object name must comply with
+     * the ObjectName specification in the JMX specification.
+     *
+     * @return the unique name of this object within the server
+     */
+    String getObjectName();
+}

Modified: geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java (original)
+++ geronimo/trunk/modules/core/src/java/org/apache/geronimo/pool/ThreadPool.java Sat Aug  6 13:59:42 2005
@@ -17,6 +17,8 @@
 
 package org.apache.geronimo.pool;
 
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
 import EDU.oswego.cs.dl.util.concurrent.Executor;
 import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
 import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
@@ -27,21 +29,34 @@
 /**
  * @version $Rev$ $Date$
  */
-public class ThreadPool implements Executor, GBeanLifecycle {
+public class ThreadPool implements GeronimoExecutor, GBeanLifecycle {
     private PooledExecutor executor;
     private ClassLoader classLoader;
+    private ObjectName objectName;
 
-    public ThreadPool(int poolSize, String poolName, long keepAliveTime, ClassLoader classLoader) {
+    public ThreadPool(int poolSize, String poolName, long keepAliveTime, ClassLoader classLoader, String objectName) {
         PooledExecutor p = new PooledExecutor(poolSize);
         p.abortWhenBlocked();
         p.setKeepAliveTime(keepAliveTime);
         p.setMinimumPoolSize(poolSize);
         p.setThreadFactory(new ThreadPoolThreadFactory(poolName, classLoader));
+        try {
+            this.objectName = ObjectName.getInstance(objectName);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalStateException("Bad object name injected: "+e.getMessage());
+        }
 
         executor = p;
         this.classLoader = classLoader;
     }
 
+    public String getName() {
+        return objectName.getKeyProperty("name");
+    }
+
+    public String getObjectName() {
+        return objectName.getCanonicalName();
+    }
 
     public void execute(Runnable command) throws InterruptedException {
         PooledExecutor p;
@@ -137,11 +152,12 @@
         infoFactory.addAttribute("poolName", String.class, true);
         infoFactory.addAttribute("keepAliveTime", long.class, true);
 
+        infoFactory.addAttribute("objectName", String.class, false);
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
 
-        infoFactory.addInterface(Executor.class);
+        infoFactory.addInterface(GeronimoExecutor.class);
 
-        infoFactory.setConstructor(new String[] {"poolSize", "poolName", "keepAliveTime", "classLoader"});
+        infoFactory.setConstructor(new String[] {"poolSize", "poolName", "keepAliveTime", "classLoader", "objectName"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/core/src/test/org/apache/geronimo/pool/ThreadPoolTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/core/src/test/org/apache/geronimo/pool/ThreadPoolTest.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/core/src/test/org/apache/geronimo/pool/ThreadPoolTest.java (original)
+++ geronimo/trunk/modules/core/src/test/org/apache/geronimo/pool/ThreadPoolTest.java Sat Aug  6 13:59:42 2005
@@ -63,7 +63,7 @@
     }
 
     public void setUp() throws Exception {
-        threadPool = new ThreadPool(1, "foo", Long.MAX_VALUE, ThreadPoolTest.class.getClassLoader());
+        threadPool = new ThreadPool(1, "foo", Long.MAX_VALUE, ThreadPoolTest.class.getClassLoader(), "foo:bar=baz");
         threadPool.doStart();
     }
 

Modified: geronimo/trunk/modules/j2ee/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/project.xml?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/project.xml (original)
+++ geronimo/trunk/modules/j2ee/project.xml Sat Aug  6 13:59:42 2005
@@ -55,6 +55,12 @@
         </dependency>
 
         <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-core</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <dependency>
             <groupId>geronimo-spec</groupId>
             <artifactId>geronimo-spec-ejb</artifactId>
             <version>${geronimo_spec_ejb_version}</version>

Added: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBConnector.java?rev=230587&view=auto
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBConnector.java (added)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBConnector.java Sat Aug  6 13:59:42 2005
@@ -0,0 +1,26 @@
+/**
+ *
+ * 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.j2ee.management.geronimo;
+
+/**
+ * Management interface for network connectors used to communicate with an
+ * EJB container.
+ *
+ * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
+ */
+public interface EJBConnector extends NetworkConnector {
+}

Added: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBContainer.java?rev=230587&view=auto
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBContainer.java (added)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/EJBContainer.java Sat Aug  6 13:59:42 2005
@@ -0,0 +1,35 @@
+/**
+ *
+ * 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.j2ee.management.geronimo;
+
+/**
+ * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
+ */
+public interface EJBContainer extends NetworkContainer {
+    public final static String PROTOCOL_RMI = "RMI";
+    public final static String PROTOCOL_IIOP = "IIOP";
+    public final static String PROTOCOL_HTTP = "HTTP";
+    public final static String PROTOCOL_HTTPS = "HTTPS";
+    public final static String PROTOCOL_HTTP_SOAP = "HTTPSOAP";
+
+    /**
+     * 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 a secure connector).
+     */
+    public String addConnector(String uniqueName, String protocol, String threadPoolObjectName, String host, int port);
+}

Added: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/J2EEServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/J2EEServer.java?rev=230587&view=auto
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/J2EEServer.java (added)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/J2EEServer.java Sat Aug  6 13:59:42 2005
@@ -0,0 +1,51 @@
+/**
+ *
+ * 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.j2ee.management.geronimo;
+
+/**
+ * Geronimo-specific extensions to the standard J2EE server management
+ * interface.
+ *
+ * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
+ */
+public interface J2EEServer extends org.apache.geronimo.j2ee.management.J2EEServer {
+    /**
+     * Gets the ObjectName of the Web Container associated with this
+     * J2EEServer, or null if there is none in the current server
+     * configuration.
+     *
+     * @return The ObjectName of the web container, in String form.
+     */
+    public String getWebContainer();
+
+    /**
+     * Gets the ObjectName of the EJB Container associated with this
+     * J2EEServer, or null if there is none in the current server
+     * configuration.
+     *
+     * @return The ObjectName of the EJB container, in String form.
+     */
+    public String getEJBContainer();
+
+    /**
+     * Gets the ObjectNames of the thread pools associated with this
+     * J2EEServer.
+     *
+     * @return The ObjectNames of the thread pools, in String form.
+     */
+    public String[] getThreadPools();
+}

Added: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java?rev=230587&view=auto
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java (added)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkConnector.java Sat Aug  6 13:59:42 2005
@@ -0,0 +1,74 @@
+/**
+ *
+ * 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.j2ee.management.geronimo;
+
+import java.net.UnknownHostException;
+import java.net.InetSocketAddress;
+import org.apache.geronimo.kernel.management.StateManageable;
+
+/**
+ * Base management interface for a network connector used to handle some
+ * protocol in order to talk to some part of the Geronimo server.
+ *
+ * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
+ */
+public interface NetworkConnector extends StateManageable {
+    /**
+     * Gets the network protocol that this connector handles.
+     */
+    String getProtocol();
+
+    /**
+     * Gets the network port that this connector listens on.
+     */
+    int getPort();
+
+    /**
+     * Sets the network port that this connector listens on.
+     */
+    void setPort(int port);
+
+    /**
+     * Gets the hostname/IP that this connector listens on.
+     */
+    String getHost();
+
+    /**
+     * Sets the hostname/IP that this connector listens on.  This is typically
+     * most useful for machines with multiple network cards, but can be used
+     * to limit a connector to only listen for connections from the local
+     * machine (127.0.0.1).  To listen on all available network interfaces,
+     * specify an address of 0.0.0.0.
+     */
+    void setHost(String host) throws UnknownHostException;
+
+    /**
+     * Every connector must specify a property of type InetSocketAddress
+     * because we use that to identify the network services to print a list
+     * during startup.  However, this can be read-only since the host and port
+     * are set separately using setHost and setPort.
+     */
+    InetSocketAddress getListenAddress();
+
+    /**
+     * Gets the unique name of this object.  The object name must comply with
+     * the ObjectName specification in the JMX specification.
+     *
+     * @return the unique name of this object within the server
+     */
+    String getObjectName();
+}

Added: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkContainer.java?rev=230587&view=auto
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkContainer.java (added)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/NetworkContainer.java Sat Aug  6 13:59:42 2005
@@ -0,0 +1,51 @@
+/**
+ *
+ * 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.j2ee.management.geronimo;
+
+/**
+ * Base management interface for a server component that has associated
+ * network connectors.
+ *
+ * @version $Rev: 46228 $ $Date: 2004-09-16 21:21:04 -0400 (Thu, 16 Sep 2004) $
+ */
+public interface NetworkContainer {
+    /**
+     * Gets the protocols which this container can configure connectors for.
+     */
+    public String[] getSupportedProtocols();
+
+    /**
+     * 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);
+
+    /**
+     * Gets the ObjectNames of any existing connectors for the specified
+     * protocol.
+     *
+     * @param protocol A protocol as returned by getSupportedProtocols
+     */
+    public String[] getConnectors(String protocol);
+
+    /**
+     * Gets the ObjectNames of any existing connectors associated with this
+     * container.
+     */
+    public String[] getConnectors();
+}

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java Sat Aug  6 13:59:42 2005
@@ -30,8 +30,8 @@
     public final static String KEYSTORE_TYPE_PKCS12 = "PKCS12";
     public final static String ALGORITHM_TYPE_SUN = "SunX509";
     public final static String ALGORITHM_TYPE_IBM = "IbmX509";
-    public final static String PROTOCOL_TYPE_TLS = "TLS";
-    public final static String PROTOCOL_TYPE_SSL = "SSL";
+    public final static String SECURE_PROTOCOL_TYPE_TLS = "TLS";
+    public final static String SECURE_PROTOCOL_TYPE_SSL = "SSL";
 
     /**
      * Gets the name of the keystore file that holds the server certificate
@@ -88,14 +88,14 @@
      * may not be compatible with popular browsers unless this is changed to
      * SSL.
      */
-    public String getProtocol();
+    public String getSecureProtocol();
     /**
      * Gets the protocol used for secure communication.  This should usually
      * be TLS, though some JVM implementations (particularly some of IBM's)
      * may not be compatible with popular browsers unless this is changed to
      * SSL.  Don't change it if you're not having problems.
      */
-    public void setProtocol(String protocol);
+    public void setSecureProtocol(String protocol);
     /**
      * Checks whether clients are required to authenticate using client
      * certificates in order to connect using this connector.  If enabled,

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebConnector.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebConnector.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebConnector.java Sat Aug  6 13:59:42 2005
@@ -16,8 +16,6 @@
  */
 package org.apache.geronimo.j2ee.management.geronimo;
 
-import java.net.InetSocketAddress;
-
 /**
  * The common configuration settings for a web container network connector --
  * that is, the protocol and network settings used to connect to the web
@@ -28,35 +26,7 @@
  *
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
-public interface WebConnector {
-    /**
-     * Gets the network port that this connector listens on.
-     */
-    public int getPort();
-    /**
-     * Sets the network port that this connector listens on.
-     */
-    public void setPort(int port);
-    /**
-     * Gets the hostname/IP that this connector listens on.
-     */
-    public String getHost();
-    /**
-     * Sets the hostname/IP that this connector listens on.  This is typically
-     * most useful for machines with multiple network cards, but can be used
-     * to limit a connector to only listen for connections from the local
-     * machine (127.0.0.1).  To listen on all available network interfaces,
-     * specify an address of 0.0.0.0.
-     */
-    public void setHost(String host);
-    /**
-     * Every connector must specify a property of type InetSocketAddress
-     * because we use that to identify the network services to print a list
-     * during startup.  However, this can be read-only since the host and port
-     * are set separately using setHost and setPort.
-     */
-    public InetSocketAddress getListenAddress();
-
+public interface WebConnector extends NetworkConnector {
     /**
      * Gets the size of the buffer used to handle network data for this
      * connector.
@@ -126,4 +96,5 @@
      * be used as they all fail equally well.  :)
      */
     public void setRedirectPort(int port);
+
 }

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebContainer.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebContainer.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/WebContainer.java Sat Aug  6 13:59:42 2005
@@ -22,28 +22,15 @@
  *
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
-public interface WebContainer {
-    public final static String PROTOCOL_HTTP = "http";
-    public final static String PROTOCOL_HTTPS = "https";
-    public final static String PROTOCOL_AJP = "ajp";
+public interface WebContainer extends NetworkContainer {
+    public final static String PROTOCOL_HTTP = "HTTP";
+    public final static String PROTOCOL_HTTPS = "HTTPS";
+    public final static String PROTOCOL_AJP = "AJP";
 
     /**
-     * Gets the protocols which this container can configure connectors for.
-     */
-    public String[] getSupportedProtocols();
-    
-    /**
      * 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).
+     * functional (e.g. SSL settings for a secure connector).
      */
     public String addConnector(String uniqueName, String protocol, String host, int port);
-
-    /**
-     * Gets the ObjectNames of any existing connectors for the specified
-     * protocol.
-     *
-     * @param protocol A protocol as returned by getSupportedProtocols
-     */
-    public String[] getConnectors(String protocol);
 }

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java Sat Aug  6 13:59:42 2005
@@ -18,15 +18,21 @@
 package org.apache.geronimo.j2ee.management.impl;
 
 import java.util.Hashtable;
+import java.util.Set;
+import java.util.Iterator;
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanQuery;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.j2ee.management.J2EEServer;
+import org.apache.geronimo.j2ee.management.geronimo.J2EEServer;
+import org.apache.geronimo.j2ee.management.geronimo.WebContainer;
+import org.apache.geronimo.j2ee.management.geronimo.EJBContainer;
+import org.apache.geronimo.pool.GeronimoExecutor;
 
 /**
  * @version $Rev$ $Date$
@@ -104,6 +110,38 @@
 
     public String[] getJavaVMs() {
         return Util.getObjectNames(kernel, baseName, new String[]{"JVM"});
+    }
+
+    public String getWebContainer() {
+        GBeanQuery query = new GBeanQuery(null, WebContainer.class.getName());
+        Set set = kernel.listGBeans(query);
+        if(set.size() == 0) {
+            return null;
+        } else { // ignore possibility of multiple results
+            return ((ObjectName)set.iterator().next()).getCanonicalName();
+        }
+    }
+
+    public String getEJBContainer() {
+        GBeanQuery query = new GBeanQuery(null, EJBContainer.class.getName());
+        Set set = kernel.listGBeans(query);
+        if(set.size() == 0) {
+            return null;
+        } else { // ignore possibility of multiple results
+            return ((ObjectName)set.iterator().next()).getCanonicalName();
+        }
+    }
+
+    public String[] getThreadPools() {
+        GBeanQuery query = new GBeanQuery(null, GeronimoExecutor.class.getName());
+        Set set = kernel.listGBeans(query);
+        String[] names = new String[set.size()];
+        int i=0;
+        for (Iterator it = set.iterator(); it.hasNext();) {
+            ObjectName name = (ObjectName) it.next();
+            names[i++] = name.getCanonicalName();
+        }
+        return names;
     }
 
     public String getServerVendor() {

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java Sat Aug  6 13:59:42 2005
@@ -20,17 +20,25 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.DependencyManager;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
 
 /**
  * @version $Rev$ $Date$
  */
 public class Util {
+    private final static Log log = LogFactory.getLog(Util.class);
 
     public static String[] getObjectNames(Kernel kernel, J2eeContext context, String[] j2eeTypes) throws MalformedObjectNameException {
         List objectNames = new LinkedList();
@@ -64,5 +72,31 @@
             names[i] = iterator.next().toString();
         }
         return names;
+    }
+
+    /**
+     * Gets a Configuration that is the parent of the specified object.
+     *
+     * @param objectName the bean to find the Configuration for
+     * @return the Configuration the bean is in, or null if it is not in a Configuration
+     */
+    public synchronized static ObjectName getConfiguration(Kernel kernel, ObjectName objectName) {
+        DependencyManager mgr = kernel.getDependencyManager();
+        Set parents = mgr.getParents(objectName);
+        if(parents == null || parents.isEmpty()) {
+            log.warn("No parents found for "+objectName);
+            return null;
+        }
+        for (Iterator it = parents.iterator(); it.hasNext();) {
+            ObjectName name = (ObjectName) it.next();
+            try {
+                GBeanInfo info = kernel.getGBeanInfo(name);
+                if(info.getClassName().equals(Configuration.class.getName())) {
+                    return name;
+                }
+            } catch (GBeanNotFoundException e) {} // should never happen
+        }
+        log.warn("No Configuration parent found");
+        return null;
     }
 }

Modified: geronimo/trunk/modules/timer/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/timer/project.xml?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/timer/project.xml (original)
+++ geronimo/trunk/modules/timer/project.xml Sat Aug  6 13:59:42 2005
@@ -86,6 +86,12 @@
 
 
         <!-- Thirdparty -->
+        <dependency>
+            <groupId>mx4j</groupId>
+            <artifactId>mx4j</artifactId>
+            <version>${mx4j_version}</version>
+        </dependency>
+
         <!-- jdbc timer WorkerPersistence -->
         <dependency>
             <groupId>xstream</groupId>

Modified: geronimo/trunk/modules/timer/src/test/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/timer/src/test/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java?rev=230587&r1=230586&r2=230587&view=diff
==============================================================================
--- geronimo/trunk/modules/timer/src/test/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java (original)
+++ geronimo/trunk/modules/timer/src/test/org/apache/geronimo/timer/AbstractThreadPooledTimerTest.java Sat Aug  6 13:59:42 2005
@@ -50,7 +50,7 @@
 
     protected void setUp() throws Exception {
         userTaskFactory = new MockUserTaskFactory();
-        threadPool = new ThreadPool(30, "TestPool", 10000, this.getClass().getClassLoader());
+        threadPool = new ThreadPool(30, "TestPool", 10000, this.getClass().getClassLoader(), "foo:bar=baz");
         WorkerPersistence workerPersistence = new VMWorkerPersistence();
         timer = new ThreadPooledTimer(executableWorkFactory, workerPersistence, threadPool, transactionContextManager);
         timer.doStart();