From 9158c52857af8686b9080f70c57e904756774b60 Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 18 May 2010 09:58:17 +0000 Subject: Use new getNodesInDomain method git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@945571 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/client/impl/SCAClientFactoryImpl2.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'sca-java-2.x/trunk/modules/sca-client-impl') diff --git a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl2.java b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl2.java index 56c643be7d..b1f7b37f8f 100644 --- a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl2.java +++ b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl2.java @@ -49,15 +49,11 @@ public class SCAClientFactoryImpl2 extends SCAClientFactory { boolean foundDomain = false; for (NodeFactory nodeFactory : NodeFactory.getNodeFactories()) { - for (Node node : ((NodeFactoryImpl)nodeFactory).getNodes().values()) { - NodeImpl nodeImpl = (NodeImpl) node; - String nodeDomain = nodeImpl.getConfiguration().getDomainURI(); - if (nodeDomain.equals(getDomainURI().toString())) { - foundDomain = true; - for (Endpoint ep : nodeImpl.getServiceEndpoints()) { - if (ep.matches(serviceName)) { - return node.getService(serviceInterface, serviceName); - } + for (Node node : ((NodeFactoryImpl)nodeFactory).getNodesInDomain(getDomainName())) { + foundDomain = true; + for (Endpoint ep : ((NodeImpl)node).getServiceEndpoints()) { + if (ep.matches(serviceName)) { + return node.getService(serviceInterface, serviceName); } } } @@ -72,4 +68,10 @@ public class SCAClientFactoryImpl2 extends SCAClientFactory { InvocationHandler handler = new SCAClientHandler(getDomainURI().toString(), serviceName, serviceInterface); return (T)Proxy.newProxyInstance(serviceInterface.getClassLoader(), new Class[]{serviceInterface}, handler); } + + private String getDomainName() { + // TODO: if the domain URI encodes config (eg uri:someDomain?bla=etc) then need to parse the domain name + String domainName = getDomainURI().toString(); + return domainName; + } } -- cgit v1.2.3