diff options
author | bdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-25 17:45:22 +0000 |
---|---|---|
committer | bdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68> | 2010-08-25 17:45:22 +0000 |
commit | 04d678bc9a96d441397b25911104034a782d9bcb (patch) | |
tree | 0900a761408a532f0fd22a2a9a9f0f549796bf92 /sca-java-2.x/trunk/modules | |
parent | 28e2909718f5f565a1bd08f1cae599c1582b0ace (diff) |
Check for a valid domain URI when an SCAClientFactory is created
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@989255 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r-- | sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl2.java | 14 |
1 files changed, 13 insertions, 1 deletions
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 8626927097..95e23816b3 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 @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.client.impl; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; import java.net.URI; +import java.util.List; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.node.Node; @@ -41,9 +42,20 @@ public class SCAClientFactoryImpl2 extends SCAClientFactory { public SCAClientFactoryImpl2(URI domainURI) throws NoSuchDomainException { super(domainURI); + checkDomainURI(domainURI); } - @SuppressWarnings("unchecked") + private void checkDomainURI(URI domainURI) throws NoSuchDomainException { + for ( NodeFactory nodeFactory : NodeFactory.getNodeFactories()) { + String domainName = getDomainName(); + List<Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodesInDomain(domainName); + if ( !nodes.isEmpty() ) + return; + } + throw new NoSuchDomainException(getDomainName()); + } + + @SuppressWarnings("unchecked") @Override public <T> T getService(Class<T> serviceInterface, String serviceName) throws NoSuchServiceException, NoSuchDomainException { |