1 22 package org.objectweb.petals.jbi.management.deployment.deploy; 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.DeploymentUtils; 29 import org.objectweb.petals.jbi.management.service.LifeCycleManagerService; 30 import org.objectweb.petals.jbi.management.service.ManagementException; 31 import org.objectweb.petals.processor.Task; 32 import org.objectweb.petals.tools.jbicommon.descriptor.JBIDescriptor; 33 import org.objectweb.petals.util.LoggingUtil; 34 35 41 public class SALifeCycleRegistrationTask implements Task { 42 43 46 protected LifeCycleManagerService managerService; 47 48 51 protected LoggingUtil log; 52 53 public SALifeCycleRegistrationTask(LifeCycleManagerService managerService, 54 LoggingUtil log) { 55 super(); 56 this.managerService = managerService; 57 this.log = log; 58 } 59 60 public void execute(HashMap context) throws Exception { 61 JBIDescriptor descriptor = (JBIDescriptor) context 62 .get(DeploymentContextConstants.SA_DESCRIPTOR); 63 64 ServiceAssemblyLifeCycle lifeCycle = (ServiceAssemblyLifeCycle) context 65 .get(DeploymentContextConstants.SA_LIFECYCLE); 66 67 managerService.registerServiceAssembly(DeploymentUtils 68 .getServiceAssemblyName(descriptor), lifeCycle); 69 70 } 71 72 public void undo(HashMap context) { 73 JBIDescriptor descriptor = (JBIDescriptor) context 74 .get(DeploymentContextConstants.SA_DESCRIPTOR); 75 76 try { 77 managerService.unregisterServiceAssembly(DeploymentUtils 78 .getServiceAssemblyName(descriptor)); 79 } catch (ManagementException e) { 80 String msg = "Failed to revert a SALifeCycleRegistrationTask"; 81 log.error(msg, e); 82 } 83 } 84 85 } 86 | Popular Tags |