You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by am...@apache.org on 2002/03/08 07:58:17 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java StandardContextMBean.java StandardEngineMBean.java StandardHostMBean.java mbeans-descriptors.xml
amyroh 02/03/07 22:58:17
Modified: catalina/src/share/org/apache/catalina/mbeans
MBeanFactory.java StandardContextMBean.java
StandardEngineMBean.java StandardHostMBean.java
mbeans-descriptors.xml
Log:
Update removeXxxx and addXxxx to MBeanFactory. Clean up the rest of the StandardMBeans.
Revision Changes Path
1.10 +30 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
Index: MBeanFactory.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MBeanFactory.java 8 Mar 2002 00:42:14 -0000 1.9
+++ MBeanFactory.java 8 Mar 2002 06:58:17 -0000 1.10
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v 1.9 2002/03/08 00:42:14 amyroh Exp $
- * $Revision: 1.9 $
- * $Date: 2002/03/08 00:42:14 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v 1.10 2002/03/08 06:58:17 amyroh Exp $
+ * $Revision: 1.10 $
+ * $Date: 2002/03/08 06:58:17 $
*
* ====================================================================
*
@@ -108,7 +108,7 @@
* <code>org.apache.catalina.core.StandardServer</code> component.</p>
*
* @author Amy Roh
- * @version $Revision: 1.9 $ $Date: 2002/03/08 00:42:14 $
+ * @version $Revision: 1.10 $ $Date: 2002/03/08 06:58:17 $
*/
public class MBeanFactory extends BaseModelMBean {
@@ -881,6 +881,32 @@
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), logger);
return (oname.toString());
+ }
+
+
+ /**
+ * Remove an existing Context.
+ *
+ * @param name MBean Name of the comonent to remove
+ *
+ * @exception Exception if a component cannot be removed
+ */
+ public void removeContext(String name) throws Exception {
+
+ // Acquire a reference to the component to be removed
+ ObjectName oname = new ObjectName(name);
+ String serviceName = oname.getKeyProperty("service");
+ String hostName = oname.getKeyProperty("host");
+ String contextName = oname.getKeyProperty("context");
+ Server server = ServerFactory.getServer();
+ Service service = server.findService(serviceName);
+ Engine engine = (Engine) service.getContainer();
+ Host host = (Host) engine.findChild(hostName);
+ Context context = (Context) host.findChild(contextName);
+
+ // Remove this component from its parent component
+ host.removeChild(context);
+
}
1.4 +4 -115 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java
Index: StandardContextMBean.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StandardContextMBean.java 29 Jan 2002 23:10:49 -0000 1.3
+++ StandardContextMBean.java 8 Mar 2002 06:58:17 -0000 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java,v 1.3 2002/01/29 23:10:49 amyroh Exp $
- * $Revision: 1.3 $
- * $Date: 2002/01/29 23:10:49 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java,v 1.4 2002/03/08 06:58:17 amyroh Exp $
+ * $Revision: 1.4 $
+ * $Date: 2002/03/08 06:58:17 $
*
* ====================================================================
*
@@ -82,7 +82,7 @@
* <code>org.apache.catalina.core.StandardContext</code> component.</p>
*
* @author Amy Roh
- * @version $Revision: 1.3 $ $Date: 2002/01/29 23:10:49 $
+ * @version $Revision: 1.4 $ $Date: 2002/03/08 06:58:17 $
*/
public class StandardContextMBean extends BaseModelMBean {
@@ -120,28 +120,6 @@
/**
- * Add a new Valve to those assoicated with this Context
- *
- * @param valve MBean Name of the Valve to be added
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void addValve(String valve)
- throws Exception {
-
- StandardContext context = (StandardContext) this.resource;
- ObjectName oname = new ObjectName(valve);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Valve valveObj = null;
- if (obj instanceof Valve) {
- valveObj = (Valve) obj;
- }
- context.addValve(valveObj);
-
- }
-
-
- /**
* Remove the specified Valve from those associated this Context
*
* @param valve MBean Name of the Valve to be removed
@@ -161,94 +139,5 @@
context.removeValve(valveObj);
}
-
-
- /**
- * Associate the specified Loader with this Context
- *
- * @param loader MBean Name of the Loader with this Context
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setLoader(String loader)
- throws Exception {
-
- StandardContext context = (StandardContext) this.resource;
- ObjectName oname = new ObjectName(loader);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Loader loaderObj = null;
- if (obj instanceof Loader) {
- loaderObj = (Loader) obj;
- }
- context.setLoader(loaderObj);
-
- }
-
-
- /**
- * Associate the specified Logger with this Context
- *
- * @param logger MBean Name of the Logger with this Context
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setLogger(String logger)
- throws Exception {
-
- StandardContext context = (StandardContext) this.resource;
- ObjectName oname = new ObjectName(logger);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Logger loggerObj = null;
- if (obj instanceof Logger) {
- loggerObj = (Logger) obj;
- }
- context.setLogger(loggerObj);
-
- }
-
-
- /**
- * Associate the specified Manager with this Context
- *
- * @param manager MBean Name of the Manager with this Context
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setManager(String manager)
- throws Exception {
-
- StandardContext context = (StandardContext) this.resource;
- ObjectName oname = new ObjectName(manager);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Manager managerObj = null;
- if (obj instanceof Manager) {
- managerObj = (Manager) obj;
- }
- context.setManager(managerObj);
-
- }
-
-
- /**
- * Associate the specified Realm with this Context
- *
- * @param realm MBean Name of the Realm with this Context
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setRealm(String realm)
- throws Exception {
-
- StandardContext context = (StandardContext) this.resource;
- ObjectName oname = new ObjectName(realm);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Realm realmObj = null;
- if (obj instanceof Realm) {
- realmObj = (Realm) obj;
- }
- context.setRealm(realmObj);
-
- }
-
}
1.7 +4 -114 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java
Index: StandardEngineMBean.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StandardEngineMBean.java 29 Jan 2002 23:10:49 -0000 1.6
+++ StandardEngineMBean.java 8 Mar 2002 06:58:17 -0000 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v 1.6 2002/01/29 23:10:49 amyroh Exp $
- * $Revision: 1.6 $
- * $Date: 2002/01/29 23:10:49 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v 1.7 2002/03/08 06:58:17 amyroh Exp $
+ * $Revision: 1.7 $
+ * $Date: 2002/03/08 06:58:17 $
*
* ====================================================================
*
@@ -85,7 +85,7 @@
* <code>org.apache.catalina.core.StandardEngine</code> component.</p>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.6 $ $Date: 2002/01/29 23:10:49 $
+ * @version $Revision: 1.7 $ $Date: 2002/03/08 06:58:17 $
*/
public class StandardEngineMBean extends BaseModelMBean {
@@ -123,72 +123,6 @@
/**
- * Add a new Host to those assoicated with this Engine
- *
- * @param host MBean Name of the new Host to be added
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void addHost(String host)
- throws Exception {
-
- StandardEngine engine = (StandardEngine) this.resource;
- ObjectName oname = new ObjectName(host);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Host hostObj = null;
- if (obj instanceof Host) {
- hostObj = (Host) obj;
- }
- engine.addChild(hostObj);
-
- }
-
-
- /**
- * Remove the specified Host from those associated with this Engine
- *
- * @param host MBean Name of the specified Host to be removed
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void removeHost(String host)
- throws Exception {
-
- StandardEngine engine = (StandardEngine) this.resource;
- ObjectName oname = new ObjectName(host);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Host hostObj = null;
- if (obj instanceof Host) {
- hostObj = (Host) obj;
- }
- engine.removeChild(hostObj);
-
- }
-
-
- /**
- * Add a new Valve to those assoicated with this Engine
- *
- * @param valve MBean Name of the new Valve to be added
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void addValve(String valve)
- throws Exception {
-
- StandardEngine engine = (StandardEngine) this.resource;
- ObjectName oname = new ObjectName(valve);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Valve valveObj = null;
- if (obj instanceof Valve) {
- valveObj = (Valve) obj;
- }
- engine.addValve(valveObj);
-
- }
-
-
- /**
* Remove the specified Valve from those assoicated with this Engine
*
* @param valve MBean Name of the Valve to be removed
@@ -206,50 +140,6 @@
valveObj = (Valve) obj;
}
engine.removeValve(valveObj);
-
- }
-
-
- /**
- * Associate the specified Logger with this Engine
- *
- * @param logger MBean Name of the Logger with this Engine
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setLogger(String logger)
- throws Exception {
-
- StandardEngine engine = (StandardEngine) this.resource;
- ObjectName oname = new ObjectName(logger);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Logger loggerObj = null;
- if (obj instanceof Logger) {
- loggerObj = (Logger) obj;
- }
- engine.setLogger(loggerObj);
-
- }
-
-
- /**
- * Associate the specified Realm with this Engine
- *
- * @param realm MBean Name of the Realm with this Engine
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setRealm(String realm)
- throws Exception {
-
- StandardEngine engine = (StandardEngine) this.resource;
- ObjectName oname = new ObjectName(realm);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Realm realmObj = null;
- if (obj instanceof Realm) {
- realmObj = (Realm) obj;
- }
- engine.setRealm(realmObj);
}
1.4 +4 -114 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java
Index: StandardHostMBean.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StandardHostMBean.java 29 Jan 2002 23:10:49 -0000 1.3
+++ StandardHostMBean.java 8 Mar 2002 06:58:17 -0000 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java,v 1.3 2002/01/29 23:10:49 amyroh Exp $
- * $Revision: 1.3 $
- * $Date: 2002/01/29 23:10:49 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java,v 1.4 2002/03/08 06:58:17 amyroh Exp $
+ * $Revision: 1.4 $
+ * $Date: 2002/03/08 06:58:17 $
*
* ====================================================================
*
@@ -85,7 +85,7 @@
* <code>org.apache.catalina.core.StandardHost</code> component.</p>
*
* @author Amy Roh
- * @version $Revision: 1.3 $ $Date: 2002/01/29 23:10:49 $
+ * @version $Revision: 1.4 $ $Date: 2002/03/08 06:58:17 $
*/
public class StandardHostMBean extends BaseModelMBean {
@@ -139,50 +139,6 @@
/**
- * Add a new Context to those assoicated with this Host
- *
- * @param context MBean Name of the Context to be added
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void addContext(String context)
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- ObjectName oname = new ObjectName(context);
- Object obj = mserver.getAttribute(oname, "managedResource");
- StandardContext contextObj = null;
- if (obj instanceof StandardContext) {
- contextObj = (StandardContext) obj;
- }
- host.addChild(contextObj);
-
- }
-
-
- /**
- * Add a new Valve to those assoicated with this Host
- *
- * @param valve MBean Name of the Valve to be added
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void addValve(String valve)
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- ObjectName oname = new ObjectName(valve);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Valve valveObj = null;
- if (obj instanceof Valve) {
- valveObj = (Valve) obj;
- }
- host.addValve(valveObj);
-
- }
-
-
- /**
* Return the set of alias names for this Host
*
* @exception Exception if an MBean cannot be created or registered
@@ -242,28 +198,6 @@
}
- /**
- * Remove the specified Context from those associated with this Host
- *
- * @param context MBean Name of the Context to be removed
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void removeContext(String context)
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- ObjectName oname = new ObjectName(context);
- Object obj = mserver.getAttribute(oname, "managedResource");
- StandardContext contextObj = null;
- if (obj instanceof StandardContext) {
- contextObj = (StandardContext) obj;
- }
- host.removeChild(contextObj);
-
- }
-
-
/**
* Remove the specified Valve from those associated this Host
*
@@ -282,50 +216,6 @@
valveObj = (Valve) obj;
}
host.removeValve(valveObj);
-
- }
-
-
- /**
- * Associate the specified Logger with this Host
- *
- * @param logger MBean Name of the Logger with this Host
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setLogger(String logger)
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- ObjectName oname = new ObjectName(logger);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Logger loggerObj = null;
- if (obj instanceof Logger) {
- loggerObj = (Logger) obj;
- }
- host.setLogger(loggerObj);
-
- }
-
-
- /**
- * Associate the specified Realm with this Host
- *
- * @param realm MBean Name of the Realm with this Host
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void setRealm(String realm)
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- ObjectName oname = new ObjectName(realm);
- Object obj = mserver.getAttribute(oname, "managedResource");
- Realm realmObj = null;
- if (obj instanceof Realm) {
- realmObj = (Realm) obj;
- }
- host.setRealm(realmObj);
}
1.35 +10 -1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/mbeans-descriptors.xml
Index: mbeans-descriptors.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/mbeans-descriptors.xml,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- mbeans-descriptors.xml 7 Mar 2002 02:48:53 -0000 1.34
+++ mbeans-descriptors.xml 8 Mar 2002 06:58:17 -0000 1.35
@@ -6,7 +6,7 @@
<!--
Descriptions of JMX MBeans for Catalina
- $Id: mbeans-descriptors.xml,v 1.34 2002/03/07 02:48:53 craigmcc Exp $
+ $Id: mbeans-descriptors.xml,v 1.35 2002/03/08 06:58:17 amyroh Exp $
-->
<mbeans-descriptors>
@@ -1150,6 +1150,15 @@
<!-- components to be stopped (if necessary) and removed, and the -->
<!-- corresponding MBeans to be destroyed. -->
+ <operation name="removeContext"
+ description="Remove an existing Context"
+ impact="ACTION"
+ returnType="void">
+ <parameter name="name"
+ description="MBean Name of the component to be removed"
+ type="java.lang.String"/>
+ </operation>
+
<operation name="removeHost"
description="Remove an existing Host"
impact="ACTION"
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>