geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r278800 [3/3] - in /geronimo/trunk: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-standard/src/java/org/apache/geronimo/console/infomanager/ applications/console-standard/src/java/org/apache/geron...
Date Mon, 05 Sep 2005 17:11:14 GMT
Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HttpsConnectorGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HttpsConnectorGBean.java?rev=278800&r1=278799&r2=278800&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HttpsConnectorGBean.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HttpsConnectorGBean.java
Mon Sep  5 10:10:49 2005
@@ -2,7 +2,7 @@
 
 import java.util.Map;
 import org.apache.geronimo.management.geronimo.SecureConnector;
-import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -46,8 +46,8 @@
      * @param protocol
      */
     protected void validateProtocol(String protocol) {
-        if(protocol != null && !protocol.equals(WebContainer.PROTOCOL_HTTPS)) {
-            throw new IllegalStateException("HttpsConnectorGBean only supports "+WebContainer.PROTOCOL_HTTPS);
+        if(protocol != null && !protocol.equals(WebManager.PROTOCOL_HTTPS)) {
+            throw new IllegalStateException("HttpsConnectorGBean only supports "+WebManager.PROTOCOL_HTTPS);
         }
     }
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=278800&r1=278799&r2=278800&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
Mon Sep  5 10:10:49 2005
@@ -22,13 +22,6 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Hashtable;
-
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
@@ -40,18 +33,13 @@
 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.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.j2ee.management.impl.Util;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.realm.TomcatGeronimoRealm;
 import org.apache.geronimo.tomcat.realm.TomcatJAASRealm;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.webservices.SoapHandler;
 import org.apache.geronimo.webservices.WebServiceContainer;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
 
 /**
  * Apache Tomcat GBean
@@ -85,16 +73,6 @@
      **/
     private ClassLoader classLoader;
 
-    /**
-     * The kernel that's loaded this GBean.
-     */
-    private Kernel kernel;
-
-    /**
-     * The ObjectName of this GBean.
-     */
-    private ObjectName myName;
-
     private final Map webServices = new HashMap();
 
     // Required as it's referenced by deployed webapps
@@ -105,14 +83,7 @@
     /**
      * GBean constructor (invoked dynamically when the gbean is declared in a plan)
      */
-    public TomcatContainer(ClassLoader classLoader, String catalinaHome, ObjectRetriever
engineGBean, ServerInfo serverInfo, Kernel kernel, String objectName) {
-        this.kernel = kernel;
-        try {
-            myName = ObjectName.getInstance(objectName);
-        } catch (MalformedObjectNameException e) {
-            throw new IllegalArgumentException("Invalid object name "+e);
-        }
-
+    public TomcatContainer(ClassLoader classLoader, String catalinaHome, ObjectRetriever
engineGBean, ServerInfo serverInfo) {
         if (catalinaHome == null)
             catalinaHome = DEFAULT_CATALINA_HOME;
 
@@ -373,150 +344,14 @@
         return new TomcatClassLoader((URL[])urls.toArray(new URL[0]), null, cl, false);
     }
 
-
-
-    /**
-     * 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, TomcatWebConnector.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, TomcatWebConnector.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, ConnectorGBean.GBEAN_INFO);
-        } else if(protocol.equals(PROTOCOL_HTTPS)) {
-            connector = new GBeanData(name, HttpsConnectorGBean.GBEAN_INFO);
-            GBeanQuery query = new GBeanQuery(null, ServerInfo.class.getName());
-            Set set = kernel.listGBeans(query);
-            connector.setReferencePattern("ServerInfo", (ObjectName)set.iterator().next());
-            //todo: default HTTPS settings
-        } else if(protocol.equals(PROTOCOL_AJP)) {
-            connector = new GBeanData(name, ConnectorGBean.GBEAN_INFO);
-        } else {
-            throw new IllegalArgumentException("Invalid protocol '"+protocol+"'");
-        }
-        connector.setAttribute("protocol", protocol);
-        connector.setAttribute("host", host);
-        connector.setAttribute("port", new Integer(port));
-        connector.setAttribute("maxThreads", new Integer(50));
-        connector.setAttribute("acceptCount", new Integer(100));
-        connector.setReferencePattern("TomcatContainer", 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, "TomcatWebConnector-"+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(TomcatWebConnector.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 static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Tomcat Web Container", TomcatContainer.class);
 
-        infoFactory.setConstructor(new String[] { "classLoader", "catalinaHome", "EngineGBean",
"ServerInfo", "kernel", "objectName" });
+        infoFactory.setConstructor(new String[] { "classLoader", "catalinaHome", "EngineGBean",
"ServerInfo"});
 
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
-        infoFactory.addAttribute("kernel", Kernel.class, false);
-        infoFactory.addAttribute("objectName", String.class, false);
 
         infoFactory.addAttribute("catalinaHome", String.class, true);
 

Added: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java?rev=278800&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
(added)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
Mon Sep  5 10:10:49 2005
@@ -0,0 +1,317 @@
+/**
+ *
+ * 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.tomcat;
+
+import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Hashtable;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.j2ee.management.impl.Util;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Tomcat implementation of the WebManager management API.  Knows how to
+ * manipulate other Tomcat objects for management purposes.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class TomcatManagerImpl implements WebManager {
+    private final static Log log = LogFactory.getLog(TomcatManagerImpl.class);
+    private final Kernel kernel;
+
+    public TomcatManagerImpl(Kernel kernel) {
+        this.kernel = kernel;
+    }
+
+    /**
+     * 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).
 This may need to be done
+     * before starting the resulting connector.
+     *
+     * @param containerObjectName The ObjectName of the container that the connector should
be added to
+     * @param uniqueName          A name fragment that's unique to this connector
+     * @param protocol            The protocol that the connector should use
+     * @param host                The host name or IP that the connector should listen on
+     * @param port                The port that the connector should listen on
+     * @return The ObjectName of the new connector.
+     */
+    public String addConnector(String containerObjectName, String uniqueName, String protocol,
String host, int port) {
+        ObjectName container;
+        try {
+            container = ObjectName.getInstance(containerObjectName);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException("Invalid web container ObjectName '"+containerObjectName+"'");
+        }
+        ObjectName name = getConnectorName(container, protocol, uniqueName);
+        GBeanData connector;
+        if(protocol.equals(PROTOCOL_HTTP)) {
+            connector = new GBeanData(name, ConnectorGBean.GBEAN_INFO);
+        } else if(protocol.equals(PROTOCOL_HTTPS)) {
+            connector = new GBeanData(name, HttpsConnectorGBean.GBEAN_INFO);
+            GBeanQuery query = new GBeanQuery(null, ServerInfo.class.getName());
+            Set set = kernel.listGBeans(query);
+            connector.setReferencePattern("ServerInfo", (ObjectName)set.iterator().next());
+            //todo: default HTTPS settings
+        } else if(protocol.equals(PROTOCOL_AJP)) {
+            connector = new GBeanData(name, ConnectorGBean.GBEAN_INFO);
+        } else {
+            throw new IllegalArgumentException("Invalid protocol '"+protocol+"'");
+        }
+        connector.setAttribute("protocol", protocol);
+        connector.setAttribute("host", host);
+        connector.setAttribute("port", new Integer(port));
+        connector.setAttribute("maxThreads", new Integer(50));
+        connector.setAttribute("acceptCount", new Integer(100));
+        connector.setReferencePattern(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE, container);
+        ObjectName config = Util.getConfiguration(kernel, container);
+        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();
+    }
+
+    /**
+     * Gets the network containers.
+     */
+    public String[] getContainers() {
+        GBeanQuery query = new GBeanQuery(null, TomcatWebContainer.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;
+    }
+
+    /**
+     * Gets the protocols which this container can configure connectors for.
+     */
+    public String[] getSupportedProtocols() {
+        return new String[]{PROTOCOL_HTTP, PROTOCOL_HTTPS, PROTOCOL_AJP};
+    }
+
+    /**
+     * Removes a connector.  This shuts it down if necessary, and removes it from the server
environment.  It must be a
+     * connector that uses this network technology.
+     */
+    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(TomcatWebConnector.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);
+        }
+    }
+
+    /**
+     * Gets the ObjectNames of any existing connectors for this network technology for the
specified protocol.
+     *
+     * @param protocol A protocol as returned by getSupportedProtocols
+     */
+    public String[] getConnectors(String protocol) {
+        GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.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 associated with this network technology.
+     */
+    public String[] getConnectors() {
+        GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.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;
+    }
+
+    /**
+     * Gets the ObjectNames of any existing connectors for the specified container for the
specified protocol.
+     *
+     * @param protocol A protocol as returned by getSupportedProtocols
+     */
+    public String[] getConnectorsForContainer(String containerObjectName, String protocol)
{
+        if(protocol == null) {
+            return getConnectorsForContainer(containerObjectName);
+        }
+        try {
+            ObjectName containerName = ObjectName.getInstance(containerObjectName);
+            List results = new ArrayList();
+            GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.class.getName());
+            Set set = kernel.listGBeans(query); // all Jetty connectors
+            for (Iterator it = set.iterator(); it.hasNext();) {
+                ObjectName name = (ObjectName) it.next(); // a single Jetty connector
+                GBeanData data = kernel.getGBeanData(name);
+                Set refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
+                for (Iterator refit = refs.iterator(); refit.hasNext();) {
+                    ObjectName ref = (ObjectName) refit.next();
+                    boolean match = false;
+                    if(ref.isPattern()) {
+                        Set matches = kernel.listGBeans(ref);
+                        if(matches.size() != 1) {
+                            log.error("Unable to compare a connector->container reference
that's a pattern to a fixed container name: "+ref.getCanonicalName());
+                        } else {
+                            ref = (ObjectName)matches.iterator().next();
+                            if(ref.equals(containerName)) {
+                                match = true;
+                            }
+                        }
+                    } else {
+                        if(ref.equals(containerName)) {
+                            match = true;
+                        }
+                    }
+                    if(match) {
+                        try {
+                            String testProtocol = (String) kernel.getAttribute(name, "protocol");
+                            if(testProtocol != null && testProtocol.equals(protocol))
{
+                                results.add(name.getCanonicalName());
+                            }
+                        } catch (Exception e) {
+                            log.error("Unable to look up protocol for connector '"+name+"'",e);
+                        }
+                        break;
+                    }
+                }
+            }
+            return (String[]) results.toArray(new String[results.size()]);
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Unable to look up connectors for Jetty container
'"+containerObjectName+"': "+e);
+        }
+    }
+
+    /**
+     * Gets the ObjectNames of any existing connectors for the specified container.
+     */
+    public String[] getConnectorsForContainer(String containerObjectName) {
+        try {
+            ObjectName containerName = ObjectName.getInstance(containerObjectName);
+            List results = new ArrayList();
+            GBeanQuery query = new GBeanQuery(null, TomcatWebConnector.class.getName());
+            Set set = kernel.listGBeans(query); // all Jetty connectors
+            for (Iterator it = set.iterator(); it.hasNext();) {
+                ObjectName name = (ObjectName) it.next(); // a single Jetty connector
+                GBeanData data = kernel.getGBeanData(name);
+                Set refs = data.getReferencePatterns(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE);
+                for (Iterator refit = refs.iterator(); refit.hasNext();) {
+                    ObjectName ref = (ObjectName) refit.next();
+                    if(ref.isPattern()) {
+                        Set matches = kernel.listGBeans(ref);
+                        if(matches.size() != 1) {
+                            log.error("Unable to compare a connector->container reference
that's a pattern to a fixed container name: "+ref.getCanonicalName());
+                        } else {
+                            ref = (ObjectName)matches.iterator().next();
+                            if(ref.equals(containerName)) {
+                                results.add(name.getCanonicalName());
+                                break;
+                            }
+                        }
+                    } else {
+                        if(ref.equals(containerName)) {
+                            results.add(name.getCanonicalName());
+                            break;
+                        }
+                    }
+                }
+            }
+            return (String[]) results.toArray(new String[results.size()]);
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Unable to look up connectors for Jetty container
'"+containerObjectName+"': "+e);
+        }
+    }
+
+    private ObjectName getConnectorName(ObjectName container, String protocol, String uniqueName)
{
+        Hashtable table = new Hashtable();
+        table.put(NameFactory.J2EE_APPLICATION, container.getKeyProperty(NameFactory.J2EE_APPLICATION));
+        table.put(NameFactory.J2EE_SERVER, container.getKeyProperty(NameFactory.J2EE_SERVER));
+        table.put(NameFactory.J2EE_MODULE, container.getKeyProperty(NameFactory.J2EE_MODULE));
+        table.put(NameFactory.J2EE_TYPE, container.getKeyProperty(NameFactory.J2EE_TYPE));
+        table.put(NameFactory.J2EE_NAME, "TomcatWebConnector-"+protocol+"-"+uniqueName);
+        try {
+            return ObjectName.getInstance(container.getDomain(), table);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalStateException("Never should have failed: "+e.getMessage());
+        }
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Tomcat Web Manager", TomcatManagerImpl.class);
+        infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addInterface(WebManager.class);
+        infoFactory.setConstructor(new String[] {"kernel"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message