DeployedApplication app = deployed.get(name);
if (app == null) {
return 0L;
- } else {
- return app.timestamp;
}
+
+ return app.timestamp;
}
DeployedApplication app = deployed.get(name);
if (app == null) {
return false;
- } else {
- return true;
}
+
+ return true;
}
ostream = null;
istream.close();
istream = null;
- entry = null;
- jar.close();
- jar = null;
}
} catch (Exception e) {
// Ignore and continue
// Deploy the application in this WAR file
if(log.isInfoEnabled())
- log.info(sm.getString("hostConfig.deployJar", file));
+ log.info(sm.getString("hostConfig.deployWar", file));
try {
Context context = null;
}
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
new Long(docBase.lastModified()));
- addWatchedResources(deployedApp, docBase.getAbsolutePath(), context);
+ addWatchedResources(deployedApp, docBase.getAbsolutePath(),
+ context);
} else {
addWatchedResources(deployedApp, null, context);
}
} catch (Throwable t) {
- log.error(sm.getString("hostConfig.deployJar.error", file), t);
+ log.error(sm.getString("hostConfig.deployWar.error", file), t);
}
deployed.put(contextPath, deployedApp);
try {
context = (Context) digester.parse(xml);
if (context == null) {
- log.error(sm.getString("hostConfig.deployDescriptor.error",
+ log.error(sm.getString(
+ "hostConfig.deployDescriptor.error",
xml));
return;
}
* @param contextPath of the context which will be checked
*/
protected boolean deploymentExists(String contextPath) {
- return (deployed.containsKey(contextPath) || (host.findChild(contextPath) != null));
+ return (deployed.containsKey(contextPath) ||
+ (host.findChild(contextPath) != null));
}
* @param docBase web app docBase
* @param context web application context
*/
- protected void addWatchedResources(DeployedApplication app, String docBase, Context context) {
- // FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*, WEB-INF/*.xml), where
- // we would only check if at least one resource is newer than app.timestamp
+ protected void addWatchedResources(DeployedApplication app, String docBase,
+ Context context) {
+ // FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*,
+ // WEB-INF/*.xml), where we would only check if at least one
+ // resource is newer than app.timestamp
File docBaseFile = null;
if (docBase != null) {
docBaseFile = new File(docBase);
resource = new File(docBaseFile, watchedResources[i]);
} else {
if(log.isDebugEnabled())
- log.debug("Ignoring non-existent WatchedResource '" + resource.getAbsolutePath() + "'");
+ log.debug("Ignoring non-existent WatchedResource '" +
+ resource.getAbsolutePath() + "'");
continue;
}
}
if(log.isDebugEnabled())
- log.debug("Watching WatchedResource '" + resource.getAbsolutePath() + "'");
+ log.debug("Watching WatchedResource '" +
+ resource.getAbsolutePath() + "'");
app.reloadResources.put(resource.getAbsolutePath(),
new Long(resource.lastModified()));
}
for (int i = 0; i < resources.length; i++) {
File resource = new File(resources[i]);
if (log.isDebugEnabled())
- log.debug("Checking context[" + app.name + "] redeploy resource " + resource);
+ log.debug("Checking context[" + app.name +
+ "] redeploy resource " + resource);
if (resource.exists()) {
long lastModified =
app.redeployResources.get(resources[i]).longValue();
- if ((!resource.isDirectory()) && resource.lastModified() > lastModified) {
+ if ((!resource.isDirectory()) &&
+ resource.lastModified() > lastModified) {
// Undeploy application
if (log.isInfoEnabled())
log.info(sm.getString("hostConfig.undeploy", app.name));
- ContainerBase context = (ContainerBase) host.findChild(app.name);
+ ContainerBase context =
+ (ContainerBase) host.findChild(app.name);
try {
host.removeChild(context);
} catch (Throwable t) {
try {
File current = new File(resources[j]);
current = current.getCanonicalFile();
- if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
- || (current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
+ if ((current.getAbsolutePath().startsWith(
+ appBase().getAbsolutePath() +
+ File.separator))
+ || (current.getAbsolutePath().startsWith(
+ configBase().getAbsolutePath()))) {
if (log.isDebugEnabled())
log.debug("Delete " + current);
ExpandWar.delete(current);
// Undeploy application
if (log.isInfoEnabled())
log.info(sm.getString("hostConfig.undeploy", app.name));
- ContainerBase context = (ContainerBase) host.findChild(app.name);
+ ContainerBase context =
+ (ContainerBase) host.findChild(app.name);
try {
host.removeChild(context);
} catch (Throwable t) {
try {
File current = new File(resources[j]);
current = current.getCanonicalFile();
- if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
- || (current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
+ if ((current.getAbsolutePath().startsWith(
+ appBase().getAbsolutePath() + File.separator))
+ || (current.getAbsolutePath().startsWith(
+ configBase().getAbsolutePath()))) {
if (log.isDebugEnabled())
log.debug("Delete " + current);
ExpandWar.delete(current);
("hostConfig.canonicalizing", app.name), e);
}
}
- // Delete reload resources as well (to remove any remaining .xml descriptor)
+ // Delete reload resources as well (to remove any remaining .xml
+ // descriptor)
String[] resources2 =
app.reloadResources.keySet().toArray(new String[0]);
for (int j = 0; j < resources2.length; j++) {
try {
File current = new File(resources2[j]);
current = current.getCanonicalFile();
- if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
- || ((current.getAbsolutePath().startsWith(configBase().getAbsolutePath())
+ if ((current.getAbsolutePath().startsWith(
+ appBase().getAbsolutePath() + File.separator))
+ || ((current.getAbsolutePath().startsWith(
+ configBase().getAbsolutePath())
&& (current.getAbsolutePath().endsWith(".xml"))))) {
if (log.isDebugEnabled())
log.debug("Delete " + current);
for (int i = 0; i < resources.length; i++) {
File resource = new File(resources[i]);
if (log.isDebugEnabled())
- log.debug("Checking context[" + app.name + "] reload resource " + resource);
- long lastModified = app.reloadResources.get(resources[i]).longValue();
+ log.debug("Checking context[" + app.name +
+ "] reload resource " + resource);
+ long lastModified =
+ app.reloadResources.get(resources[i]).longValue();
if ((!resource.exists() && lastModified != 0L)
|| (resource.lastModified() != lastModified)) {
// Reload application
("hostConfig.context.restart", app.name), e);
}
// Update times
- app.reloadResources.put(resources[i], new Long(resource.lastModified()));
+ app.reloadResources.put(resources[i],
+ new Long(resource.lastModified()));
app.timestamp = System.currentTimeMillis();
return;
}