diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-29 14:08:43 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-29 14:08:43 +0000 |
commit | c057c51d8c40a264493c0cbc687fb805b169de2f (patch) | |
tree | 0dc299d85c568417a7e0ab811b083b69f4d034f3 /sca-java-2.x/trunk/modules/endpoint-tribes/src/main | |
parent | 34ca7df798da5031aa91b0d04039983cb077ba42 (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 'sca-java-2.x/trunk/modules/endpoint-tribes/src/main')
2 files changed, 30 insertions, 1 deletions
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 |