summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-06 12:39:55 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-06 12:39:55 +0000
commitc2aa33764648853cb341ad0b9d09e0c6862b04a7 (patch)
tree51e9ebdf1b9bf0ebd2f226894ffb22515911dd7d
parent30b05cbf1144acd22ca40256e52cacc3921a01ea (diff)
Add a method to the DomainRegistry to get the contribution uri for the composite taht contains a running component
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1132615 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java31
-rw-r--r--sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java2
2 files changed, 29 insertions, 4 deletions
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 c6e3060c21..4bf120a641 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
@@ -101,7 +101,10 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai
// key contributionURI, value map key compositeURI value compositeXML
protected Map<String, Map<String, String>> runningComposites;
+ // key member, value map key contributionURI value list of compositeURI
protected Map<String, Map<String, List<String>>> runningCompositeOwners;
+ // key componentName, value contributionURI
+ protected Map<String, String> runningComponentContributions;
protected Map<Object, Object> endpointWsdls;
protected Map<String, Endpoint> localEndpoints = new ConcurrentHashMap<String, Endpoint>();
@@ -148,8 +151,9 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai
runningComposites = hazelcastInstance.getMap(domainURI + "/RunningComposites");
runningCompositeOwners = hazelcastInstance.getMap(domainURI + "/RunningCompositeOwners");
-
- contributionDescriptions = hazelcastInstance.getMap(domainURI + "/InstalledContributions");
+ runningComponentContributions = hazelcastInstance.getMap(domainURI + "/RunningComponentContributions");
+
+ contributionDescriptions = hazelcastInstance.getMap(domainURI + "/ContributionDescriptions");
((IMap<String, ContributionDescription>)contributionDescriptions).addEntryListener(new EntryListener<String, ContributionDescription>() {
public void entryAdded(EntryEvent<String, ContributionDescription> event) {
}
@@ -287,6 +291,14 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai
String localMemberAddr = hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress().toString();
String endpointURI = endpoint.getURI();
String wsdl = getWsdl(endpoint);
+ String componentName = endpoint.getComponent().getName();
+ String curi = null;
+ if (endpoint instanceof RuntimeEndpoint) {
+ Composite dc = ((RuntimeEndpoint)endpoint).getCompositeContext().getDomainComposite();
+ if (dc != null) {
+ curi = dc.getContributionURI();
+ }
+ }
Transaction txn = hazelcastInstance.getTransaction();
txn.begin();
try {
@@ -294,6 +306,9 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai
endpointMap.put(endpointURI, endpoint);
endpointWsdls.put(endpointURI, wsdl);
endpointOwners.put(localMemberAddr, endpointURI);
+ if (curi != null) {
+ runningComponentContributions.put(componentName, curi);
+ }
txn.commit();
} catch (Throwable e) {
txn.rollback();
@@ -395,13 +410,14 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai
synchronized (shutdownMutex) {
String localMemberAddr = hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress().toString();
String endpointURI = endpoint.getURI();
-
+ String componentName = endpoint.getComponent().getName();
Transaction txn = hazelcastInstance.getTransaction();
txn.begin();
try {
endpointOwners.remove(localMemberAddr, endpointURI);
endpointMap.remove(endpointURI);
endpointWsdls.remove(endpointURI);
+ runningComponentContributions.remove(componentName);
txn.commit();
} catch (Throwable e) {
txn.rollback();
@@ -468,7 +484,8 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai
if (endpointOwners.containsKey(memberAddr)) {
Collection<String> keys = endpointOwners.remove(memberAddr);
for (Object k : keys) {
- endpointMap.remove(k);
+ Endpoint endpoint = (Endpoint)endpointMap.remove(k);
+ runningComponentContributions.remove(endpoint.getComponent().getName());
endpointWsdls.remove(k);
}
}
@@ -699,4 +716,10 @@ public class HazelcastDomainRegistry extends BaseDomainRegistry implements Domai
}
throw new IllegalArgumentException("member not found: " + memberName);
}
+
+ @Override
+ public String getContainingCompositesContributionURI(String componentName) {
+ int x = runningComponentContributions.size();
+ return runningComponentContributions.get(componentName);
+ }
}
diff --git a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java
index 264c67c7ca..05fc47b884 100644
--- a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java
@@ -61,6 +61,8 @@ public class HazelcastClientEndpointRegistry extends HazelcastDomainRegistry {
endpointMap = hazelcastClient.getMap(rc.getUserid() + "/Endpoints");
endpointOwners = hazelcastClient.getMultiMap(rc.getUserid() + "/EndpointOwners");
endpointWsdls = hazelcastClient.getMap(rc.getUserid() + "/EndpointWsdls");
+ runningComponentContributions = hazelcastClient.getMap(rc.getUserid() + "/RunningComponentContributions");
+ contributionDescriptions = hazelcastClient.getMap(rc.getUserid() + "/ContributionDescriptions");
}
@Override