1 22 package org.objectweb.petals.jbi.management.deployment.undeploy; 23 24 import java.util.HashMap ; 25 26 import org.objectweb.petals.jbi.component.lifecycle.ServiceAssemblyLifeCycle; 27 import org.objectweb.petals.jbi.management.deployment.DeploymentContextConstants; 28 import org.objectweb.petals.jbi.management.deployment.ServiceAssemblyDataHandler; 29 import org.objectweb.petals.jbi.management.service.LifeCycleManagerService; 30 import org.objectweb.petals.processor.Task; 31 import org.objectweb.petals.util.LoggingUtil; 32 33 39 public class SALifeCycleRetrievalTask implements Task { 40 41 44 protected LifeCycleManagerService managerService; 45 46 49 protected LoggingUtil log; 50 51 public SALifeCycleRetrievalTask(LifeCycleManagerService managerService, 52 LoggingUtil log) { 53 super(); 54 this.managerService = managerService; 55 this.log = log; 56 } 57 58 @SuppressWarnings ("unchecked") 59 public void execute(HashMap context) throws Exception { 60 ServiceAssemblyDataHandler handler = (ServiceAssemblyDataHandler) context 61 .get(DeploymentContextConstants.SA_DATA_HANDLER); 62 63 ServiceAssemblyLifeCycle saLifeCycle = retrieveServiceAssemblyLifeCycle(handler 64 .getName()); 65 66 69 context.put(DeploymentContextConstants.SA_LIFECYCLE, saLifeCycle); 70 71 } 72 73 83 protected ServiceAssemblyLifeCycle retrieveServiceAssemblyLifeCycle( 84 String saName) throws Exception { 85 ServiceAssemblyLifeCycle saLifeCycle = managerService 86 .getServiceAssemblyByName(saName); 87 if (saLifeCycle == null) { 88 String msg = "The service assembly (" + saName 89 + ") isn't deployed into the JBI environment."; 90 log.error(msg); 91 throw new Exception (msg); 92 } 93 return saLifeCycle; 94 } 95 96 public void undo(HashMap context) throws Exception { 97 99 } 100 101 } 102 | Popular Tags |