remm2004/07/27 00:17:21
Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java mbeans-descriptors.xml
catalina/src/share/org/apache/catalina Container.java
Log:
- Modify HostConfig for use in the manager servlet, as planned.
- Add JMX registration for this component.
- Still some tweak are needed for handling undeploying (one quick example which
causes problems right now is
trying to undeploy the admin webapp).
Revision ChangesPath
1.38 +340 -214
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
Index: HostConfig.java
===
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- HostConfig.java 26 Jul 2004 10:56:53 - 1.37
+++ HostConfig.java 27 Jul 2004 07:17:21 - 1.38
@@ -28,6 +28,8 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import javax.management.ObjectName;
+
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
@@ -38,6 +40,7 @@
import org.apache.catalina.core.ContainerBase;
import org.apache.catalina.core.StandardHost;
import org.apache.catalina.util.StringManager;
+import org.apache.commons.modeler.Registry;
import org.apache.tomcat.util.digester.Digester;
@@ -88,6 +91,12 @@
*/
protected Host host = null;
+
+/**
+ * The JMX ObjectName of this component.
+ */
+protected ObjectName oname = null;
+
/**
* The string resources for this package.
@@ -415,6 +424,34 @@
/**
+ * Given a context path, get the config file name.
+ */
+protected String getConfigFile(String path) {
+String basename = null;
+if (path.equals()) {
+basename = ROOT;
+} else {
+basename = path.substring(1).replace('/', '#');
+}
+return (basename);
+}
+
+
+/**
+ * Given a context path, get the config file name.
+ */
+protected String getDocBase(String path) {
+String basename = null;
+if (path.equals()) {
+basename = ROOT;
+} else {
+basename = path.substring(1);
+}
+return (basename);
+}
+
+
+/**
* Deploy applications for any directories or WAR files that are found
* in our application root directory.
*/
@@ -433,6 +470,33 @@
/**
+ * Deploy applications for any directories or WAR files that are found
+ * in our application root directory.
+ */
+protected void deployApps(String name) {
+
+File appBase = appBase();
+File configBase = configBase();
+String baseName = getConfigFile(name);
+String docBase = getConfigFile(name);
+
+// Deploy XML descriptors from configBase
+File xml = new File(configBase, baseName + .xml);
+if (xml.exists())
+deployDescriptor(name, xml, baseName + .xml);
+// Deploy WARs, and loop if additional descriptors are found
+File war = new File(appBase, docBase + .war);
+if (war.exists())
+deployWAR(name, war, docBase + .war);
+// Deploy expanded folders
+File dir = new File(appBase, docBase);
+if (dir.exists())
+deployDirectory(name, dir, docBase);
+
+}
+
+
+/**
* Deploy XML context descriptors.
*/
protected void deployDescriptors(File configBase, String[] files) {
@@ -450,78 +514,18 @@
if (files[i].toLowerCase().endsWith(.xml)) {
// Calculate the context path and make sure it is unique
-String file = files[i].substring(0, files[i].length() - 4);
-String contextPath = / + file.replace('#', '/');
-if (file.equals(ROOT)) {
+String nameTmp = files[i].substring(0, files[i].length() - 4);
+String contextPath = / + nameTmp.replace('#', '/');
+if (nameTmp.equals(ROOT)) {
contextPath = ;
}
-if (deployed.containsKey(contextPath))
+if (isServiced(contextPath))
continue;
-
-DeployedApplication deployedApp = new
DeployedApplication(contextPath);
-// Assume this is a configuration descriptor and deploy it
-log.debug(sm.getString(hostConfig.deployDescriptor, files[i]));
-try {
-