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
This commit is contained in:
parent
fc66b50df4
commit
6488c22f99
3 changed files with 28 additions and 40 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
@ -250,12 +247,30 @@ public class NodeImpl implements Node {
|
|||
}
|
||||
}
|
||||
|
||||
@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) {
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Shell {
|
|||
private Map<String, Node> nodes = new HashMap<String, Node>();
|
||||
|
||||
public static final String[] COMMANDS = new String[] {"bye", "domain", "domains", "domainComposite", "help", "install", "installed", "invoke",
|
||||
"load", "members", "remoteStart", "remoteStop", "remove", "run", "save", "services", "start", "started", "stop"};
|
||||
"load", "members", "remove", "run", "save", "services", "start", "started", "stop"};
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
boolean useJline = true;
|
||||
|
@ -444,14 +444,8 @@ public class Shell {
|
|||
return true;
|
||||
}
|
||||
|
||||
boolean remoteStart(final List<String> toks) {
|
||||
String response = getNode().remoteStart(toks.get(1), toks.get(2), toks.get(3));
|
||||
out.println(response);
|
||||
return true;
|
||||
}
|
||||
boolean remoteStop(final List<String> toks) {
|
||||
String response = getNode().remoteStop(toks.get(1), toks.get(2), toks.get(3));
|
||||
out.println(response);
|
||||
boolean remoteStart(String member, String contributionURI, String compositeURI) throws ActivationException {
|
||||
getNode().startComposite(member, contributionURI, compositeURI);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -673,23 +667,15 @@ public class Shell {
|
|||
return bye();
|
||||
}
|
||||
};
|
||||
if (op.equalsIgnoreCase("remoteStart"))
|
||||
return new Callable<Boolean>() {
|
||||
public Boolean call() throws Exception {
|
||||
return remoteStart(toks);
|
||||
}
|
||||
};
|
||||
if (op.equalsIgnoreCase("remoteStop"))
|
||||
return new Callable<Boolean>() {
|
||||
public Boolean call() throws Exception {
|
||||
return remoteStop(toks);
|
||||
}
|
||||
};
|
||||
if (op.equalsIgnoreCase("start"))
|
||||
return new Callable<Boolean>() {
|
||||
public Boolean call() throws Exception {
|
||||
if (currentDomain.length() > 0) {
|
||||
if (toks.size() == 4) {
|
||||
return remoteStart(toks.get(1), toks.get(2), toks.get(3));
|
||||
} else {
|
||||
return start(toks.get(1), toks.get(2));
|
||||
}
|
||||
} else {
|
||||
String[] duris = null;
|
||||
if (toks.contains("-duris")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue