public void undeploy(DeploymentUnit du) {
if (du instanceof VFSDeploymentUnit &&
(du.getSimpleName().equals(BPELDeploymentUnit.DEPLOY_XML) ||
du.getSimpleName().equals(BPELDeploymentUnit.BPEL_DEPLOY_XML))) {
DeploymentUnit top=du;
if (top.isTopLevel() == false) {
top = du.getTopLevel();
}
logger.info("Undeploy: "+top.getSimpleName()+" relativePath="+
du.getRelativePath());
try {
BPELDeploymentUnit prev=m_deploymentUnits.get(top.getSimpleName());
// Undeploy if deployment unit no longer exists on the filesystem, OR
// the last modified time of the cached deployment unit is older than
// the last modified time of the current deployment unit, signifying
// it has been updated and therefore must be undeployed first
if (top instanceof VFSDeploymentUnit &&
(((VFSDeploymentUnit)top).getRoot().exists() == false ||
(prev != null && prev.getLastModified() <
((VFSDeploymentUnit)top).getRoot().getLastModified()))) {
// TODO: Unique name - see deploy
BPELDeploymentUnit unit=new BPELDeploymentUnit(top.getSimpleName(), 0);
// NOTE: File required to provide path for use in ODE
// process store impl. When this is replaced, this information
// will not be required.
java.io.File ddfile=new java.io.File(((VFSDeploymentUnit)du).getRoot().toURL().getFile());
unit.setDeploymentDescriptor(ddfile);
synchronized(m_deploymentUnits) {
m_deploymentUnits.remove(unit.getName());
if (m_listener != null) {
m_listener.undeploy(unit);
}
}
} else {
logger.info("Not undeploying BPEL: "+top.getSimpleName()+" relativePath="+
du.getRelativePath());
}
} catch(Exception e) {
logger.error("Failed to undeploy '"+du+"'", e);
}