From 95912ec88ac1eb4f6f00c0fa8c76c5df8838fe3c Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 8 Jun 2009 21:51:10 +0000 Subject: Use Node.getService() instead of exposing the Endpoints to the client git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@782806 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/client/impl/SCAClientImpl.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'java/sca/modules/sca-client-impl/src/main') diff --git a/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java b/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java index 3cb79c3e3c..01160b69d5 100644 --- a/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java +++ b/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java @@ -22,12 +22,11 @@ package org.apache.tuscany.sca.client.impl; import java.net.URI; import java.util.List; -import org.apache.tuscany.sca.assembly.Endpoint2; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFinder; -import org.apache.tuscany.sca.node.impl.NodeImpl; import org.oasisopen.sca.NoSuchDomainException; import org.oasisopen.sca.NoSuchServiceException; +import org.oasisopen.sca.ServiceUnavailableException; import org.oasisopen.sca.client.SCAClient; public class SCAClientImpl implements SCAClient { @@ -41,15 +40,12 @@ public class SCAClientImpl implements SCAClient { if (nodes == null || nodes.size() < 1) { throw new NoSuchDomainException(domainURI.toString()); } - + for (Node n : nodes) { - if (n instanceof NodeImpl) { - for ( Endpoint2 e : ((NodeImpl)n).getServiceEndpoints()) { - // TODO: implement more complete matching - if (serviceName.equals(e.getComponent().getName())) { - return n.getService(serviceInterface, serviceName); - } - } + try { + return n.getService(serviceInterface, serviceName); + } catch(ServiceUnavailableException e) { + // Ingore and continue } } -- cgit v1.2.3