tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1240330 - in /tomcat/trunk/java/org/apache/catalina: JmxEnabled.java mbeans/MBeanFactory.java util/LifecycleMBeanBase.java
Date Fri, 03 Feb 2012 20:09:52 GMT
Author: markt
Date: Fri Feb  3 20:09:51 2012
New Revision: 1240330

URL: http://svn.apache.org/viewvc?rev=1240330&view=rev
Log:
Add new interface to indicate JMX support and start to use it

Added:
    tomcat/trunk/java/org/apache/catalina/JmxEnabled.java
Modified:
    tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java
    tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java

Added: tomcat/trunk/java/org/apache/catalina/JmxEnabled.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/JmxEnabled.java?rev=1240330&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/JmxEnabled.java (added)
+++ tomcat/trunk/java/org/apache/catalina/JmxEnabled.java Fri Feb  3 20:09:51 2012
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.catalina;
+
+import javax.management.MBeanRegistration;
+import javax.management.ObjectName;
+
+/**
+ * This interface is implemented by components that will be registered with an
+ * MBean server when they are created and unregistered when they are destroyed.
+ * It is primarily intended to be implemented by components that implement
+ * {@link Lifecycle} but is not exclusively for them.
+ */
+public interface JmxEnabled extends MBeanRegistration {
+
+    /**
+     * Obtain the domain under which this component will be / has been
+     * registered.
+     */
+    String getDomain();
+
+
+    /**
+     * Specify the domain under which this component should be registered. Used
+     * with components that cannot (easily) navigate the component hierarchy to
+     * determine the correct domain to use.
+     */
+    void setDomain(String domain);
+
+
+    /**
+     * Obtain the name under which this component has been registered with JMX.
+     */
+    ObjectName getObjectName();
+}

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java?rev=1240330&r1=1240329&r2=1240330&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MBeanFactory.java Fri Feb  3 20:09:51 2012
@@ -26,10 +26,10 @@ import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
 import org.apache.catalina.Host;
+import org.apache.catalina.JmxEnabled;
 import org.apache.catalina.Server;
 import org.apache.catalina.Service;
 import org.apache.catalina.Valve;
-import org.apache.catalina.authenticator.SingleSignOn;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.core.ContainerBase;
 import org.apache.catalina.core.StandardContext;
@@ -46,10 +46,6 @@ import org.apache.catalina.session.Stand
 import org.apache.catalina.startup.ContextConfig;
 import org.apache.catalina.startup.HostConfig;
 import org.apache.catalina.util.LifecycleMBeanBase;
-import org.apache.catalina.valves.AccessLogValve;
-import org.apache.catalina.valves.RemoteAddrValve;
-import org.apache.catalina.valves.RemoteHostValve;
-import org.apache.catalina.valves.ValveBase;
 
 
 /**
@@ -232,32 +228,6 @@ public class MBeanFactory {
 
 
     /**
-     * Create a new AccessLoggerValve.
-     *
-     * @param parent MBean Name of the associated parent component
-     *
-     * @exception Exception if an MBean cannot be created or registered
-     *
-     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
-     *              #createValve(String, String)}.
-     */
-    @Deprecated
-    public String createAccessLoggerValve(String parent)
-        throws Exception {
-
-        ObjectName pname = new ObjectName(parent);
-        // Create a new AccessLogValve instance
-        AccessLogValve accessLogger = new AccessLogValve();
-        ContainerBase containerBase = getParentContainerFromParent(pname);
-        // Add the new instance to its parent component
-        containerBase.getPipeline().addValve(accessLogger);
-        ObjectName oname = accessLogger.getObjectName();
-        return (oname.toString());
-
-    }
-
-
-    /**
      * Create a new AjpConnector
      *
      * @param parent MBean Name of the associated parent component
@@ -467,88 +437,6 @@ public class MBeanFactory {
     }
 
 
-    /**
-     * Create a new Remote Address Filter Valve.
-     *
-     * @param parent MBean Name of the associated parent component
-     *
-     * @exception Exception if an MBean cannot be created or registered
-     *
-     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
-     *              #createValve(String, String)}.
-     */
-    @Deprecated
-    public String createRemoteAddrValve(String parent)
-        throws Exception {
-
-        // Create a new RemoteAddrValve instance
-        RemoteAddrValve valve = new RemoteAddrValve();
-
-        // Add the new instance to its parent component
-        ObjectName pname = new ObjectName(parent);
-        ContainerBase containerBase = getParentContainerFromParent(pname);
-        containerBase.getPipeline().addValve(valve);
-        ObjectName oname = valve.getObjectName();
-        return (oname.toString());
-
-    }
-
-
-     /**
-     * Create a new Remote Host Filter Valve.
-     *
-     * @param parent MBean Name of the associated parent component
-     *
-     * @exception Exception if an MBean cannot be created or registered
-     *
-     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
-     *              #createValve(String, String)}.
-     */
-    @Deprecated
-    public String createRemoteHostValve(String parent)
-        throws Exception {
-
-        // Create a new RemoteHostValve instance
-        RemoteHostValve valve = new RemoteHostValve();
-
-        // Add the new instance to its parent component
-        ObjectName pname = new ObjectName(parent);
-        ContainerBase containerBase = getParentContainerFromParent(pname);
-        containerBase.getPipeline().addValve(valve);
-        ObjectName oname = valve.getObjectName();
-        return (oname.toString());
-
-    }
-
-
-    /**
-     * Create a new Single Sign On Valve.
-     *
-     * @param parent MBean Name of the associated parent component
-     *
-     * @exception Exception if an MBean cannot be created or registered
-     *
-     * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
-     *              #createValve(String, String)}.
-     */
-    @Deprecated
-
-    public String createSingleSignOn(String parent)
-        throws Exception {
-
-        // Create a new SingleSignOn instance
-        SingleSignOn valve = new SingleSignOn();
-
-        // Add the new instance to its parent component
-        ObjectName pname = new ObjectName(parent);
-        ContainerBase containerBase = getParentContainerFromParent(pname);
-        containerBase.getPipeline().addValve(valve);
-        ObjectName oname = valve.getObjectName();
-        return (oname.toString());
-
-    }
-
-
    /**
      * Create a new StandardContext.
      *
@@ -805,8 +693,8 @@ public class MBeanFactory {
 
         container.getPipeline().addValve(valve);
 
-        if (valve instanceof LifecycleMBeanBase) {
-            return ((LifecycleMBeanBase) valve).getObjectName().toString();
+        if (valve instanceof JmxEnabled) {
+            return ((JmxEnabled) valve).getObjectName().toString();
         } else {
             return null;
         }
@@ -1038,7 +926,7 @@ public class MBeanFactory {
         ContainerBase container = getParentContainerFromChild(oname);
         Valve[] valves = container.getPipeline().getValves();
         for (int i = 0; i < valves.length; i++) {
-            ObjectName voname = ((ValveBase) valves[i]).getObjectName();
+            ObjectName voname = ((LifecycleMBeanBase) valves[i]).getObjectName();
             if (voname.equals(oname)) {
                 container.getPipeline().removeValve(valves[i]);
             }

Modified: tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java?rev=1240330&r1=1240329&r2=1240330&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java Fri Feb  3 20:09:51
2012
@@ -18,13 +18,13 @@
 package org.apache.catalina.util;
 
 import javax.management.InstanceNotFoundException;
-import javax.management.MBeanRegistration;
 import javax.management.MBeanRegistrationException;
 import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 import org.apache.catalina.Globals;
+import org.apache.catalina.JmxEnabled;
 import org.apache.catalina.LifecycleException;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -32,7 +32,7 @@ import org.apache.tomcat.util.modeler.Re
 import org.apache.tomcat.util.res.StringManager;
 
 public abstract class LifecycleMBeanBase extends LifecycleBase
-        implements MBeanRegistration {
+        implements JmxEnabled {
 
     private static Log log = LogFactory.getLog(LifecycleMBeanBase.class);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message