From 3b6dafef3fcd13f20d653d161aef69c0bf0aa6bf Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 6 Jul 2010 11:54:14 +0000 Subject: Update to configure the registry from the domainURI git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@960881 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/node2/NodeFactory.java | 15 +++++++++++++-- .../hazelcast/HazelcastDomainRegistryFactory.java | 2 +- .../main/java/org/apache/tuscany/sca/shell/Shell.java | 17 ++++++++++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java index 47eba43477..cafa772a25 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java @@ -95,8 +95,9 @@ public class NodeFactory { } public Node createNode(String domainURI) { - EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry("default", domainURI); - return new NodeImpl(domainURI, deployer, compositeActivator, endpointRegistry, extensionPointRegistry, null); + String domainName = getDomainName(domainURI); + EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry(domainURI, domainName); + return new NodeImpl(domainName, deployer, compositeActivator, endpointRegistry, extensionPointRegistry, null); } protected Node createOneoffNode() { @@ -152,4 +153,14 @@ public class NodeFactory { public AssemblyFactory getAssemblyFactory() { return assemblyFactory; } + + private 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); + } + } } diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastDomainRegistryFactory.java b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastDomainRegistryFactory.java index 110982a1bd..87c60e4b38 100644 --- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastDomainRegistryFactory.java +++ b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastDomainRegistryFactory.java @@ -32,7 +32,7 @@ import org.apache.tuscany.sca.runtime.RuntimeProperties; * given domain */ public class HazelcastDomainRegistryFactory extends BaseDomainRegistryFactory { - private final static String[] schemes = new String[] {"multicast", "wka", "tuscany", "hazelcast"}; + private final static String[] schemes = new String[] {"multicast", "wka", "tuscany", "hazelcast", "uri"}; public HazelcastDomainRegistryFactory(ExtensionPointRegistry registry) { super(registry); diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java index 8543ea1b14..d475af6a89 100644 --- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java +++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java @@ -55,18 +55,28 @@ public class Shell { Node node; private boolean useJline; final List history = new ArrayList(); + private NodeFactory factory; static final String[] COMMANDS = new String[] {"addDeploymentComposite", "addToDomainLevelComposite", "help", "install", "installed", "listDeployedCompostes", "listInstalledContributions", "printDomainLevelComposite", "removeFromDomainLevelComposite", "remove", "start", "status", "stop"}; public static void main(final String[] args) throws Exception { - boolean useJline = !Arrays.asList(args).contains("-nojline"); - new Shell(args.length > 0 ? args[0] : "default", useJline).run(); + boolean useJline = true; + String domainURI = "default"; + for (String s : args) { + if ("-nojline".equals(s)) { + useJline = false; + } else { + domainURI = s; + } + } + new Shell(domainURI, useJline).run(); } public Shell(String domainURI, boolean useJLine) { - this.node = NodeFactory.newInstance().createNode(domainURI); + this.factory = NodeFactory.newInstance(); + this.node = factory.createNode(domainURI); this.useJline = useJLine; } @@ -212,6 +222,7 @@ public class Shell { boolean stop(List toks) throws ActivationException { if (toks == null || toks.size() < 2) { node.stop(); + factory.stop(); return false; } String curi = toks.get(1); -- cgit v1.2.3