summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/domain-node/src/main/java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-17 15:04:06 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-17 15:04:06 +0000
commitb9c6321ba32b7df4eb4046e3ad512a4a6a37909b (patch)
tree11045b2106b580cb179bb199d705159e4263bf41 /sca-java-2.x/trunk/modules/domain-node/src/main/java
parent88fbae2e3633f169a7bb664fd7fc1ce1013f7ad6 (diff)
Add a method to stop a running composite and then uninstall any contributions that were used by the composite and are unused now that the composite is stopped
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1136907 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/Node.java2
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java20
2 files changed, 20 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
index 3373bcccdb..8531642389 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
@@ -156,6 +156,8 @@ public interface Node {
void startComposite(String contributionURI, String compositeURI) throws ActivationException, ValidationException, ContributionReadException;
void startComposite(String contributionURI, String compositeURI, String nodeName) throws ActivationException;
+ void stopCompositeAndUninstallUnused(String contributionURI, String compositeURI) throws ActivationException;
+
/**
* 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
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 68d8191d91..5855805ca4 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
@@ -265,8 +265,6 @@ public class NodeImpl implements Node {
}
}
-
-
public void stopComposite(String contributionURI, String compositeURI) throws ActivationException {
String key = contributionURI+"/"+compositeURI;
DeployedComposite dc = startedComposites.remove(key);
@@ -286,6 +284,24 @@ public class NodeImpl implements Node {
}
}
+ public void stopCompositeAndUninstallUnused(String contributionURI, String compositeURI) throws ActivationException {
+ String key = contributionURI+"/"+compositeURI;
+ DeployedComposite dc = startedComposites.remove(key);
+ if (dc == null) {
+ throw new IllegalArgumentException("No startd composite found: " + key);
+ }
+ dc.stop();
+
+ loop: for (String curi : dc.getContributionURIs()) {
+ for (DeployedComposite started : startedComposites.values()) {
+ if (started.getContributionURIs().contains(curi)) {
+ continue loop;
+ }
+ }
+ uninstallContribution(curi);
+ }
+ }
+
public String getDomainName() {
return domainRegistry.getDomainName();
}