diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-27 08:34:33 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-27 08:34:33 +0000 |
commit | fab34c8f3e1b0c0340f8f938b076bd855d5382ae (patch) | |
tree | 9c416e701e020959f159d7dd9950ca79a4947f2b /sca-java-2.x/trunk/modules | |
parent | b29528253932cd9f7553765d60942e9bcb9a2422 (diff) |
Support using null for the domain name and deriving the name from the uri
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1140051 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r-- | sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistryFactory.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistryFactory.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistryFactory.java index 64af944c9f..ddb4279a4e 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistryFactory.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistryFactory.java @@ -72,6 +72,9 @@ public class ExtensibleDomainRegistryFactory implements DomainRegistryFactory { } public DomainRegistry getEndpointRegistry(String endpointRegistryURI, String domainURI) { + if (domainURI == null) { + domainURI = getDomainName(endpointRegistryURI); + } if (endpointRegistryURI == null) { endpointRegistryURI = factories.getDomainRegistryMapping().get(domainURI); if (endpointRegistryURI == null) { @@ -130,4 +133,24 @@ public class ExtensibleDomainRegistryFactory implements DomainRegistryFactory { return allSchemes; } + /** + * Derive a domain name from a domain URI + * Examples: + * Domain URI - Domain Name + * default default + * foo foo + * uri:foo foo + * uri://foo?key=x&key2=y foo + * uri://foo/bar foo/bar + */ + private static String getDomainName(String domainURI) { + int scheme = domainURI.indexOf(':'); + int qm = domainURI.indexOf('?'); + if (qm == -1) { + return domainURI.substring(scheme+1); + } else { + return domainURI.substring(scheme+1, qm); + } + } + } |