summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/shell/src/main
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-01-12 15:24:28 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-01-12 15:24:28 +0000
commit282df8a80e96349a66f60e1cd8e13a0e0fdee8e1 (patch)
tree1eff47a29df458761e4dfa7a73460b6f794c7eb2 /sca-java-2.x/trunk/modules/shell/src/main
parent3e34b7a33e014055939de0ba37dadfba4d5e5cda (diff)
Update to use getService from Node
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1058185 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/shell/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java19
1 files changed, 3 insertions, 16 deletions
diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
index d45e95e863..00f1626bdb 100644
--- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
+++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
@@ -54,6 +54,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.Version;
import org.apache.tuscany.sca.runtime.impl.NodeImpl;
import org.apache.tuscany.sca.shell.jline.JLine;
+import org.oasisopen.sca.NoSuchServiceException;
/**
* A little SCA command shell.
@@ -218,26 +219,12 @@ public class Shell {
return true;
}
- boolean invoke(final List<String> toks) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
+ boolean invoke(final List<String> toks) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchServiceException {
String endpointName = toks.get(1);
- String serviceName = null;
- if (endpointName.contains("/")) {
- int i = endpointName.indexOf("/");
- if (i < endpointName.length()-1) {
- serviceName = endpointName.substring(i+1);
- }
- }
String operationName = toks.get(2);
String params[] = new String[toks.size()- 3];
System.arraycopy(toks.toArray(), 3, params, 0, params.length);
-
- EndpointRegistry reg = ((NodeImpl)getNode()).getEndpointRegistry();
- List<Endpoint> endpoints = reg.findEndpoint(endpointName);
- if (endpoints.size() < 1) {
- out.println(" no service found: " + endpointName);
- return true;
- }
- Object proxy = ((RuntimeComponent)endpoints.get(0).getComponent()).getServiceReference(null, serviceName).getService();
+ Object proxy = getNode().getService(null, endpointName);
Object result = invoke(proxy, operationName, params);
if (result != null && result.getClass().isArray()) {
out.println(Arrays.toString((Object[])result));