// Deploy XML descriptors from configBase
File xml = new File(configBase, baseName + ".xml");
if (xml.exists())
- deployDescriptor(cn, xml, baseName + ".xml");
+ deployDescriptor(cn, xml);
// Deploy WARs, and loop if additional descriptors are found
File war = new File(appBase, baseName + ".war");
if (war.exists())
- deployWAR(cn, war, baseName + ".war");
+ deployWAR(cn, war);
// Deploy expanded folders
File dir = new File(appBase, baseName);
if (dir.exists())
- deployDirectory(cn, dir, baseName);
-
+ deployDirectory(cn, dir);
}
if (isServiced(name))
continue;
- String file = files[i];
-
- deployDescriptor(cn, contextXml, file);
+ deployDescriptor(cn, contextXml);
}
}
}
/**
* @param cn
* @param contextXml
- * @param file
*/
- protected void deployDescriptor(ContextName cn, File contextXml, String file) {
+ protected void deployDescriptor(ContextName cn, File contextXml) {
if (deploymentExists(cn.getName())) {
return;
}
// Assume this is a configuration descriptor and deploy it
if(log.isInfoEnabled()) {
- log.info(sm.getString("hostConfig.deployDescriptor", file,
- configBase.getPath()));
+ log.info(sm.getString("hostConfig.deployDescriptor",
+ contextXml.getAbsolutePath()));
}
Context context = null;
try {
context = (Context) digester.parse(contextXml);
if (context == null) {
- log.error(sm.getString("hostConfig.deployDescriptor.error",
- file));
+ log.error(sm.getString(
+ "hostConfig.deployDescriptor.error",
+ contextXml.getAbsolutePath()));
return;
}
} finally {
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("hostConfig.deployDescriptor.error",
- file), t);
+ contextXml.getAbsolutePath()), t);
}
if (context != null && host.findChild(context.getName()) != null) {
if (isServiced(cn.getName()))
continue;
- deployWAR(cn, dir, files[i]);
+ deployWAR(cn, dir);
}
}
}
/**
* @param cn
* @param war
- * @param file
*/
- protected void deployWAR(ContextName cn, File war, String file) {
+ protected void deployWAR(ContextName cn, File war) {
if (deploymentExists(cn.getName()))
return;
BufferedOutputStream ostream = null;
File xml;
if (copyXML) {
- xml = new File(configBase(),
- file.substring(0, file.lastIndexOf(".")) + ".xml");
+ xml = new File(configBase(), cn.getBaseName() + ".xml");
} else {
xml = new File(host.getAppBaseFile(),
- file.substring(0, file.lastIndexOf(".")) +
- "/META-INF/context.xml");
+ cn.getBaseName() + "/META-INF/context.xml");
}
boolean xmlInWar = false;
// Deploy the application in this WAR file
if(log.isInfoEnabled())
- log.info(sm.getString("hostConfig.deployWar", file));
+ log.info(sm.getString("hostConfig.deployWar",
+ war.getAbsolutePath()));
try {
Context context = null;
try {
context = (Context) digester.parse(xml);
if (context == null) {
- log.error(sm.getString("hostConfig.deployDescriptor.error",
- file));
+ log.error(sm.getString(
+ "hostConfig.deployDescriptor.error",
+ war.getAbsolutePath()));
return;
}
} finally {
if (context == null) {
log.error(sm.getString(
"hostConfig.deployDescriptor.error",
- file));
+ war.getAbsolutePath()));
return;
}
context.setConfigFile(new URL("jar:" +
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());
- context.setDocBase(file);
+ context.setDocBase(cn.getBaseName() + ".war");
host.addChild(context);
// If we're unpacking WARs, the docBase will be mutated after
// starting the context
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error(sm.getString("hostConfig.deployWar.error", file), t);
+ log.error(sm.getString("hostConfig.deployWar.error",
+ war.getAbsolutePath()), t);
}
deployed.put(cn.getName(), deployedApp);
if (isServiced(cn.getName()))
continue;
- deployDirectory(cn, dir, files[i]);
+ deployDirectory(cn, dir);
}
}
}
/**
* @param cn
* @param dir
- * @param file
*/
- protected void deployDirectory(ContextName cn, File dir, String file) {
+ protected void deployDirectory(ContextName cn, File dir) {
if (deploymentExists(cn.getName()))
return;
// Deploy the application in this directory
if( log.isInfoEnabled() )
- log.info(sm.getString("hostConfig.deployDir", file));
+ log.info(sm.getString("hostConfig.deployDir",
+ dir.getAbsolutePath()));
try {
Context context = null;
File xml = new File(dir, Constants.ApplicationContextXml);
}
}
if (copyXML) {
- xmlCopy = new File(configBase(), file + ".xml");
+ xmlCopy = new File(configBase(), cn.getBaseName() + ".xml");
InputStream is = null;
OutputStream os = null;
try {
context.setName(cn.getName());
context.setPath(cn.getPath());
context.setWebappVersion(cn.getVersion());
- context.setDocBase(file);
+ context.setDocBase(cn.getBaseName());
host.addChild(context);
deployedApp.redeployResources.put(dir.getAbsolutePath(),
Long.valueOf(dir.lastModified()));
addWatchedResources(deployedApp, dir.getAbsolutePath(), context);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error(sm.getString("hostConfig.deployDir.error", file), t);
+ log.error(sm.getString("hostConfig.deployDir.error",
+ dir.getAbsolutePath()), t);
}
deployed.put(cn.getName(), deployedApp);