From 5695a53ee03f7e92d426dfc650f11ef45e630bdc Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 13 Jun 2011 21:39:56 +0000 Subject: Update for to use the domain uri and name from the registry and to use the domain name in the binding base uri for non-default domains git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1135297 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java | 4 ++-- .../java/org/apache/tuscany/sca/impl/DeployedComposite.java | 4 ++-- .../src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java | 11 ++++------- 3 files changed, 8 insertions(+), 11 deletions(-) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache') diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java index 149599b8fd..4dbccfbe28 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java @@ -104,7 +104,7 @@ public class TuscanyRuntime { TuscanyRuntime runtime = newInstance(); String domain = domainURI == null ? "default" : domainURI.toString(); DomainRegistry domainRegistry = runtime.domainRegistryFactory.getEndpointRegistry(domain, getDomainName(domain)); - NodeImpl node = new NodeImpl(domain, runtime.deployer, runtime.compositeActivator, domainRegistry, runtime.extensionPointRegistry, runtime); + NodeImpl node = new NodeImpl(runtime.deployer, runtime.compositeActivator, domainRegistry, runtime.extensionPointRegistry, runtime); if (dependentContributionURLs != null) { for (int i=dependentContributionURLs.length-1; i>-1; i--) { @@ -150,7 +150,7 @@ public class TuscanyRuntime { domainName = getDomainName(domainURI); } DomainRegistry domainRegistry = domainRegistryFactory.getEndpointRegistry(domainURI, domainName); - return new NodeImpl(domainName, deployer, compositeActivator, domainRegistry, extensionPointRegistry, null); + return new NodeImpl(deployer, compositeActivator, domainRegistry, extensionPointRegistry, null); } /** diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java index ce3713324c..e8315b74f0 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java @@ -88,8 +88,8 @@ public class DeployedComposite { // TODO: don't hardcode the default domain name, instead do something like having a property on Node that says whether or not the // domain name should be included in the service uri - if (!"default".equals(domainRegistry.getDomainURI())) { - bs.put(new QName("default"), Arrays.asList(new String[]{domainRegistry.getDomainURI()})); + if (!"default".equals(domainRegistry.getDomainName())) { + bs.put(new QName("default"), Arrays.asList(new String[]{domainRegistry.getDomainName()})); } builtComposite = deployer.build(contributions, dependedOnContributions, bs, monitor); // TODO: Ideally deployer.build would set the name and uri to what this needs diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java index 00eb2e7e06..0a840aa66f 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java @@ -57,7 +57,6 @@ import org.oasisopen.sca.NoSuchServiceException; public class NodeImpl implements Node { - private String domainName; private Deployer deployer; private CompositeActivator compositeActivator; private DomainRegistry domainRegistry; @@ -69,13 +68,11 @@ public class NodeImpl implements Node { private Map startedComposites = new HashMap(); private Map stoppedComposites = new HashMap(); - public NodeImpl(String domainName, - Deployer deployer, + public NodeImpl(Deployer deployer, CompositeActivator compositeActivator, DomainRegistry domainRegistry, ExtensionPointRegistry extensionPointRegistry, TuscanyRuntime tuscanyRuntime) { - this.domainName = domainName; this.deployer = deployer; this.compositeActivator = compositeActivator; this.domainRegistry = domainRegistry; @@ -250,7 +247,7 @@ public class NodeImpl implements Node { @Override public void startComposite(String contributionURI, String compositeURI, String nodeName) throws ActivationException { - String response = domainRegistry.remoteCommand(nodeName, new RemoteCommand(domainName, "start", contributionURI, compositeURI)); + String response = domainRegistry.remoteCommand(nodeName, new RemoteCommand(domainRegistry.getDomainName(), "start", contributionURI, compositeURI)); if (!"Started.".equals(response)) { throw new ActivationException(response); } @@ -269,7 +266,7 @@ public class NodeImpl implements Node { if (member == null) { throw new IllegalStateException("composite not started: " + compositeURI); } - RemoteCommand command = new RemoteCommand(domainName, "stop", contributionURI, compositeURI); + RemoteCommand command = new RemoteCommand(domainRegistry.getDomainName(), "stop", contributionURI, compositeURI); String response = domainRegistry.remoteCommand(member, command); if (!"Stopped.".equals(response)) { throw new ActivationException(response); @@ -278,7 +275,7 @@ public class NodeImpl implements Node { } public String getDomainName() { - return domainName; + return domainRegistry.getDomainName(); } public Composite getDomainComposite() { -- cgit v1.2.3