summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-06-05 08:03:28 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-06-05 08:03:28 +0000
commit9e2d4ed8a4a3cca984a5dd5e8666ccb0cddf6f0b (patch)
tree4a569229698d426ba417d827da67448649b6c038 /sca-java-2.x/trunk/modules
parent2b1149c4f65bd2b03491293e00780e36fec8d24a (diff)
Handle explicit dependent contribution URIs and implement the helper methods to get the AssemblyFactory and installed contributions
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@951671 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java b/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
index 15cc714896..8456e5954b 100644
--- a/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
+++ b/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
@@ -31,6 +31,7 @@ import java.util.Set;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.common.java.io.IOHelper;
import org.apache.tuscany.sca.contribution.Artifact;
@@ -38,6 +39,7 @@ import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.contribution.ContributionMetadata;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.deployment.Deployer;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.ValidationException;
@@ -91,8 +93,7 @@ public class Section10Impl implements Section10 {
}
public void installContribution(Contribution contribution, List<String> dependentContributionURIs, boolean deployDeployables) throws ContributionReadException, ActivationException, ValidationException {
- // TODO: dependentContributionURIs
- InstalledContribution ic = new InstalledContribution(contribution.getURI(), contribution.getLocation(), contribution);
+ InstalledContribution ic = new InstalledContribution(contribution.getURI(), contribution.getLocation(), contribution, dependentContributionURIs);
installedContributions.put(contribution.getURI(), ic);
if (deployDeployables) {
for (Composite c : ic.getDefaultDeployables()) {
@@ -231,6 +232,10 @@ public class Section10Impl implements Section10 {
return new ArrayList<String>(installedContributions.keySet());
}
+ public InstalledContribution getInstalledContribution(String uri) {
+ return installedContributions.get(uri);
+ }
+
protected String getContributionUriForArtifact(String artifactURI) {
String contributionURI = null;
for (String uri : installedContributions.keySet()) {
@@ -247,8 +252,19 @@ public class Section10Impl implements Section10 {
protected void deployComposite(Composite c, InstalledContribution ic) throws ActivationException {
List<Contribution> dependentContributions = new ArrayList<Contribution>();
- for (InstalledContribution ics : installedContributions.values()) {
- dependentContributions.add(ics.getContribution());
+ if (ic.getDependentContributionURIs() != null) {
+ // if the install specified dependent uris use just those contributions
+ for (String uri : ic.getDependentContributionURIs()) {
+ InstalledContribution dependee = installedContributions.get(uri);
+ if (dependee != null) {
+ dependentContributions.add(dependee.getContribution());
+ }
+ }
+ } else {
+ // otherwise use all available contributions for dependents
+ for (InstalledContribution ics : installedContributions.values()) {
+ dependentContributions.add(ics.getContribution());
+ }
}
DeployedComposite dc = new DeployedComposite(c, ic, dependentContributions, deployer, compositeActivator, endpointRegistry, extensionPointRegistry);
@@ -275,4 +291,10 @@ public class Section10Impl implements Section10 {
public Deployer getDeployer() {
return deployer;
}
+
+ public AssemblyFactory getAssemblyFactory() {
+ FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class);
+ return factories.getFactory(AssemblyFactory.class);
+ }
+
}