summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java22
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java85
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java72
-rw-r--r--sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java25
-rw-r--r--sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java104
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java4
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java19
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java1
-rw-r--r--sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java34
9 files changed, 233 insertions, 133 deletions
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java
index eaeb3373d6..8379841fe4 100644
--- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java
@@ -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);
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
new file mode 100644
index 0000000000..322817cd71
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/InstalledContribution.java
@@ -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;
+ }
+}
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java
index 5ac0a6bc19..f371cb5744 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java
@@ -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 extends BaseEndpointRegistry implements Endpoi
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 extends BaseEndpointRegistry implements Endpoi
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);
- }
}
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 ec8be4fe35..6400497f05 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
@@ -89,6 +89,7 @@ import org.apache.tuscany.sca.monitor.MonitorFactory;
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 Deployer {
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;
}
}
diff --git a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
index 3c1b7a2951..3ba62bbf85 100644
--- a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java
@@ -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.interfacedef.wsdl.WSDLInterface;
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 extends BaseEndpointRegistry implements 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 extends BaseEndpointRegistry implements 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 extends BaseEndpointRegistry implements 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 extends BaseEndpointRegistry implements 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 extends BaseEndpointRegistry implements 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 extends BaseEndpointRegistry implements 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 extends BaseEndpointRegistry implements 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 extends BaseEndpointRegistry implements 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;
- }
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java
index 1b3b244d08..ca09979501 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java
@@ -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);
}
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 fc7cf43711..d97ad336b2 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
@@ -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;
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
index 89ddffc710..ce5ba2432c 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
@@ -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");
diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
index 1edcdf498f..f5b54f1ea8 100644
--- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
@@ -47,7 +47,6 @@ import org.apache.catalina.tribes.membership.StaticMember;
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.tribes.MapStore.MapListener;
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 extends BaseEndpointRegistry implements
}
@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;
}