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.resource.Resource; 36 import com.sun.enterprise.resource.ResourcesXMLParser; 37 import com.sun.enterprise.util.i18n.StringManager; 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 PreResCreationPhase extends ResourcePhase { 49 50 51 public static final Logger sLogger = DeploymentLogger.get(); 52 53 54 private static StringManager localStrings = 55 StringManager.getManager(PreResCreationPhase.class); 56 57 61 public PreResCreationPhase(DeploymentContext deploymentCtx) 62 { 63 this.deploymentCtx = deploymentCtx; 64 this.name = PRE_RES_CREATION; 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.WARNING); 87 if (e.getCause()!=null) { 88 phaseCtx.getDeploymentStatus().setStageStatusMessage(e.getCause().getMessage()); 89 } 90 } 91 } 92 93 98 private DeploymentEvent getPrePhaseEvent(DeploymentRequest req) 99 { 100 return new DeploymentEvent(DeploymentEventType.PRE_RES_CREATE, new DeploymentEventInfo(req)); 101 } 102 103 107 private DeploymentEvent getPostPhaseEvent(DeploymentRequest req) { 108 return new DeploymentEvent(DeploymentEventType.POST_RES_CREATE, new DeploymentEventInfo(req)); 109 } 110 111 public void handleRedeployment(List <String > targetList, 113 List <Resource> resourceList) throws Exception { 114 handleDeployment(targetList, resourceList); 115 } 116 117 public boolean getForceParsing(String resAction) { 118 return resAction.equals(DeploymentProperties.RES_REDEPLOYMENT); 119 } 120 121 public List <Resource> getRelevantResources(List <Resource> allResources) { 122 return ResourcesXMLParser.getNonConnectorResourcesList(allResources, true); 123 } 124 } 125 | Popular Tags |