summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-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();
}