tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1102252 - 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, 12 May 2011 11:54:26 GMT
Author: antelder
Date: Thu May 12 11:54:25 2011
New Revision: 1102252

URL: http://svn.apache.org/viewvc?rev=1102252&view=rev
Log:
Update the registry to use a single class for all the installed contribution attributes, and
to correct the storing of running composites to be qualified by the contribution uri. As per
a previous commit comment this is still work in progress so a little rough, but its getting
closer now to show the type of thing thats needed

Added:
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
Modified:
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.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/endpoint/hazelcast/HazelcastEndpointRegistry.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.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/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
    tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java?rev=1102252&r1=1102251&r2=1102252&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java
Thu May 12 11:54:25 2011
@@ -21,13 +21,13 @@ package org.apache.tuscany.sca.runtime;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.Endpoint;
 import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.Export;
 
 /**
  * The EndpointRegistry holds the active service endpoints for the SCA domain
@@ -81,17 +81,13 @@ public interface EndpointRegistry {
 
     String getDomainURI();
 
-    void addRunningComposite(Composite composite);
-    void removeRunningComposite(QName name);
-    Composite getRunningComposite(QName name);
-    List<QName> getRunningCompositeNames();
-    
-    void installContribution(String uri, String url, List<QName> deployables, List<Export>
exports);
-    List<String> getInstalledContributionURIs();
-    String getInstalledContributionURL(String uri);
-    List<QName> getInstalledContributionDeployables(String uri);
-    List<Export> getInstalledContributionExports(String uri);
+    void installContribution(InstalledContribution ic);
     void uninstallContribution(String uri);
-    
-    
+    List<String> getInstalledContributionURIs();
+    InstalledContribution getInstalledContribution(String uri);
+
+    void addRunningComposite(String contributionURI, Composite composite);
+    void removeRunningComposite(String contributionURI, QName name);
+    Map<String, List<QName>> getRunningCompositeNames();
+    Composite getRunningComposite(String contributionURI, QName name);
 }

Added: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java?rev=1102252&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
(added)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
Thu May 12 11:54:25 2011
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.runtime;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class InstalledContribution implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String uri;
+    private String url;
+    private List<String> dependentContributionURIs = new ArrayList<String>();
+
+    // the URIs of the deployable composites within the contribution
+    private List<String> deployables = new ArrayList<String>();
+
+    private List<String> exports = new ArrayList<String>();
+    
+    private String metaData;
+    private boolean overwriteMetaData;
+    
+    // the URI and XML content of composites to include in the contribution
+    private Map<String, String> additionalDeployables = new HashMap<String, String>();
+
+    public String getURI() {
+        return uri;
+    }
+    public void setURI(String uri) {
+        this.uri = uri;
+    }
+    public String getURL() {
+        return url;
+    }
+    public void setURL(String url) {
+        this.url = url;
+    }
+    public List<String> getDeployables() {
+        return deployables;
+    }
+    public List<String> getExports() {
+        return exports;
+    }
+    public void setDeployables(List<String> deployables) {
+        this.deployables = deployables;
+    }
+    public List<String> getDependentContributionURIs() {
+        return dependentContributionURIs;
+    }
+    public String getMetaData() {
+        return metaData;
+    }
+    public void setMetaData(String metaData) {
+        this.metaData = metaData;
+    }
+    public boolean isOverwriteMetaData() {
+        return overwriteMetaData;
+    }
+    public void setOverwriteMetaData(boolean overwriteMetaData) {
+        this.overwriteMetaData = overwriteMetaData;
+    }
+    public Map<String, String> getAdditionalDeployables() {
+        return additionalDeployables;
+    }
+}

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.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/EndpointRegistryImpl.java?rev=1102252&r1=1102251&r2=1102252&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java
Thu May 12 11:54:25 2011
@@ -33,13 +33,13 @@ import javax.xml.namespace.QName;
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.contribution.Export;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.LifeCycleListener;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
 import org.apache.tuscany.sca.runtime.EndpointListener;
 import org.apache.tuscany.sca.runtime.EndpointRegistry;
+import org.apache.tuscany.sca.runtime.InstalledContribution;
 import org.apache.tuscany.sca.runtime.RuntimeProperties;
 
 /**
@@ -49,10 +49,8 @@ public class EndpointRegistryImpl extend
     private final Logger logger = Logger.getLogger(EndpointRegistryImpl.class.getName());
 
     private List<Endpoint> endpoints = new ArrayList<Endpoint>();
-    private Map<QName, Composite> runningComposites = new HashMap<QName, Composite>();
-    private Map<String, String> installedContributions = new HashMap<String, String>();
-    private Map<String, List<QName>> installedContributionsDeployables = new
HashMap<String, List<QName>>();
-    private Map<String, List<Export>> installedContributionsExports = new HashMap<String,
List<Export>>();
+    private Map<String, Map<QName, Composite>> runningComposites = new HashMap<String,
Map<QName, Composite>>();
+    private Map<String, InstalledContribution> installedContributions = new HashMap<String,
InstalledContribution>();
     
     protected boolean quietLogging;
 
@@ -165,51 +163,55 @@ public class EndpointRegistryImpl extend
         listeners.clear();
     }
 
-    public void addRunningComposite(Composite composite) {
-        runningComposites.put(composite.getName(), composite);
+    public void addRunningComposite(String curi, Composite composite) {
+        Map<QName, Composite> cs = runningComposites.get(curi);
+        if (cs == null) {
+            cs = new HashMap<QName, Composite>();
+            runningComposites.put(curi, cs);
+        }
+        cs.put(composite.getName(), composite);
     }
 
-    public void removeRunningComposite(QName name) {
-        runningComposites.remove(name);
+    public void removeRunningComposite(String curi, QName name) {
+        Map<QName, Composite> cs = runningComposites.get(curi);
+        if (cs != null) {
+            cs.remove(name);
+        }
     }
 
-    public Composite getRunningComposite(QName name) {
-        return runningComposites.get(name);
+    public Composite getRunningComposite(String curi, QName name) {
+        Map<QName, Composite> cs = runningComposites.get(curi);
+        if (cs != null) {
+            return cs.get(name);
+        }
+        return null;
     }
 
-    public List<QName> getRunningCompositeNames() {
-        List<QName> compositeNames = new ArrayList<QName>();
-        for (Composite composite : runningComposites.values()) {
-            compositeNames.add(composite.getName());
-        }
+    public Map<String, List<QName>> getRunningCompositeNames() {
+       Map<String, List<QName>> compositeNames = new HashMap<String, List<QName>>();
+       for (String curi : runningComposites.keySet()) {
+           List<QName> names = new ArrayList<QName>();
+           compositeNames.put(curi, names);
+           for (QName qn : runningComposites.get(curi).keySet()) {
+               names.add(qn);
+           }
+       }
         return compositeNames;
     }
 
-    public void installContribution(String uri, String url, List<QName> deployables,
List<Export> exports) {
-        installedContributions.put(uri, url);
-        installedContributionsDeployables.put(uri, deployables);
-        installedContributionsExports.put(uri, exports);
+    public void installContribution(InstalledContribution ic) {
+        installedContributions.put(ic.getURI(), ic);
+    }
+
+    public void uninstallContribution(String uri) {
+        installedContributions.remove(uri);
     }
 
     public List<String> getInstalledContributionURIs() {
         return new ArrayList<String>(installedContributions.keySet());
     }
 
-    public String getInstalledContributionURL(String uri) {
+    public InstalledContribution getInstalledContribution(String uri) {
         return installedContributions.get(uri);
     }
-
-    public List<QName> getInstalledContributionDeployables(String uri) {
-        return installedContributionsDeployables.get(uri);
-    }
-
-    public List<Export> getInstalledContributionExports(String uri) {
-        return installedContributionsExports.get(uri);
-    }
-
-    public void uninstallContribution(String uri) {
-        installedContributions.remove(uri);
-        installedContributionsDeployables.remove(uri);
-        installedContributionsExports.remove(uri);
-    }
 }

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=1102252&r1=1102251&r2=1102252&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 12 11:54:25 2011
@@ -89,6 +89,7 @@ import org.apache.tuscany.sca.monitor.Mo
 import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
 import org.apache.tuscany.sca.runtime.EndpointReferenceBinder;
 import org.apache.tuscany.sca.runtime.EndpointRegistry;
+import org.apache.tuscany.sca.runtime.InstalledContribution;
 import org.apache.tuscany.sca.xsd.XSDFactory;
 import org.apache.tuscany.sca.xsd.XSDefinition;
 
@@ -837,39 +838,31 @@ public class DeployerImpl implements Dep
         public void stop() {
         }
 
-        public void addRunningComposite(Composite composite) {
-        }
-
-        public void removeRunningComposite(QName name) {
-        }
-
-        public Composite getRunningComposite(QName name) {
+        public List<String> getInstalledContributionURIs() {
             return null;
         }
 
-        public List<QName> getRunningCompositeNames() {
-            return null;
+        public void uninstallContribution(String uri) {
         }
 
-        public void installContribution(String uri, String url, List<QName> deployables,
List<Export> exports) {
+        public void installContribution(InstalledContribution ic) {
         }
 
-        public List<String> getInstalledContributionURIs() {
+        public InstalledContribution getInstalledContribution(String uri) {
             return null;
         }
 
-        public String getInstalledContributionURL(String uri) {
-            return null;
+        public void addRunningComposite(String contributionURI, Composite composite) {
         }
 
-        public void uninstallContribution(String uri) {
+        public void removeRunningComposite(String contributionURI, QName name) {
         }
 
-        public List<QName> getInstalledContributionDeployables(String uri) {
+        public Composite getRunningComposite(String contributionURI, QName name) {
             return null;
         }
 
-        public List<Export> getInstalledContributionExports(String uri) {
+        public Map<String, List<QName>> getRunningCompositeNames() {
             return null;
         }
     }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java?rev=1102252&r1=1102251&r2=1102252&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
Thu May 12 11:54:25 2011
@@ -26,6 +26,7 @@ import java.io.StringReader;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -63,6 +64,7 @@ import org.apache.tuscany.sca.interfaced
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
 import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
 import org.apache.tuscany.sca.runtime.EndpointRegistry;
+import org.apache.tuscany.sca.runtime.InstalledContribution;
 import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
 import org.apache.tuscany.sca.runtime.RuntimeProperties;
 import org.oasisopen.sca.ServiceRuntimeException;
@@ -95,14 +97,13 @@ public class HazelcastEndpointRegistry e
 
     protected Map<Object, Object> endpointMap;
     protected MultiMap<String, String> endpointOwners;
-
-    protected Map<QName, String> runningComposites;
-    protected MultiMap<String, QName> runningCompositeOwners;
+    protected Map<String, Map<QName, String>> runningComposites;
+    protected Map<String, Map<String, List<QName>>> runningCompositeOwners;
 
     protected Map<Object, Object> endpointWsdls;
     protected Map<String, Endpoint> localEndpoints = new ConcurrentHashMap<String,
Endpoint>();
 
-    protected Map<String, String> installedContributions;
+    protected Map<String, InstalledContribution> installedContributions;
 
     protected AssemblyFactory assemblyFactory;
     protected Object shutdownMutex = new Object();
@@ -142,8 +143,8 @@ public class HazelcastEndpointRegistry e
             endpointOwners = hazelcastInstance.getMultiMap(domainURI + "/EndpointOwners");
             endpointWsdls = hazelcastInstance.getMap(domainURI + "/EndpointWsdls");
 
-            runningComposites = hazelcastInstance.getMap(domainURI + "/CompositeOwners");
-            runningCompositeOwners = hazelcastInstance.getMultiMap(domainURI + "/CompositeOwners");
+            runningComposites = hazelcastInstance.getMap(domainURI + "/RunningComposites");
+            runningCompositeOwners = hazelcastInstance.getMap(domainURI + "/RunningCompositeOwners");
 
             installedContributions = hazelcastInstance.getMap(domainURI + "/InstalledContributions");
             
@@ -454,9 +455,12 @@ public class HazelcastEndpointRegistry e
                             }
                         }
                         if (runningCompositeOwners.containsKey(memberAddr)) {
-                            Collection<QName> keys = runningCompositeOwners.remove(memberAddr);
-                            for (QName k : keys) {
-                                runningComposites.remove(k);
+                            Map<String, List<QName>> cs = runningCompositeOwners.remove(memberAddr);
+                            for (String curi : cs.keySet()) {
+                                Map<QName, String> rcs = runningComposites.get(curi);
+                                for (QName qn : cs.get(curi)) {
+                                    rcs.remove(qn);
+                                }
                             }
                         }
                     } finally {
@@ -491,15 +495,30 @@ public class HazelcastEndpointRegistry e
         return null;
     }
 
-    public void addRunningComposite(Composite composite) {
+    public void addRunningComposite(String curi, Composite composite) {
         String localMemberAddr = hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress().toString();
         String compositeXML = writeComposite(composite);
 // TODO: doing this in a txn causes the values to get lost - looks like a bug in hazelcast
       
 //        Transaction txn = hazelcastInstance.getTransaction();
 //        txn.begin();
 //        try {
-            runningComposites.put(composite.getName(), compositeXML);
-            runningCompositeOwners.put(localMemberAddr, composite.getName());
+        Map<QName, String> cs = runningComposites.get(curi);
+        if (cs == null) {
+            cs = new HashMap<QName, String>();
+        }
+        cs.put(composite.getName(), compositeXML);
+        runningComposites.put(curi, cs);
+        Map<String, List<QName>> ocs = runningCompositeOwners.get(localMemberAddr);
+        if (ocs == null) {
+            ocs = new HashMap<String, List<QName>>();
+        }
+        List<QName> lcs = ocs.get(curi);
+        if (lcs == null) {
+            lcs = new ArrayList<QName>();
+            ocs.put(curi, lcs);
+        }
+        lcs.add(composite.getName());
+        runningCompositeOwners.put(localMemberAddr, ocs);
 //            txn.commit();
 //        } catch (Throwable e) {
 //            txn.rollback();
@@ -507,13 +526,22 @@ public class HazelcastEndpointRegistry e
 //        }
     }
 
-    public void removeRunningComposite(QName name) {
+    public void removeRunningComposite(String curi, QName name) {
         String localMemberAddr = hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress().toString();
         Transaction txn = hazelcastInstance.getTransaction();
         txn.begin();
         try {
-            runningComposites.remove(name);
-            runningCompositeOwners.remove(localMemberAddr, name);
+            Map<QName, String> cs = runningComposites.get(curi);
+            if (cs != null) {
+                cs.remove(name);
+            }
+            Map<String, List<QName>> ocs = runningCompositeOwners.get(localMemberAddr);
+            if (ocs != null) {
+                List<QName> xya = ocs.get(curi);
+                if (xya != null) {
+                    xya.remove(name);
+                }
+            }
             txn.commit();
         } catch (Throwable e) {
             txn.rollback();
@@ -521,20 +549,26 @@ public class HazelcastEndpointRegistry e
         }
     }
 
-    public Composite getRunningComposite(QName name) {
-        String compositeXML = runningComposites.get(name);
-        return readComposite(compositeXML);
+    public Map<String, List<QName>> getRunningCompositeNames() {
+        Map<String, List<QName>> compositeNames = new HashMap<String, List<QName>>();
+        for (String curi : runningComposites.keySet()) {
+            List<QName> names = new ArrayList<QName>();
+            compositeNames.put(curi, names);
+            for (QName qn : runningComposites.get(curi).keySet()) {
+                names.add(qn);
+            }
+        }
+         return compositeNames;
     }
 
-    public List<QName> getRunningCompositeNames() {
-//        List<QName> names = new ArrayList<QName>();
-//        for (String s : runningCompositeOwners.keySet()) {
-//            for (QName name : runningCompositeOwners.get(s)) {
-//                names.add(name);
-//            }
-//        }
-//        return names;
-        return new ArrayList<QName>(runningCompositeOwners.values());
+    @Override
+    public Composite getRunningComposite(String contributionURI, QName name) {
+        Map<QName, String> cs = runningComposites.get(contributionURI);
+        if (cs != null) {
+            String compositeXML = cs.get(name);
+            return readComposite(compositeXML);
+        }
+        return null;
     }
 
     protected Composite readComposite(String compositeXML) {
@@ -568,15 +602,11 @@ public class HazelcastEndpointRegistry e
         }
     }
 
-    public void installContribution(String uri, String url, List<QName> deployables,
List<Export> exports) {
-        installedContributions.put(uri, url);
-    }
-
     public List<String> getInstalledContributionURIs() {
         return new ArrayList<String>(installedContributions.keySet());
     }
 
-    public String getInstalledContributionURL(String uri) {
+    public InstalledContribution getInstalledContribution(String uri) {
         return installedContributions.get(uri);
     }
 
@@ -585,14 +615,8 @@ public class HazelcastEndpointRegistry e
     }
 
     @Override
-    public List<QName> getInstalledContributionDeployables(String uri) {
-        // TODO Auto-generated method stub
-        return null;
+    public void installContribution(InstalledContribution ic) {
+        installedContributions.put(ic.getURI(), ic);
     }
 
-    @Override
-    public List<Export> getInstalledContributionExports(String uri) {
-        // TODO Auto-generated method stub
-        return null;
-    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java?rev=1102252&r1=1102251&r2=1102252&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java
Thu May 12 11:54:25 2011
@@ -101,11 +101,11 @@ public class DeployedComposite {
     public void start() throws ActivationException {
         compositeActivator.activate(compositeContext, builtComposite);
         compositeActivator.start(compositeContext, builtComposite);
-        endpointRegistry.addRunningComposite(builtComposite);
+        endpointRegistry.addRunningComposite(installedContribution.getURI(), builtComposite);
     }
 
     public void stop() throws ActivationException {
-        endpointRegistry.removeRunningComposite(builtComposite.getName());
+        endpointRegistry.removeRunningComposite(installedContribution.getURI(), builtComposite.getName());
         compositeActivator.stop(compositeContext, builtComposite);
         compositeActivator.deactivate(builtComposite);
     }

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=1102252&r1=1102251&r2=1102252&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 12 11:54:25 2011
@@ -108,7 +108,10 @@ public class NodeImpl implements Node {
             uri = getDefaultContributionURI(contributionURL);
         }
         // TODO: sort out deployables and exports
-        endpointRegistry.installContribution(uri, contributionURL, null, null);
+        org.apache.tuscany.sca.runtime.InstalledContribution ic = new org.apache.tuscany.sca.runtime.InstalledContribution();
+        ic.setURI(uri);
+        ic.setURL(contributionURL);
+        endpointRegistry.installContribution(ic);
         if (startDeployables) {
             // TODO: sort out metadata and dependents in distributed
             localInstall(uri, contributionURL, metaDataURL, dependentContributionURIs, startDeployables);
@@ -202,7 +205,12 @@ public class NodeImpl implements Node {
     public void start(String contributionURI, String compositeURI) throws ActivationException,
ValidationException, ContributionReadException {
         InstalledContribution ic = locallyInstalledContributions.get(contributionURI);
         if (ic == null) {
-            String url = endpointRegistry.getInstalledContributionURL(contributionURI);
+            
+            org.apache.tuscany.sca.runtime.InstalledContribution icx = endpointRegistry.getInstalledContribution(contributionURI);
+            String url = null;
+            if (icx != null) {
+                url  = icx.getURL();
+            }
             if (url == null) {
                 throw new IllegalArgumentException("Contribution not installed: " + contributionURI);
             }
@@ -237,8 +245,11 @@ public class NodeImpl implements Node {
         domainComposite.setAutowire(false);
         domainComposite.setLocal(false);
         List<Composite> domainIncludes = domainComposite.getIncludes();
-        for (QName compositeName : endpointRegistry.getRunningCompositeNames()) {
-            domainIncludes.add(endpointRegistry.getRunningComposite(compositeName));
+        Map<String, List<QName>> runningComposites = endpointRegistry.getRunningCompositeNames();
+        for (String curi : runningComposites.keySet()) {
+            for (QName name : runningComposites.get(curi)) {
+                domainIncludes.add(endpointRegistry.getRunningComposite(curi, name));
+            }
         }
         return domainComposite;
     }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java?rev=1102252&r1=1102251&r2=1102252&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
Thu May 12 11:54:25 2011
@@ -36,6 +36,7 @@ public class DomainCompositeTestCase {
         Node node = TuscanyRuntime.newInstance().createNode("DomainCompositeTestCase.localOnlyDomain");
         testIt(node);
     }
+
     @Test
     public void distributedDomain() throws NoSuchServiceException, NoSuchDomainException,
ContributionReadException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("uri:DomainCompositeTestCase.distributedDomain");

Modified: tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.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/ReplicatedEndpointRegistry.java?rev=1102252&r1=1102251&r2=1102252&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
Thu May 12 11:54:25 2011
@@ -47,7 +47,6 @@ import org.apache.catalina.tribes.member
 import org.apache.catalina.tribes.transport.ReceiverBase;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.contribution.Export;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.LifeCycleListener;
 import org.apache.tuscany.sca.endpoint.tribes.AbstractReplicatedMap.MapEntry;
@@ -55,6 +54,7 @@ import org.apache.tuscany.sca.endpoint.t
 import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
 import org.apache.tuscany.sca.runtime.DomainRegistryURI;
 import org.apache.tuscany.sca.runtime.EndpointRegistry;
+import org.apache.tuscany.sca.runtime.InstalledContribution;
 import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
 
 /**
@@ -422,61 +422,49 @@ public class ReplicatedEndpointRegistry 
     }
 
     @Override
-    public void addRunningComposite(Composite composite) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    @Override
-    public void removeRunningComposite(QName name) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    @Override
-    public Composite getRunningComposite(QName name) {
+    public List<String> getInstalledContributionURIs() {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public List<QName> getRunningCompositeNames() {
+    public void uninstallContribution(String uri) {
         // TODO Auto-generated method stub
-        return null;
+        
     }
 
     @Override
-    public List<String> getInstalledContributionURIs() {
+    public void installContribution(InstalledContribution ic) {
         // TODO Auto-generated method stub
-        return null;
+        
     }
 
     @Override
-    public String getInstalledContributionURL(String uri) {
+    public InstalledContribution getInstalledContribution(String uri) {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public void uninstallContribution(String uri) {
+    public void addRunningComposite(String contributionURI, Composite composite) {
         // TODO Auto-generated method stub
         
     }
 
     @Override
-    public void installContribution(String uri, String url, List<QName> deployables,
List<Export> exports) {
+    public void removeRunningComposite(String contributionURI, QName name) {
         // TODO Auto-generated method stub
         
     }
 
     @Override
-    public List<QName> getInstalledContributionDeployables(String uri) {
+    public Composite getRunningComposite(String contributionURI, QName name) {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public List<Export> getInstalledContributionExports(String uri) {
+    public Map<String, List<QName>> getRunningCompositeNames() {
         // TODO Auto-generated method stub
         return null;
     }



Mime
View raw message