if ((conf == null) && (event.getPath() != null))
{
Iterator registrationsIter = registry.getRegistry().iterator();
while ((conf == null) && registrationsIter.hasNext())
{
Entry entry = (Entry)registrationsIter.next();
String deploymentObjectPath = (String) entry.getAttribute(DEPLOYMENT_OBJECT_PATH_ATTR);
if (event.getPath().equals(deploymentObjectPath))
{
conf = (PropertiesConfiguration) entry.getAttribute(DEPLOYMENT_CONFIGURATION_ATTR);
}
}
}
// silently return if configuration not available, (assumes
// probably not a decorator)
if (conf == null)
{
return;
}
// process decorator by id
String id = conf.getString("id");
if (id != null)
{
log.info("Found decorator deployment configuration " + id);
try
{
// find and construct decorator deploy path
String baseDeployPath = getBaseDeployPath(conf);
String deployPath = baseDeployPath + File.separator + id;
// undeploy decorator
File deployPathFile = new File(deployPath);
if (deployPathFile.exists())
{
log.info("Undeploying decorator " + id + " at " + deployPath);
DirectoryHelper cleanup = new DirectoryHelper(deployPathFile);
cleanup.remove();
cleanup.close();
}
// detect language/country localized decorator components
final List localeSpecificDeployPathsList = getLocaleSpecificDeployPaths(new File(baseDeployPath));
// undeploy individual locale specific decorator components
Iterator deployPathsIter = localeSpecificDeployPathsList.iterator();
while (deployPathsIter.hasNext())
{
File localeDeployPathFile = new File((File) deployPathsIter.next(), id);
if (localeDeployPathFile.exists())
{
log.info("Undeploying decorator " + id + " at " + localeDeployPathFile.getPath());
DirectoryHelper cleanup = new DirectoryHelper(localeDeployPathFile);
cleanup.remove();
cleanup.close();
localeDeployPathFile.getParentFile().delete();
}
}
// deregister
Entry entry = new Entry();
entry.setId(id);
registry.deRegister(entry);
log.info("Deregistering decorator " + id);
log.info("Decorator " + id + " undeployed and deregistered successfuly.");
}