tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1124606 - in /tuscany/sca-java-2.x/trunk/modules: core-spi/src/main/java/org/apache/tuscany/sca/runtime/ core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/ domain-...
Date Thu, 19 May 2011 08:48:21 GMT
Author: antelder
Date: Thu May 19 08:48:21 2011
New Revision: 1124606

URL: http://svn.apache.org/viewvc?rev=1124606&view=rev
Log:
Update to add APIs to get at which composites are running where

Modified:
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
    tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
    tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
    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/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.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/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java?rev=1124606&r1=1124605&r2=1124606&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
Thu May 19 08:48:21 2011
@@ -94,4 +94,6 @@ public interface DomainRegistry {
     Composite getRunningComposite(String contributionURI, String compositeURI);
     
     List<String> getMembers();
+    String getLocalMember();
+    String getRunningMember(String contributionURI, String compositeURI);
 }

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java?rev=1124606&r1=1124605&r2=1124606&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
Thu May 19 08:48:21 2011
@@ -228,8 +228,19 @@ public class DomainRegistryImpl extends 
         }
     }
 
+    private static final String LOCAL_MEMBER_NAME = "LocalOnly";
     @Override
     public List<String> getMembers() {
-        return Arrays.asList(new String[]{"LocalOnly"});
+        return Arrays.asList(new String[]{LOCAL_MEMBER_NAME});
+    }
+
+    @Override
+    public String getLocalMember() {
+        return LOCAL_MEMBER_NAME;
+    }
+
+    @Override
+    public String getRunningMember(String contributionURI, String compositeURI) {
+        return LOCAL_MEMBER_NAME;
     }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java?rev=1124606&r1=1124605&r2=1124606&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
Thu May 19 08:48:21 2011
@@ -882,5 +882,17 @@ public class DeployerImpl implements Dep
             // TODO Auto-generated method stub
             return null;
         }
+
+        @Override
+        public String getLocalMember() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
+        public String getRunningMember(String contributionURI, String compositeURI) {
+            // TODO Auto-generated method stub
+            return null;
+        }
     }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java?rev=1124606&r1=1124605&r2=1124606&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
Thu May 19 08:48:21 2011
@@ -660,4 +660,21 @@ public class HazelcastDomainRegistry ext
         return members;
     }
 
+    @Override
+    public String getLocalMember() {
+        return hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress().toString();
+    }
+
+    @Override
+    public String getRunningMember(String contributionURI, String compositeURI) {
+        for (String m : runningCompositeOwners.keySet()) {
+            Map<String, List<String>> rcs = runningCompositeOwners.get(m);
+            for (String curi : rcs.keySet()) {
+                if (rcs.get(curi).contains(compositeURI)) {
+                    return m;
+                }
+            }
+        }
+        return null;
+    }
 }

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=1124606&r1=1124605&r2=1124606&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
Thu May 19 08:48:21 2011
@@ -238,12 +238,13 @@ public interface Node {
     List<String> getDeployableCompositeURIs(String contributionURI);
 
     void validateContribution(String string) throws ContributionReadException, ValidationException;
-    
+
+    // TODO: should these member getters be replaced with a getDomainRegistry?
     List<String> getMembers();
+    String getLocalMember();
+    String getRunningMember(String contributionURI, String compositeURI);
     
     // TODO: Add methods to get:
-    //   active members in domain
-    //   which composites are running on which members
     //   start and stop composites on remote members
     //   get/display contribution content
     //   a view-only Node

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=1124606&r1=1124605&r2=1124606&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
Thu May 19 08:48:21 2011
@@ -392,4 +392,14 @@ public class NodeImpl implements Node {
         return domainRegistry.getMembers();
     }
 
+    @Override
+    public String getLocalMember() {
+        return domainRegistry.getLocalMember();
+    }
+
+    @Override
+    public String getRunningMember(String contributionURI, String compositeURI) {
+        return domainRegistry.getRunningMember(contributionURI, compositeURI);
+    }
+
 }

Modified: tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java?rev=1124606&r1=1124605&r2=1124606&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java
Thu May 19 08:48:21 2011
@@ -481,4 +481,16 @@ public class ReplicatedDomainRegistry ex
         return null;
     }
 
+    @Override
+    public String getLocalMember() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getRunningMember(String contributionURI, String compositeURI) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

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=1124606&r1=1124605&r2=1124606&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
Thu May 19 08:48:21 2011
@@ -473,7 +473,18 @@ public class Shell {
 //                    if (cs != null) {
                 for (String curi : node.getStartedCompositeURIs().keySet()) {
                     for (String compositeURI : node.getStartedCompositeURIs().get(curi))
{
-                        out.println("   " + curi + " " + compositeURI);
+                        
+                        String runningMember = node.getRunningMember(curi, compositeURI);
+                        if (node.getLocalMember().equals(runningMember)) {
+                            runningMember = "this";
+                        }
+                        if ("LocalOnly".equals(runningMember)) {
+                            runningMember = ""; 
+                        } else {
+                            runningMember = " (" + runningMember + ")"; 
+                        }
+                        
+                        out.println("   " + curi + " " + compositeURI + runningMember);
                     }
                 }
 //                    }
@@ -484,8 +495,9 @@ public class Shell {
     }
 
     boolean members() {
+        String localMember = getNode().getLocalMember();
         for (String member : getNode().getMembers()) {
-            out.println(member);
+            out.println(member + (localMember.equals(member) ? " (this)" : ""));
         }
         return true;
     }



Mime
View raw message