summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/node-impl/src/main
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-11-17 13:26:10 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-11-17 13:26:10 +0000
commitba79133f08b3d06dd1475ed0a88aabc45689255a (patch)
tree8c56b01263208f854ae7f2124b3efbd67d399b95 /sca-java-2.x/trunk/modules/node-impl/src/main
parent112abc568d576e6601c8025f9f8f85b24d2d1a15 (diff)
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
Diffstat (limited to 'sca-java-2.x/trunk/modules/node-impl/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java43
1 files changed, 2 insertions, 41 deletions
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() {