From 59f53a731aeb36de2bac7777cc26f24f6997afb0 Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 29 Jan 2010 11:11:09 +0000 Subject: Update to find an existing domain if the registry isn't explicitly defined git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@904461 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/itest/TwoRemoteNodesTestCase.java | 2 +- .../org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java | 4 ++++ .../java/org/apache/tuscany/sca/runtime/EndpointRegistry.java | 1 + .../apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java | 10 ++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java index 1c20911da2..7e3cf0c3e6 100644 --- a/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java +++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java @@ -64,7 +64,7 @@ public class TwoRemoteNodesTestCase{ // assertNotNull(scaClientService); // assertEquals("Hello Petra", scaClientService.sayHello("Petra")); - Helloworld scaClientClient = SCAClientFactory.newInstance(URI.create("tuscany:TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldClient"); + Helloworld scaClientClient = SCAClientFactory.newInstance(URI.create("TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldClient"); assertNotNull(scaClientClient); assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java index 5646916075..8cea5e1423 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java @@ -199,4 +199,8 @@ public abstract class BaseEndpointRegistry implements EndpointRegistry, LifeCycl listeners.remove(listener); } + public String getDomainName() { + return domainURI; + } + } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java index 6c4839018d..0c0c0f2b0e 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java @@ -66,4 +66,5 @@ public interface EndpointRegistry { void addListener(EndpointListener listener); void removeListener(EndpointListener listener); + String getDomainName(); } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java index 0a0b503206..62ba7cce8d 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java @@ -64,6 +64,16 @@ public class ExtensibleDomainRegistry implements DomainRegistryFactory { URI uri = URI.create(endpointRegistryURI); String scheme = uri.getScheme(); if (scheme == null) { + + // See if there is a previously created registry for that domain + for (DomainRegistryFactory factory : factories.getDomainRegistryFactories()) { + for (EndpointRegistry endpointRegistry : factory.getEndpointRegistries()) { + if (endpointRegistry.getDomainName().equals(domainURI)) { + return endpointRegistry; + } + } + } + scheme = "vm"; endpointRegistryURI = "vm:" + endpointRegistryURI; } else { -- cgit v1.2.3