| Commit in servicemix/base/src/main/java/org/servicemix/jbi/framework on MAIN | |||
| DeploymentService.java | +64 | -20 | 1.12 -> 1.13 |
Added the handling of the connections, including a little more exception throwing when problems occur and also the handling of a connection between a consumer and provider where the interface name is missing and the service-name and endpoint are defined
servicemix/base/src/main/java/org/servicemix/jbi/framework
diff -u -r1.12 -r1.13 --- DeploymentService.java 10 Aug 2005 19:08:58 -0000 1.12 +++ DeploymentService.java 11 Aug 2005 01:50:59 -0000 1.13 @@ -26,6 +26,7 @@
import java.util.List; import java.util.Map; import java.util.Set;
+
import javax.jbi.component.Component; import javax.jbi.component.ServiceUnitManager; import javax.jbi.management.DeploymentException;
@@ -33,6 +34,7 @@
import javax.management.JMException; import javax.management.MBeanOperationInfo; import javax.xml.namespace.QName;
+
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.servicemix.jbi.container.EnvironmentContext;
@@ -47,14 +49,16 @@
import org.servicemix.jbi.management.BaseLifeCycle; import org.servicemix.jbi.management.OperationInfoHelper; import org.servicemix.jbi.management.ParameterHelper;
+import org.servicemix.jbi.servicedesc.ServiceEndpointImpl;
import org.servicemix.jbi.util.FileUtil; import org.springframework.context.support.FileSystemXmlApplicationContext;
+
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap; /** * The deployment service MBean allows administrative tools to manage service assembly deployments. *
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class DeploymentService extends BaseLifeCycle implements DeploymentServiceMBean, ProcessArchive {
private static final Log log = LogFactory.getLog(DeploymentService.class);
@@ -640,25 +644,65 @@
}
}
- protected void buildConnections(ServiceAssembly sa) {
- if (sa != null) {
- Connection[] connections = sa.getConnections().getConnection();
- if (connections != null) {
- for (int i = 0;i < connections.length;i++) {
- Connection connection = connections[i];
- Consumer consumer = connection.getConsumer();
- Provider provider = connection.getProvider();
- QName suName = consumer.getInterfaceName();
- if (suName != null) {
- LocalComponentConnector lcc = (LocalComponentConnector) container.getRegistry()
- .getComponentConnector(suName);
- lcc.getActivationSpec().setDestinationEndpoint(provider.getEndpointName());
- lcc.getActivationSpec().setDestinationService(provider.getServiceName());
- }
- }
- }
- }
- }
+ protected void buildConnections(ServiceAssembly sa)
+ throws DeploymentException {
+ if (sa != null) {
+ Connection[] connections = sa.getConnections().getConnection();
+ if (connections != null) {
+ for (int i = 0; i < connections.length; i++) {
+ Connection connection = connections[i];
+ Consumer consumer = connection.getConsumer();
+ Provider provider = connection.getProvider();
+ QName suName = consumer.getInterfaceName();
+ if (suName != null) {
+ LocalComponentConnector lcc = (LocalComponentConnector) container
+ .getRegistry().getComponentConnector(suName);
+ if (lcc != null) {
+ lcc.getActivationSpec().setDestinationEndpoint(
+ provider.getEndpointName());
+ lcc.getActivationSpec().setDestinationService(
+ provider.getServiceName());
+ } else {
+ throw new DeploymentException(
+ "Unable to build connections, can't find consumer interface "
+ + suName);
+ }
+ } else {
+ // We didn't have the interface so we will go after
+ // the service name and endpoint
+ ServiceEndpointImpl endPoint = (ServiceEndpointImpl) container
+ .getRegistry().getEndpoint(
+ consumer.getServiceName(),
+ consumer.getEndpointName());
+
+ if (endPoint != null) {
+ LocalComponentConnector lcc = (LocalComponentConnector) container
+ .getRegistry().getComponentConnector(
+ endPoint.getComponentNameSpace());
+ if (lcc != null) {
+ lcc.getActivationSpec().setDestinationEndpoint(
+ provider.getEndpointName());
+ lcc.getActivationSpec().setDestinationService(
+ provider.getServiceName());
+ } else {
+ throw new DeploymentException(
+ "Unable to build connections, can't find consumer based on component name space "
+ + endPoint
+ .getComponentNameSpace());
+ }
+ } else {
+ throw new DeploymentException(
+ "Unable to build connections, can't find consumer with servicename "
+ + consumer.getServiceName()
+ + " and endpoint "
+ + consumer.getEndpointName());
+ }
+ }
+ }
+ }
+ }
+ }
+
protected ServiceUnit getServiceUnit(String serviceUnitName, ServiceUnit[] sus) {
ServiceUnit result = null;
