use of org.apache.catalina.util.ContextName in project tomcat by apache.
the class FarmWarDeployer method fileModified.
/**
* Modification from watchDir war detected!
*
* @see org.apache.catalina.ha.deploy.FileChangeListener#fileModified(File)
*/
@Override
public void fileModified(File newWar) {
try {
File deployWar = new File(getDeployDirFile(), newWar.getName());
ContextName cn = new ContextName(deployWar.getName(), true);
if (deployWar.exists() && deployWar.lastModified() > newWar.lastModified()) {
if (log.isInfoEnabled())
log.info(sm.getString("farmWarDeployer.alreadyDeployed", cn.getName()));
return;
}
if (log.isInfoEnabled())
log.info(sm.getString("farmWarDeployer.modInstall", cn.getName(), deployWar.getAbsolutePath()));
// install local
if (!isServiced(cn.getName())) {
addServiced(cn.getName());
try {
copy(newWar, deployWar);
check(cn.getName());
} finally {
removeServiced(cn.getName());
}
} else {
log.error(sm.getString("farmWarDeployer.servicingDeploy", cn.getName(), deployWar.getName()));
}
install(cn.getName(), deployWar);
} catch (Exception x) {
log.error(sm.getString("farmWarDeployer.modInstallFail"), x);
}
}
use of org.apache.catalina.util.ContextName in project tomcat by apache.
the class FarmWarDeployer method fileRemoved.
/**
* War remove from watchDir
*
* @see org.apache.catalina.ha.deploy.FileChangeListener#fileRemoved(File)
*/
@Override
public void fileRemoved(File removeWar) {
try {
ContextName cn = new ContextName(removeWar.getName(), true);
if (log.isInfoEnabled())
log.info(sm.getString("farmWarDeployer.removeLocal", cn.getName()));
remove(cn.getName(), true);
} catch (Exception x) {
log.error(sm.getString("farmWarDeployer.removeLocalFail"), x);
}
}
use of org.apache.catalina.util.ContextName in project tomee by apache.
the class WebappDeployer method checkWebapp.
private void checkWebapp(final String webappName) {
try {
final ContextName cn = new ContextName(webappName, true);
final String name = "Catalina:type=Deployer,host=localhost";
final ObjectName oname = new ObjectName(name);
final String[] params = { cn.getName() };
final String[] signature = { "java.lang.String" };
mBeanServer.invoke(oname, "check", params, signature);
} catch (Exception e) {
//Ignore
}
}
Aggregations