summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-11 09:11:40 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-11 09:11:40 +0000
commitc983386e8d1e329f8189edaa7a2435f88408cd9a (patch)
tree6efd7d14a027d1a925a74dfd17fc06947add39fd /sca-java-2.x/trunk/modules
parente4cee24b41a6ddbb8981c638fb444319e9401f11 (diff)
Update the registry to store info about a contributions deployables and exports so that distrubuted nodes are able to see what is available without having to actually go get and install a remote contribution. This is work in progress, an alternative is to just put the Contribution model object itself in the registry and have the registry impl hide the details, but this approach is easier for now as we see how things can work
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1101793 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java7
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java18
-rw-r--r--sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java10
-rw-r--r--sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java15
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java7
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/sample-helloworld.jarbin4753 -> 4808 bytes
-rw-r--r--sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java25
7 files changed, 69 insertions, 13 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 0f107012c1..eaeb3373d6 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
@@ -27,6 +27,7 @@ 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
@@ -85,8 +86,12 @@ public interface EndpointRegistry {
Composite getRunningComposite(QName name);
List<QName> getRunningCompositeNames();
- void installContribution(String uri, String url);
+ 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 uninstallContribution(String uri);
+
+
}
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 61514df01f..5ac0a6bc19 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,6 +33,7 @@ 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;
@@ -50,6 +51,8 @@ public class EndpointRegistryImpl extends BaseEndpointRegistry implements Endpoi
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>>();
protected boolean quietLogging;
@@ -182,8 +185,10 @@ public class EndpointRegistryImpl extends BaseEndpointRegistry implements Endpoi
return compositeNames;
}
- public void installContribution(String uri, String url) {
+ 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 List<String> getInstalledContributionURIs() {
@@ -194,8 +199,17 @@ public class EndpointRegistryImpl extends BaseEndpointRegistry implements Endpoi
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 4dfda2f5b9..ec8be4fe35 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
@@ -851,7 +851,7 @@ public class DeployerImpl implements Deployer {
return null;
}
- public void installContribution(String uri, String url) {
+ public void installContribution(String uri, String url, List<QName> deployables, List<Export> exports) {
}
public List<String> getInstalledContributionURIs() {
@@ -864,5 +864,13 @@ public class DeployerImpl implements Deployer {
public void uninstallContribution(String uri) {
}
+
+ public List<QName> getInstalledContributionDeployables(String uri) {
+ return null;
+ }
+
+ public List<Export> getInstalledContributionExports(String uri) {
+ 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 c81b2d893a..3c1b7a2951 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
@@ -46,6 +46,7 @@ import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
+import org.apache.tuscany.sca.contribution.Export;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
@@ -567,7 +568,7 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E
}
}
- public void installContribution(String uri, String url) {
+ public void installContribution(String uri, String url, List<QName> deployables, List<Export> exports) {
installedContributions.put(uri, url);
}
@@ -582,4 +583,16 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E
public void uninstallContribution(String uri) {
installedContributions.remove(uri);
}
+
+ @Override
+ public List<QName> getInstalledContributionDeployables(String uri) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @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/NodeImpl.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
index 28a7952b19..fc7cf43711 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
@@ -107,7 +107,8 @@ public class NodeImpl implements Node {
if (uri == null) {
uri = getDefaultContributionURI(contributionURL);
}
- endpointRegistry.installContribution(uri, contributionURL);
+ // TODO: sort out deployables and exports
+ endpointRegistry.installContribution(uri, contributionURL, null, null);
if (startDeployables) {
// TODO: sort out metadata and dependents in distributed
localInstall(uri, contributionURL, metaDataURL, dependentContributionURIs, startDeployables);
@@ -454,7 +455,9 @@ public class NodeImpl implements Node {
}
public List<String> getInstalledContributionURIs() {
- return new ArrayList<String>(locallyInstalledContributions.keySet());
+ Set<String> ls = new HashSet<String>(endpointRegistry.getInstalledContributionURIs());
+ ls.addAll(locallyInstalledContributions.keySet());
+ return new ArrayList<String>(ls);
}
public Contribution getInstalledContribution(String uri) {
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/sample-helloworld.jar b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/sample-helloworld.jar
index 50e732d50b..1ea85c8e63 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/sample-helloworld.jar
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/sample-helloworld.jar
Binary files differ
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 f11bcc41fb..1edcdf498f 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,6 +47,7 @@ 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;
@@ -445,12 +446,6 @@ public class ReplicatedEndpointRegistry extends BaseEndpointRegistry implements
}
@Override
- public void installContribution(String uri, String url) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
public List<String> getInstalledContributionURIs() {
// TODO Auto-generated method stub
return null;
@@ -468,4 +463,22 @@ public class ReplicatedEndpointRegistry extends BaseEndpointRegistry implements
}
+ @Override
+ public void installContribution(String uri, String url, List<QName> deployables, List<Export> exports) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<QName> getInstalledContributionDeployables(String uri) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<Export> getInstalledContributionExports(String uri) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}