1 22 package org.objectweb.petals.jbi.management.deployment.undeploy; 23 24 import java.util.HashMap ; 25 import java.util.List ; 26 27 import javax.xml.namespace.QName ; 28 29 import org.objectweb.petals.jbi.component.lifecycle.ServiceAssemblyLifeCycle; 30 import org.objectweb.petals.jbi.management.deployment.DeploymentContextConstants; 31 import org.objectweb.petals.jbi.management.service.EndpointService; 32 import org.objectweb.petals.processor.Task; 33 import org.objectweb.petals.tools.jbicommon.descriptor.Connection; 34 import org.objectweb.petals.tools.jbicommon.descriptor.ServiceAssembly; 35 36 42 public class AllConnectionsRemovalTask implements Task { 43 44 protected EndpointService endpointService; 45 46 public AllConnectionsRemovalTask(EndpointService endpointService) { 47 super(); 48 this.endpointService = endpointService; 49 } 50 51 public void execute(HashMap context) throws Exception { 52 53 ServiceAssemblyLifeCycle lifeCycle = (ServiceAssemblyLifeCycle) context 54 .get(DeploymentContextConstants.SA_LIFECYCLE); 55 56 removeConnections(lifeCycle); 57 58 } 59 60 69 protected void removeConnections(ServiceAssemblyLifeCycle saLifeCycle) 70 throws Exception { 71 ServiceAssembly saDesc = saLifeCycle.getServiceAssembly(); 72 List <Connection> connections = saDesc.getConnections(); 73 if (connections != null) { 74 for (Connection connection : connections) { 75 QName consInterface = connection.getConsumerInterfaceName(); 76 QName consService = connection.getConsumerServiceName(); 77 String consEndpoint = connection.getConsumerEndpointName(); 78 QName provService = connection.getProviderServiceName(); 79 String provEndpoint = connection.getProviderEndpointName(); 80 81 if (provEndpoint != null && provService != null) { 82 if (consInterface != null) { 83 endpointService.deleteConnection(consInterface, 84 provService, provEndpoint); 85 } else if (consService != null && consEndpoint != null) { 86 endpointService.deleteConnection(consService, 87 consEndpoint, provService, provEndpoint); 88 } 89 } 90 } 91 } 92 } 93 94 public void undo(HashMap context) throws Exception { 95 97 } 98 99 } 100 | Popular Tags |