tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1132615 - in /tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast: HazelcastDomainRegistry.java client/HazelcastClientEndpointRegistry.java
Date Mon, 06 Jun 2011 12:39:56 GMT
Author: antelder
Date: Mon Jun  6 12:39:55 2011
New Revision: 1132615

URL: http://svn.apache.org/viewvc?rev=1132615&view=rev
Log:
Add a method to the DomainRegistry to get the contribution uri for the composite taht contains
a running component

Modified:
    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-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java

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=1132615&r1=1132614&r2=1132615&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
Mon Jun  6 12:39:55 2011
@@ -101,7 +101,10 @@ public class HazelcastDomainRegistry ext
     
     // 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 ext
 
             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 ext
         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 ext
             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 ext
         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 ext
                         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 ext
         }
         throw new IllegalArgumentException("member not found: " + memberName);
     }
+
+    @Override
+    public String getContainingCompositesContributionURI(String componentName) {
+        int x = runningComponentContributions.size();
+        return runningComponentContributions.get(componentName);
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.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/client/HazelcastClientEndpointRegistry.java?rev=1132615&r1=1132614&r2=1132615&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/client/HazelcastClientEndpointRegistry.java
Mon Jun  6 12:39:55 2011
@@ -61,6 +61,8 @@ public class HazelcastClientEndpointRegi
         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



Mime
View raw message