ResourcePhasepublic abstract class ResourcePhase extends DeploymentPhase This class is the base class for resource phases |
Fields Summary |
---|
protected static final String | resourcesMBeanName | protected static final String | CREATE_RESOURCE | protected static final String | CREATE_RESOURCE_REF | protected static final String | CREATE_RESOURCE_AND_REF | protected static final String | DELETE_RESOURCE | protected static final String | DELETE_RESOURCE_REF | protected static final String | DELETE_RESOURCE_AND_REF | protected static final String | DOMAIN_TARGET | protected MBeanServer | mbs | private static final Logger | sLoggerDeployment Logger object for this class |
Methods Summary |
---|
protected void | doResourceOperation(com.sun.enterprise.deployment.backend.DeploymentRequest req)
String targetListString = req.getResourceTargetList();
List<String> targetList = DeploymentServiceUtils.getTargetNamesFromTargetString(targetListString);
String resourceAction = req.getResourceAction();
if (resourceAction == null ||
getActualAction(resourceAction).equals(
DeploymentProperties.RES_NO_OP)) {
return;
}
if (targetList == null || targetList.isEmpty()) {
return;
}
List<Resource> resourceList = DeploymentServiceUtils.getResourceList(
req, getForceParsing(resourceAction), deploymentCtx);
// empty resource list, no resource to process
if (resourceList.size() == 0) {
return;
}
handleResources(resourceAction, targetList,
getRelevantResources(resourceList));
| protected java.lang.String | getActualAction(java.lang.String resAction)
return resAction;
| protected boolean | getForceParsing(java.lang.String resAction)
return false;
| protected abstract java.util.List | getRelevantResources(java.util.List allResources)
| protected void | handleCreateApplicationRef(java.util.List targetList, java.util.List resourceList)
ObjectName mbeanName = new ObjectName(resourcesMBeanName);
String[] signature = new String[]{
"java.util.List", "java.util.List", "java.lang.Boolean"};
Object[] params = new Object[]{resourceList, targetList,
Boolean.TRUE};
mbs.invoke(mbeanName, CREATE_RESOURCE_REF, params, signature);
| protected void | handleDeleteApplicationRef(java.util.List targetList, java.util.List resourceList)
ObjectName mbeanName = new ObjectName(resourcesMBeanName);
String[] signature = new String[]{
"java.util.List", "java.util.List"};
Object[] params = new Object[]{resourceList, targetList};
mbs.invoke(mbeanName, DELETE_RESOURCE_REF, params, signature);
| protected void | handleDeployment(java.util.List targetList, java.util.List resourceList)
ObjectName mbeanName = new ObjectName(resourcesMBeanName);
// if target is domain, only create resource
if (targetList.size() == 1 &&
targetList.get(0).equals(DOMAIN_TARGET)) {
String[] signature = new String[]{
"java.util.List", "java.lang.Boolean"};
Object[] params = new Object[]{resourceList, Boolean.TRUE};
mbs.invoke(mbeanName, CREATE_RESOURCE, params, signature);
} else {
String[] signature = new String[]{
"java.util.List", "java.util.List", "java.lang.Boolean"};
Object[] params = new Object[]{resourceList, targetList,
Boolean.TRUE};
mbs.invoke(mbeanName, CREATE_RESOURCE_AND_REF, params, signature);
}
| protected abstract void | handleRedeployment(java.util.List targetList, java.util.List resourceList)
| protected void | handleResources(java.lang.String resourceAction, java.util.List targetList, java.util.List resourceList)
// empty sub resource list, no resource to process
if (resourceList.size() == 0) {
return;
}
if (resourceAction.equals(DeploymentProperties.RES_DEPLOYMENT)) {
handleDeployment(targetList, resourceList);
} else if (resourceAction.equals(DeploymentProperties.RES_CREATE_REF)){
handleCreateApplicationRef(targetList, resourceList);
} else if (resourceAction.equals(DeploymentProperties.RES_DELETE_REF)){
handleDeleteApplicationRef(targetList, resourceList);
} else if (resourceAction.equals(
DeploymentProperties.RES_UNDEPLOYMENT)){
handleUndeployment(targetList, resourceList);
} else if (resourceAction.equals(
DeploymentProperties.RES_REDEPLOYMENT)){
handleRedeployment(targetList, resourceList);
}
// flush the config and send the events here
DeploymentServiceUtils.flushConfigAndSendEvents();
| protected void | handleUndeployment(java.util.List targetList, java.util.List resourceList)
try {
ObjectName mbeanName = new ObjectName(resourcesMBeanName);
// if target is domain, only delete resource
if (targetList.size() == 1 &&
targetList.get(0).equals(DOMAIN_TARGET)) {
String[] signature = new String[]{"java.util.List"};
Object[] params = new Object[]{resourceList};
mbs.invoke(mbeanName,DELETE_RESOURCE, params, signature);
} else {
String[] signature = new String[]{
"java.util.List", "java.util.List"};
Object[] params = new Object[]{resourceList, targetList};
mbs.invoke(mbeanName, DELETE_RESOURCE_AND_REF, params, signature);
}
} catch (Exception e) {
// we will just log the exception as warning message and will not
// fail undeployment
sLogger.log(Level.WARNING, e.getMessage(), e);
}
|
|