summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/deployment
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-26 20:05:38 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-26 20:05:38 +0000
commit142168eae3c0ca47bdb22bb539b746b7b2607888 (patch)
tree5093a12f451f83c48540c6b8162a93d11e2671b5 /sca-java-2.x/trunk/modules/deployment
parente766494b2c34ae0f7ae0f9da01deb66ea0b13de6 (diff)
Update Deployer.attachDeploymentComposite to return the URI of the attached composite
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@948564 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/deployment')
-rw-r--r--sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java4
-rw-r--r--sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java20
2 files changed, 19 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
index 0b75ade042..9c5d19816c 100644
--- a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
+++ b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
@@ -66,12 +66,14 @@ public interface Deployer extends LifeCycleListener {
* @param contribution The target contribution
* @param composite The deployment composite
* @param appending A flag to indicate if existing deployable composites in the contribution should be appended or replaced
+ * @return uri of attached composite
*/
- void attachDeploymentComposite(Contribution contribution, Composite composite, boolean appending);
+ String attachDeploymentComposite(Contribution contribution, Composite composite, boolean appending);
/**
* Configure a list of contributions to create a composite representing a view of the domain
* @param contributions
+ * @param allContributions
* @param bindingBaseURIs
* @param monitor
* @return
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 d8dd13f5be..ecf2adfb85 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
@@ -423,14 +423,25 @@ public class DeployerImpl implements Deployer {
return contribution;
}
- public void attachDeploymentComposite(Contribution contribution, Composite composite, boolean appending) {
+ public String attachDeploymentComposite(Contribution contribution, Composite composite, boolean appending) {
init();
+
+ String compositeArtifactURI = composite.getName().getLocalPart() + ".composite";
+
+ if (appending) {
+ // check its not already there
+ for (Artifact a : contribution.getArtifacts()) {
+ if (compositeArtifactURI.equals(a.getURI())) {
+ throw new IllegalStateException("artifact '" + compositeArtifactURI + "' already exists in contribution: " + contribution.getURI());
+ }
+ }
+ }
+
// Create an artifact for the deployment composite
Artifact artifact = contributionFactory.createArtifact();
- String uri = composite.getName().getLocalPart() + ".composite";
- artifact.setURI(uri);
+ artifact.setURI(compositeArtifactURI);
- artifact.setLocation(uri);
+ artifact.setLocation(compositeArtifactURI);
artifact.setModel(composite);
artifact.setUnresolved(false);
// Add it to the contribution
@@ -442,6 +453,7 @@ public class DeployerImpl implements Deployer {
contribution.getDeployables().clear();
}
contribution.getDeployables().add(composite);
+ return compositeArtifactURI;
}
public Composite build(List<Contribution> contributions, List<Contribution> allContributions, Map<QName, List<String>> bindingMap, Monitor monitor)