tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1125259 - in /tuscany/sca-java-2.x/trunk/modules: domain-node/src/main/java/org/apache/tuscany/sca/Node.java domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
Date Fri, 20 May 2011 07:03:12 GMT
Author: antelder
Date: Fri May 20 07:03:12 2011
New Revision: 1125259

URL: http://svn.apache.org/viewvc?rev=1125259&view=rev
Log:
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

Modified:
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
    tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java?rev=1125259&r1=1125258&r2=1125259&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
Fri May 20 07:03:12 2011
@@ -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)

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java?rev=1125259&r1=1125258&r2=1125259&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
Fri May 20 07:03:12 2011
@@ -33,8 +33,6 @@ import javax.xml.stream.XMLStreamExcepti
 
 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.contributi
 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));
-    }
-
 }

Modified: tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java?rev=1125259&r1=1125258&r2=1125259&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
Fri May 20 07:03:12 2011
@@ -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) {
-                        return start(toks.get(1), toks.get(2));
+                        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")) {



Mime
View raw message