Author: antelder
Date: Wed Jan 12 15:24:28 2011
New Revision: 1058185
URL: http://svn.apache.org/viewvc?rev=1058185&view=rev
Log:
Update to use getService from Node
Modified:
tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
Modified:
tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java?rev=1058185&r1=1058184&r2=1058185&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
Wed Jan 12 15:24:28 2011
@@ -54,6 +54,7 @@ import org.apache.tuscany.sca.runtime.Ru
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));