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 --- java/sca/modules/sca-client-impl/META-INF/MANIFEST.MF | 4 +--- .../apache/tuscany/sca/client/impl/SCAClientImpl.java | 16 ++++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'java/sca/modules') diff --git a/java/sca/modules/sca-client-impl/META-INF/MANIFEST.MF b/java/sca/modules/sca-client-impl/META-INF/MANIFEST.MF index 91603b0b44..a472877dd7 100644 --- a/java/sca/modules/sca-client-impl/META-INF/MANIFEST.MF +++ b/java/sca/modules/sca-client-impl/META-INF/MANIFEST.MF @@ -9,10 +9,8 @@ Bnd-LastModified: 1225397189093 Bundle-ManifestVersion: 2 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Client Impl -Import-Package: org.apache.tuscany.sca.assembly;version="2.0.0", - org.apache.tuscany.sca.client.impl;version="2.0.0", +Import-Package: org.apache.tuscany.sca.client.impl;version="2.0.0", org.apache.tuscany.sca.node;version="2.0.0", - org.apache.tuscany.sca.node.impl;version="2.0.0", org.oasisopen.sca;version="2.0.0", org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional, org.oasisopen.sca.client;version="2.0.0" 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