1 23 24 package com.sun.enterprise.deployment.phasing; 25 26 import com.sun.enterprise.deployment.backend.DeploymentStatus; 27 import com.sun.enterprise.deployment.backend.DeploymentRequest; 28 import com.sun.enterprise.deployment.backend.DeploymentLogger; 29 import com.sun.enterprise.deployment.backend.DeploymentEventInfo; 30 import com.sun.enterprise.deployment.backend.DeploymentEvent; 31 import com.sun.enterprise.deployment.backend.DeploymentEventType; 32 import com.sun.enterprise.deployment.backend.IASDeploymentException; 33 import com.sun.enterprise.deployment.util.DeploymentProperties; 34 35 import com.sun.enterprise.util.i18n.StringManager; 36 import com.sun.enterprise.resource.Resource; 37 import com.sun.enterprise.resource.ResourcesXMLParser; 38 39 import java.util.List ; 40 import java.util.ArrayList ; 41 import java.util.logging.Level ; 42 import java.util.logging.Logger ; 43 44 48 public class PostResDeletionPhase extends ResourcePhase { 49 50 51 public static final Logger sLogger = DeploymentLogger.get(); 52 53 54 private static StringManager localStrings = 55 StringManager.getManager(PostResDeletionPhase.class); 56 57 61 public PostResDeletionPhase(DeploymentContext deploymentCtx) 62 { 63 this.deploymentCtx = deploymentCtx; 64 this.name = POST_RES_DELETION; 65 } 66 67 74 public void runPhase(DeploymentPhaseContext phaseCtx) 75 { 76 try { 77 DeploymentRequest req = phaseCtx.getDeploymentRequest(); 78 79 prePhaseNotify(getPrePhaseEvent(req)); 80 doResourceOperation(req); 81 postPhaseNotify(getPostPhaseEvent(req)); 82 83 phaseCtx.getDeploymentStatus().setStageStatus(DeploymentStatus.SUCCESS); 84 } catch(Exception e) { 85 phaseCtx.getDeploymentStatus().setStageStatus(DeploymentStatus.FAILURE); 87 if (e.getCause()!=null) { 88 phaseCtx.getDeploymentStatus().setStageException(e.getCause()); 89 phaseCtx.getDeploymentStatus().setStageStatusMessage(e.getCause().getMessage()); 90 } 91 } 92 } 93 94 99 private DeploymentEvent getPrePhaseEvent(DeploymentRequest req) 100 { 101 return new DeploymentEvent(DeploymentEventType.PRE_RES_DELETE, new DeploymentEventInfo(req)); 102 } 103 104 108 private DeploymentEvent getPostPhaseEvent(DeploymentRequest req) { 109 return new DeploymentEvent(DeploymentEventType.POST_RES_DELETE, new DeploymentEventInfo(req)); 110 } 111 112 public void handleRedeployment(List <String > targetList, 114 List <Resource> resourceList) throws Exception { 115 handleUndeployment(targetList, resourceList); 116 } 117 118 public void handleDeployment(List <String > targetList, 120 List <Resource> resourceList) throws Exception { 121 } 122 123 public String getActualAction(String resAction) { 124 if (resAction.equals(DeploymentProperties.RES_DEPLOYMENT)) { 125 return DeploymentProperties.RES_NO_OP; 126 } else { 127 return resAction; 128 } 129 } 130 131 public List <Resource> getRelevantResources(List <Resource> allResources) { 132 return ResourcesXMLParser.getNonConnectorResourcesList(allResources, false); 133 } 134 } 135 | Popular Tags |