summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-01-29 14:08:43 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-01-29 14:08:43 +0000
commitc057c51d8c40a264493c0cbc687fb805b169de2f (patch)
tree0dc299d85c568417a7e0ab811b083b69f4d034f3 /sca-java-2.x
parent34ca7df798da5031aa91b0d04039983cb077ba42 (diff)
Update tribes registry to also support the tuscany registry uri format
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@904504 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/pom.xml82
-rw-r--r--sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java76
-rw-r--r--sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java82
-rw-r--r--sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java82
-rw-r--r--sca-java-2.x/trunk/itest/nodes/pom.xml1
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/TuscanyURI.java (renamed from sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURI.java)8
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/ConfigURITestCase.java (renamed from sca-java-2.x/trunk/modules/endpoint-hazelcast/src/test/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURITestCase.java)21
-rw-r--r--sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java5
-rw-r--r--sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java29
-rw-r--r--sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/TribesDomainRegistryFactory.java2
10 files changed, 370 insertions, 18 deletions
diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/pom.xml b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/pom.xml
new file mode 100644
index 0000000000..22dcbea406
--- /dev/null
+++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-nodes-one-jvm-tribes</artifactId>
+ <name>Apache Tuscany SCA iTest Nodes One JVM Using Tribes Registry</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-nodes-helloworld-iface</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-client-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-endpoint-tribes</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-runtime-rmi</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <argLine>-ea -Xmx256m</argLine>
+ <parallel>off</parallel>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java
new file mode 100644
index 0000000000..e55e8f63e4
--- /dev/null
+++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package itest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import itest.nodes.Helloworld;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class OneNodeTestCase{
+
+ private static URI domainURI = URI.create("OneNodeTestCase");
+ private static Node node;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ node = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes", "../helloworld-client/target/classes");
+ node.start();
+ }
+
+ @Test
+ public void testNode() throws Exception {
+
+ Helloworld service = node.getService(Helloworld.class, "HelloworldService");
+ assertNotNull(service);
+ assertEquals("Hello Petra", service.sayHello("Petra"));
+
+ Helloworld client = node.getService(Helloworld.class, "HelloworldClient");
+ assertNotNull(client);
+ assertEquals("Hi Hello Petra", client.sayHello("Petra"));
+
+ Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService");
+ assertNotNull(scaClientService);
+ assertEquals("Hello Petra", scaClientService.sayHello("Petra"));
+
+ Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient");
+ assertNotNull(scaClientClient);
+ assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra"));
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java
new file mode 100644
index 0000000000..2d920c340a
--- /dev/null
+++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package itest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import itest.nodes.Helloworld;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class TwoNodeTestCase{
+
+ private static URI domainURI = URI.create("TwoNodeTestCase");
+ private static Node serviceNode;
+ private static Node clientNode;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ serviceNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes");
+ serviceNode.start();
+ clientNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-client/target/classes");
+ clientNode.start();
+ }
+
+ @Test
+ public void testNode() throws Exception {
+
+ Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
+ assertNotNull(service);
+ assertEquals("Hello Petra", service.sayHello("Petra"));
+
+ Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
+ assertNotNull(client);
+ assertEquals("Hi Hello Petra", client.sayHello("Petra"));
+
+ Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService");
+ assertNotNull(scaClientService);
+ assertEquals("Hello Petra", scaClientService.sayHello("Petra"));
+
+ Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient");
+ assertNotNull(scaClientClient);
+ assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra"));
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (serviceNode != null) {
+ serviceNode.stop();
+ }
+ if (clientNode != null) {
+ clientNode.stop();
+ }
+ }
+}
diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java
new file mode 100644
index 0000000000..7e3cf0c3e6
--- /dev/null
+++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package itest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import itest.nodes.Helloworld;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class TwoRemoteNodesTestCase{
+
+ private static Node serviceNode;
+ private static Node clientNode;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ serviceNode = NodeFactory.newInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-service/target/classes");
+ serviceNode.start();
+
+ clientNode = NodeFactory.getInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-client/target/classes");
+ clientNode.start();
+ }
+
+ @Test
+ public void testNode() throws Exception {
+
+ Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
+ assertNotNull(service);
+ assertEquals("Hello Petra", service.sayHello("Petra"));
+
+ Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
+ assertNotNull(client);
+ assertEquals("Hi Hello Petra", client.sayHello("Petra"));
+
+// Helloworld scaClientService = SCAClientFactory.newInstance(URI.create("TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldService");
+// assertNotNull(scaClientService);
+// assertEquals("Hello Petra", scaClientService.sayHello("Petra"));
+
+ Helloworld scaClientClient = SCAClientFactory.newInstance(URI.create("TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldClient");
+ assertNotNull(scaClientClient);
+ assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra"));
+
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (serviceNode != null) {
+ serviceNode.stop();
+ }
+ if (clientNode != null) {
+ clientNode.stop();
+ }
+ }
+}
diff --git a/sca-java-2.x/trunk/itest/nodes/pom.xml b/sca-java-2.x/trunk/itest/nodes/pom.xml
index 01fe0592a6..3c07da0842 100644
--- a/sca-java-2.x/trunk/itest/nodes/pom.xml
+++ b/sca-java-2.x/trunk/itest/nodes/pom.xml
@@ -45,6 +45,7 @@
<module>one-jvm</module>
<module>one-jvm-hazelcast</module>
<module>one-jvm-hazelcast-client</module>
+ <module>one-jvm-tribes</module>
<module>one-node-test</module>
<module>two-nodes-test</module>
<module>two-nodes-two-vms-test</module>
diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURI.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/TuscanyURI.java
index 0eee731249..2bb22ad634 100644
--- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURI.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/TuscanyURI.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.tuscany.sca.endpoint.hazelcast;
+package org.apache.tuscany.sca.runtime;
import java.net.URI;
import java.util.ArrayList;
@@ -38,10 +38,8 @@ import java.util.Map;
* otherwise if remotes= is not specified then multicast defaults to 224.5.12.10:51482
* remotes - a list of ipAddress:port for remote nodes
*
- * TODO: move this to a base module as it will also be used by the SCAClient
- * add JCA encryption config
*/
-public class ConfigURI {
+public class TuscanyURI {
private String domainName = "default";
private String bindAddress = null; // null means all network adapters
@@ -53,7 +51,7 @@ public class ConfigURI {
private List<String> remotes = new ArrayList<String>();
private String uri;
- public ConfigURI(String uri) {
+ public TuscanyURI(String uri) {
this.uri = uri;
parseURI(uri);
}
diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/test/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURITestCase.java b/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/ConfigURITestCase.java
index 85821afe39..525cf80587 100644
--- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/test/java/org/apache/tuscany/sca/endpoint/hazelcast/ConfigURITestCase.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/ConfigURITestCase.java
@@ -17,12 +17,13 @@
* under the License.
*/
-package org.apache.tuscany.sca.endpoint.hazelcast;
+package org.apache.tuscany.sca.runtime;
import java.net.UnknownHostException;
import junit.framework.Assert;
+import org.apache.tuscany.sca.runtime.TuscanyURI;
import org.junit.Test;
public class ConfigURITestCase {
@@ -30,7 +31,7 @@ public class ConfigURITestCase {
@Test
public void testInvalidPrefix() throws UnknownHostException {
try {
- new ConfigURI("foo");
+ new TuscanyURI("foo");
Assert.fail();
} catch (IllegalArgumentException e) {
// expected
@@ -39,14 +40,14 @@ public class ConfigURITestCase {
@Test
public void testDomainName() throws UnknownHostException {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
}
@Test
public void testListenAddr() throws UnknownHostException {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain?listen=4321");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?listen=4321");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals(4321, configURI.getListenPort());
@@ -54,7 +55,7 @@ public class ConfigURITestCase {
}
@Test
public void testListenAddr2() throws UnknownHostException {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain?listen=1.1.1.1:4321");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?listen=1.1.1.1:4321");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals(4321, configURI.getListenPort());
@@ -63,14 +64,14 @@ public class ConfigURITestCase {
@Test
public void testMulticase1() throws UnknownHostException {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain?multicast=off");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?multicast=off");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertTrue(configURI.isMulticastDisabled());
}
@Test
public void testMulticase2() throws UnknownHostException {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain?multicast=1.2.3.4:67");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?multicast=1.2.3.4:67");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals("1.2.3.4", configURI.getMulticastAddress());
@@ -79,7 +80,7 @@ public class ConfigURITestCase {
@Test
public void testMulticase3() throws UnknownHostException {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain?multicast=1.2.3.4");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?multicast=1.2.3.4");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals("1.2.3.4", configURI.getMulticastAddress());
@@ -88,14 +89,14 @@ public class ConfigURITestCase {
@Test
public void testPassword() {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain?password=bla");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?password=bla");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertEquals("bla", configURI.getPassword());
}
@Test
public void testRemotes() throws UnknownHostException {
- ConfigURI configURI = new ConfigURI("tuscany:myDomain?remotes=1.1.1.1:23,2.2.2.2");
+ TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?remotes=1.1.1.1:23,2.2.2.2");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertTrue(configURI.isMulticastDisabled());
Assert.assertEquals(2, configURI.getRemotes().size());
diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
index e50f0511cf..afdee1484f 100644
--- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
@@ -32,6 +32,7 @@ import org.apache.tuscany.sca.core.LifeCycleListener;
import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.TuscanyURI;
import com.hazelcast.config.Config;
import com.hazelcast.config.TcpIpConfig;
@@ -51,7 +52,7 @@ import com.hazelcast.nio.Address;
public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements EndpointRegistry, LifeCycleListener, EntryListener<String, Endpoint>, MembershipListener {
private final static Logger logger = Logger.getLogger(HazelcastEndpointRegistry.class.getName());
- protected ConfigURI configURI;
+ protected TuscanyURI configURI;
private HazelcastInstance hazelcastInstance;
protected Map<Object, Object> map;
@@ -62,7 +63,7 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E
String domainRegistryURI,
String domainURI) {
super(registry, attributes, domainRegistryURI, domainURI);
- this.configURI = new ConfigURI(domainRegistryURI);
+ this.configURI = new TuscanyURI(domainRegistryURI);
}
public void start() {
diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
index 3c2a062de2..5f46615001 100644
--- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
@@ -51,6 +51,7 @@ import org.apache.tuscany.sca.endpoint.tribes.MapStore.MapListener;
import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.TuscanyURI;
/**
* A replicated EndpointRegistry based on Apache Tomcat Tribes
@@ -117,6 +118,13 @@ public class ReplicatedEndpointRegistry extends BaseEndpointRegistry implements
if (uri.getPort() != -1) {
map.put("port", String.valueOf(uri.getPort()));
}
+
+ if (domainRegistryURI.startsWith("tuscany")) {
+ setTuscanyConfig(map, domainRegistryURI);
+ setConfig(map);
+ return map;
+ }
+
int index = domainRegistryURI.indexOf('?');
if (index == -1) {
setConfig(map);
@@ -139,6 +147,27 @@ public class ReplicatedEndpointRegistry extends BaseEndpointRegistry implements
return map;
}
+ private void setTuscanyConfig(Map<String, String> map, String domainRegistryURI) {
+ TuscanyURI tuscanyURI = new TuscanyURI(domainRegistryURI);
+ map.put("address", tuscanyURI.getMulticastAddress());
+ map.put("port", Integer.toString(tuscanyURI.getMulticastPort()));
+ map.put("bind", tuscanyURI.getBindAddress());
+ map.put("receiverPort", Integer.toString(tuscanyURI.getListenPort()));
+ if (tuscanyURI.isMulticastDisabled()) {
+ map.put("nomcast", "true");
+ }
+ if (tuscanyURI.getRemotes().size() > 0) {
+ String routes = "";
+ for (int i=0; i<tuscanyURI.getRemotes().size(); i++) {
+ routes += tuscanyURI.getRemotes().get(i);
+ if (i < tuscanyURI.getRemotes().size()) {
+ routes += ",";
+ }
+ }
+ map.put("routes", routes);
+ }
+ }
+
private void setConfig(Map<String, String> attributes) {
String portStr = attributes.get("port");
if (portStr != null) {
diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/TribesDomainRegistryFactory.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/TribesDomainRegistryFactory.java
index 68add08276..91314b4c37 100644
--- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/TribesDomainRegistryFactory.java
+++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/TribesDomainRegistryFactory.java
@@ -28,7 +28,7 @@ import org.apache.tuscany.sca.runtime.EndpointRegistry;
* given domain
*/
public class TribesDomainRegistryFactory extends BaseDomainRegistryFactory {
- private final static String[] schemes = new String[] {"multicast", "tribes"};
+ private final static String[] schemes = new String[] {"multicast", "tribes", "tuscany"};
/**
* @param extensionRegistry