diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-20 07:03:12 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-20 07:03:12 +0000 |
commit | 6488c22f990bed4927c1ec089fffeb256da15b3a (patch) | |
tree | 483e0ddcd995da8b0931a0b0c8ca53e7d7aa70b7 /sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache | |
parent | fc66b50df4e07dee2dc7d363fb2b531052c97b77 (diff) |
Remove remoteStart/Stop commands to simplify - don't need remoteStop as stop can see that the composte is running remotely and for start just overload the start command to take a member name to run the composite on
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1125259 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
2 files changed, 20 insertions, 18 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java index 8889e369bf..9a1a8fe971 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java @@ -153,6 +153,7 @@ public interface Node { * @throws ContributionReadException */ void startComposite(String contributionURI, String compositeURI) throws ActivationException, ValidationException, ContributionReadException; + void startComposite(String memberName, String contributionURI, String compositeURI) throws ActivationException; /** * 4687 10.7.2 remove From Domain-Level Composite @@ -244,11 +245,7 @@ public interface Node { String getLocalMember(); String getRunningMember(String contributionURI, String compositeURI); - String remoteStart(String member, String contributionURI, String compositeURI); - String remoteStop(String member, String contributionURI, String compositeURI); - // TODO: Add methods to get: - // start and stop composites on remote members // get/display contribution content // a view-only Node // dirty started composites (contributions updated while composite running) 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 2682ec493b..dcf243eab9 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 @@ -33,8 +33,6 @@ import javax.xml.stream.XMLStreamException; import org.apache.tuscany.sca.Node; import org.apache.tuscany.sca.TuscanyRuntime; -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Base; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.xml.Utils; import org.apache.tuscany.sca.common.java.io.IOHelper; @@ -45,7 +43,6 @@ import org.apache.tuscany.sca.contribution.java.JavaImport; import org.apache.tuscany.sca.contribution.namespace.NamespaceImport; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.deployment.Deployer; import org.apache.tuscany.sca.monitor.Monitor; @@ -249,12 +246,30 @@ public class NodeImpl implements Node { startedComposites.put(key, dc); } } + + @Override + public void startComposite(String memberName, String contributionURI, String compositeURI) throws ActivationException { + String response = domainRegistry.remoteCommand(memberName, new RemoteCommand(domainName, "start", contributionURI, compositeURI)); + if (!"Started.".equals(response)) { + throw new ActivationException(response); + } + } + + public void stopComposite(String contributionURI, String compositeURI) throws ActivationException { String key = contributionURI+"/"+compositeURI; DeployedComposite dc = startedComposites.remove(key); if (dc == null) { - throw new IllegalStateException("composite not started: " + compositeURI); + String member = domainRegistry.getRunningMember(contributionURI, compositeURI); + if (member == null) { + throw new IllegalStateException("composite not started: " + compositeURI); + } + RemoteCommand command = new RemoteCommand(domainName, "stop", contributionURI, compositeURI); + String response = domainRegistry.remoteCommand(member, command); + if (!"Stopped.".equals(response)) { + throw new ActivationException(response); + } } dc.stop(); stoppedComposites.put(key, dc); @@ -399,14 +414,4 @@ public class NodeImpl implements Node { return domainRegistry.getRunningMember(contributionURI, compositeURI); } - @Override - public String remoteStart(String memberName, String contributionURI, String compositeURI) { - return domainRegistry.remoteCommand(memberName, new RemoteCommand(domainName, "start", contributionURI, compositeURI)); - } - - @Override - public String remoteStop(String memberName, String contributionURI, String compositeURI) { - return domainRegistry.remoteCommand(memberName, new RemoteCommand(domainName, "stop", contributionURI, compositeURI)); - } - } |