From ba79133f08b3d06dd1475ed0a88aabc45689255a Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 17 Nov 2010 13:26:10 +0000 Subject: Get the Shell invoke function working and add a services command to show the available services git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1036030 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/node/impl/NodeImpl.java | 43 +--------------------- 1 file changed, 2 insertions(+), 41 deletions(-) (limited to 'sca-java-2.x/trunk/modules/node-impl/src/main') diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 8eecca1564..71a4bb704a 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -28,9 +28,7 @@ import java.util.logging.Logger; import javax.xml.stream.XMLOutputFactory; import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.context.CompositeContext; @@ -52,7 +50,6 @@ import org.apache.tuscany.sca.runtime.DomainRegistryFactory; import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentContext; import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.oasisopen.sca.ServiceReference; import org.oasisopen.sca.ServiceRuntimeException; @@ -261,44 +258,8 @@ public class NodeImpl implements Node { if (component == null) { throw new ServiceUnavailableException("The service " + name + " has not been contributed to the domain"); } - RuntimeComponentContext componentContext = null; - - // If the component is a composite, then we need to find the - // non-composite component that provides the requested service - if (component.getImplementation() instanceof Composite) { - for (ComponentService componentService : component.getServices()) { - String bindingName = null; - if (serviceName != null) { - int index = serviceName.indexOf('/'); - if (index != -1) { - bindingName = serviceName.substring(index + 1); - serviceName = serviceName.substring(0, index); - } - } - if (serviceName == null || serviceName.equals(componentService.getName())) { - CompositeService compositeService = (CompositeService)componentService.getService(); - if (compositeService != null) { - componentContext = - ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext(); - serviceName = compositeService.getPromotedService().getName(); - if (bindingName != null) { - serviceName = serviceName + "/" + bindingName; - } - return componentContext.createSelfReference(businessInterface, serviceName); - } - break; - } - } - // No matching service found - throw new ServiceRuntimeException("Composite service not found: " + name); - } else { - componentContext = ((RuntimeComponent)component).getComponentContext(); - if (serviceName != null) { - return componentContext.createSelfReference(businessInterface, serviceName); - } else { - return componentContext.createSelfReference(businessInterface); - } - } + + return ((RuntimeComponent)component).getServiceReference(businessInterface, serviceName); } public NodeConfiguration getConfiguration() { -- cgit v1.2.3