diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/main/java/org')
3 files changed, 15 insertions, 18 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java index 7606fa415a..5f4e4d3017 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java @@ -181,21 +181,23 @@ public interface Node { * 4685 services and references in the supplied composite is not defined; since there is no composite scope * 4686 outside the domain composite, the usual idea of promotion has no utility. * + * @param cotributionURI * @param compositeURI * @throws ActivationException * @throws ValidationException */ - void addToDomainLevelComposite(String compositeURI) throws ActivationException, ValidationException; + void addToDomainLevelComposite(String contributionURI, String compositeURI) throws ActivationException, ValidationException; /** * 4687 10.7.2 remove From Domain-Level Composite * 4688 Removes from the Domain Level composite the elements corresponding to the composite identified by a * 4689 supplied composite URI. This means that the removal of the components, wires, services and references * 4690 originally added to the domain level composite by the identified composite. * + * @param contributionURI * @param compositeURI * @throws ActivationException */ - void removeFromDomainLevelComposite(String compositeURI) throws ActivationException; + void removeFromDomainLevelComposite(String contributionURI, String compositeURI) throws ActivationException; /** * 10.7.3 get Domain-Level Composite diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java index 9c8219564e..7ff724b0bb 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java @@ -72,13 +72,7 @@ public class NodeFactory { String curi = node.installContribution(null, contributionURL, null, null, compositeURI == null); if (compositeURI != null) { - if (curi.endsWith("/")) { - curi = curi + compositeURI; - } else { - curi = curi + "/" + compositeURI; - } - // TODO: change addToDomainLevelComposite to take curi, compositeURI - node.addToDomainLevelComposite(curi); + node.addToDomainLevelComposite(curi, compositeURI); } return node; diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/impl/NodeImpl.java index e0c7db3286..19159e96b8 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/impl/NodeImpl.java @@ -161,15 +161,14 @@ public class NodeImpl implements Node { return compositeArtifcatURI; } - public void addToDomainLevelComposite(String compositeURI) throws ActivationException, ValidationException { - String contributionURI = getContributionUriForArtifact(compositeURI); + @Override + public void addToDomainLevelComposite(String contributionURI, String compositeURI) throws ActivationException, ValidationException { InstalledContribution ic = installedContributions.get(contributionURI); if (ic == null) { throw new IllegalArgumentException("Contribution not installed: " + contributionURI); } - String relativeURI = compositeURI.substring(contributionURI.endsWith("/") ? contributionURI.length() : contributionURI.length()+1); for (Artifact a : ic.getContribution().getArtifacts()) { - if (a.getURI().equals(relativeURI)) { + if (a.getURI().equals(compositeURI)) { runComposite((Composite) a.getModel(), ic); return; } @@ -177,12 +176,14 @@ public class NodeImpl implements Node { throw new IllegalArgumentException("composite not found: " + compositeURI); } - public void removeFromDomainLevelComposite(String compositeURI) throws ActivationException { - String contributionURI = getContributionUriForArtifact(compositeURI); + @Override + public void removeFromDomainLevelComposite(String contributionURI, String compositeURI) throws ActivationException { InstalledContribution ic = installedContributions.get(contributionURI); - String relativeURI = compositeURI.substring(contributionURI.length()+1); + if (ic == null) { + throw new IllegalArgumentException("Contribution not installed: " + contributionURI); + } for (DeployedComposite dc : ic.getDeployedComposites()) { - if (relativeURI.equals(dc.getURI())) { + if (compositeURI.equals(dc.getURI())) { ic.getDeployedComposites().remove(dc); dc.unDeploy(); return; @@ -353,5 +354,5 @@ public class NodeImpl implements Node { } return uri; } - + } |