diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-19 07:13:05 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-19 07:13:05 +0000 |
commit | 96b8adf748b455a3004b75de9f64a80747a6b399 (patch) | |
tree | 8e233bac79083d263bae1f6aa30568b659442248 /sca-java-2.x/trunk | |
parent | 8a2e35b2c973cbe5ed29d419f6ffd295e709ce96 (diff) |
Add a method to get the domain members
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1124566 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
8 files changed, 52 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java index 7a2f8c6ab0..817f232f42 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java @@ -92,4 +92,6 @@ public interface DomainRegistry { void removeRunningComposite(String contributionURI, String compositeURI); Map<String, List<String>> getRunningCompositeURIs(); Composite getRunningComposite(String contributionURI, String compositeURI); + + List<String> getMembers(); } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java index 7705ceab02..d0b8b53bf9 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.core.assembly.impl; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -226,4 +227,9 @@ public class DomainRegistryImpl extends BaseDomainRegistry implements DomainRegi listener.contributionUpdated(ic.getURI()); } } + + @Override + public List<String> getMembers() { + return Arrays.asList(new String[]{"LocalOnly"}); + } } diff --git a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java index d72f22ae63..1ccb203efb 100644 --- a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java +++ b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java @@ -876,5 +876,11 @@ public class DeployerImpl implements Deployer { public void updateInstalledContribution(InstalledContribution ic) { } + + @Override + public List<String> getMembers() { + // TODO Auto-generated method stub + return null; + } } } diff --git a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java index 11bc791fe1..3ceb3cd10e 100644 --- a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java +++ b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java @@ -649,4 +649,15 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai installedContributions.put(ic.getURI(), ic); } + @Override + public List<String> getMembers() { + List<String> members = new ArrayList<String>(); + for (Member m : hazelcastInstance.getCluster().getMembers()) { + if (!m.isSuperClient()) { + members.add(m.getInetSocketAddress().toString()); + } + } + return members; + } + } 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 5005708431..279ed709a3 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 @@ -239,6 +239,8 @@ public interface Node { void validateContribution(String string) throws ContributionReadException, ValidationException; + List<String> getMembers(); + // TODO: Add methods to get: // active members in domain // which composites are running on which members 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 bd17f9ddb3..7027ee8c53 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 @@ -387,4 +387,9 @@ public class NodeImpl implements Node { } + @Override + public List<String> getMembers() { + return domainRegistry.getMembers(); + } + } diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java index 9a6f362cb6..d2b7fb6bd9 100644 --- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedDomainRegistry.java @@ -475,4 +475,10 @@ public class ReplicatedDomainRegistry extends BaseDomainRegistry implements Doma } + @Override + public List<String> getMembers() { + // TODO Auto-generated method stub + return null; + } + } diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java index 7c32d47e8c..7302417236 100644 --- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java +++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java @@ -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", "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;
@@ -483,6 +483,13 @@ public class Shell { return true;
}
+ boolean members() {
+ for (String member : getNode().getMembers()) {
+ out.println(member);
+ }
+ return true;
+ }
+
boolean status() {
return true;
}
@@ -594,6 +601,12 @@ public class Shell { return load(toks.get(1));
}
};
+ if (op.equalsIgnoreCase("members"))
+ return new Callable<Boolean>() {
+ public Boolean call() throws Exception {
+ return members();
+ }
+ };
if (op.equalsIgnoreCase("remove"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
|