* if <i>preserveResources</i> flag is set, cache the <resources>
* config for persisting it in domain.xml
*/
public void event(Event event) {
if (event.is(Deployment.DEPLOYMENT_BEFORE_CLASSLOADER_CREATION)) {
DeploymentContext dc = (DeploymentContext) event.hook();
final DeployCommandParameters deployParams = dc.getCommandParameters(DeployCommandParameters.class);
processResources(dc, deployParams);
}else if(event.is(Deployment.UNDEPLOYMENT_VALIDATION)){
DeploymentContext dc = (DeploymentContext) event.hook();
final UndeployCommandParameters undeployCommandParameters =
dc.getCommandParameters(UndeployCommandParameters.class);
preserveResources(dc, undeployCommandParameters);
}else if(Deployment.UNDEPLOYMENT_FAILURE.equals(event.type())){
DeploymentContext dc = (DeploymentContext) event.hook();
cleanupPreservedResources(dc, event);
}else if(Deployment.DEPLOYMENT_FAILURE.equals(event.type())){
DeploymentContext dc = (DeploymentContext) event.hook();
String appName = getAppNameFromDeployCmdParams(dc);
cleanupResources(appName, dc.getCommandParameters(DeployCommandParameters.class).origin);
//TODO ASR call this only when the flag is on ? --properties preserveAppScopedResources=true
cleanupPreservedResources(dc, event);
}else if(Deployment.DEPLOYMENT_SUCCESS.equals(event.type())){
ApplicationInfo applicationInfo = (ApplicationInfo) event.hook();
String appName = applicationInfo.getName();