amyroh 2002/09/12 18:35:23
Modified: catalina/src/share/org/apache/catalina/mbeans
DefaultContextMBean.java MBeanFactory.java
ServerLifecycleListener.java
Log:
Add NamingResource handling for DefaultContext.
Revision Changes Path
1.2 +5 -4
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/DefaultContextMBean.java
Index: DefaultContextMBean.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/DefaultContextMBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultContextMBean.java 9 Sep 2002 23:39:03 -0000 1.1
+++ DefaultContextMBean.java 13 Sep 2002 01:35:22 -0000 1.2
@@ -265,6 +265,7 @@
ManagedBean managed = registry.findManagedBean("ContextResource");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), resource);
+
return (oname.toString());
}
1.38 +6 -8
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.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- MBeanFactory.java 11 Sep 2002 14:19:33 -0000 1.37
+++ MBeanFactory.java 13 Sep 2002 01:35:22 -0000 1.38
@@ -819,7 +819,7 @@
public String createStandardContext(String parent, String path,
String docBase)
throws Exception {
-
+
// Create a new StandardContext instance
StandardContext context = new StandardContext();
path = getPathStr(path);
@@ -832,15 +832,13 @@
Service service = server.findService(pname.getKeyProperty("service"));
Engine engine = (Engine) service.getContainer();
Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
- context.setParent(host);
host.addChild(context);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("StandardContext");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), context);
- throw new Exception(oname.toString());
- //return (oname.toString());
+ return (oname.toString());
}
1.33 +45 -7
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java
Index: ServerLifecycleListener.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- ServerLifecycleListener.java 11 Sep 2002 14:19:33 -0000 1.32
+++ ServerLifecycleListener.java 13 Sep 2002 01:35:22 -0000 1.33
@@ -948,6 +948,44 @@
/**
+ * Deregister the MBeans for the specified DefaultContext and its nested
+ * components.
+ *
+ * @param dcontext DefaultContext for which to deregister MBeans
+ *
+ * @exception Exception if an exception is thrown during MBean destruction
+ */
+ protected void destroyMBeans(DefaultContext dcontext) throws Exception {
+
+ Manager dManager = dcontext.getManager();
+ if (dManager != null) {
+ if (debug >= 4)
+ log("Destroying MBean for Manager " + dManager);
+ MBeanUtils.destroyMBean(dManager);
+ }
+
+ Loader dLoader = dcontext.getLoader();
+ if (dLoader != null) {
+ if (debug >= 4)
+ log("Destroying MBean for Loader " + dLoader);
+ MBeanUtils.destroyMBean(dLoader);
+ }
+
+ // Destroy the MBeans for the NamingResources (if any)
+ NamingResources resources = dcontext.getNamingResources();
+ if (resources != null) {
+ destroyMBeans(resources);
+ }
+
+ // deregister the MBean for the DefaultContext itself
+ if (debug >= 4)
+ log("Destroying MBean for Context " + dcontext);
+ MBeanUtils.destroyMBean(dcontext);
+
+ }
+
+
+ /**
* Deregister the MBeans for the specified Engine and its nested
* components.
*
@@ -1138,7 +1176,7 @@
*
* @param service Service for which to destroy MBeans
*
-o * @exception Exception if an exception is thrown during MBean destruction
+ * @exception Exception if an exception is thrown during MBean destruction
*/
protected void destroyMBeans(Service service) throws Exception {
@@ -1275,13 +1313,13 @@
if (debug >= 5) {
log("Removing MBean for DefaultContext " + oldValue);
}
- MBeanUtils.destroyMBean((DefaultContext) oldValue);
+ destroyMBeans((DefaultContext) oldValue);
}
if (newValue != null) {
if (debug >= 5) {
log("Creating MBean for DefaultContext " + newValue);
}
- MBeanUtils.createMBean((DefaultContext) newValue);
+ createMBeans((DefaultContext) newValue);
}
} else if ("loader".equals(propertyName)) {
if (oldValue != null) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>