diff options
-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()); + } + } + } } |