diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-20 08:50:59 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-20 08:50:59 +0000 |
commit | 51fe8b9843720b94e0eeeb964792b81609a39cc8 (patch) | |
tree | ef0722de6c728a7a360ac981fd53e5987fc8e0b8 /sca-java-2.x/trunk/modules/domain-node/src/main/java | |
parent | e0d0f979b56b452bf01ea99e14f8037c633942ae (diff) |
Avoid exception in updateCOntribution if the contribution doesn't exist for some reason, and add a new method to uninstall a contribution and stop any started composites that were using it
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1137546 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/main/java')
-rw-r--r-- | sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java | 27 |
1 files changed, 26 insertions, 1 deletions
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 2614845945..b34803497b 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 @@ -104,7 +104,7 @@ public class NodeImpl implements Node { } public boolean updateContribution(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs) throws ContributionReadException, ValidationException, ActivationException { - ContributionDescription ic = getInstalledContribution(uri); + ContributionDescription ic = domainRegistry.getInstalledContribution(uri); if (ic == null) { installContribution(uri, contributionURL, metaDataURL, dependentContributionURIs); return true; @@ -503,4 +503,29 @@ public class NodeImpl implements Node { } return updated; } + + public void uninstallContribution(String contributionURI, boolean b) throws ActivationException { + uninstallContribution(contributionURI); + if (!b) { + return; + } + + // stop all started composites using the contribution + for (DeployedComposite dc : new ArrayList<DeployedComposite>(startedComposites.values())) { + if (dc.getContributionURIs().contains(contributionURI)) { + String dcContributionURI = dc.getContributionURIs().get(0); + String dcCompositeURI = dc.getURI(); + stopComposite(dcContributionURI, dcCompositeURI); + String key = dcContributionURI + "/" + dcCompositeURI; + stoppedComposites.remove(key); + } + } + + // remove all stopped composites using the contribution + for (DeployedComposite dc : new ArrayList<DeployedComposite>(stoppedComposites.values())) { + if (dc.getContributionURIs().contains(contributionURI)) { + stoppedComposites.remove(contributionURI + "/" + dc.getURI()); + } + } + } } |