diff options
Diffstat (limited to '')
2 files changed, 13 insertions, 21 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java index 750a13f81a..d3a2526ab9 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java @@ -34,7 +34,7 @@ public class InstalledContribution { private String url; private Contribution contribution; private List<Composite> defaultDeployables = new ArrayList<Composite>(); - private List<DeployedComposite> startededComposites = new ArrayList<DeployedComposite>(); + private Map<String, DeployedComposite> startedComposites = new HashMap<String, DeployedComposite>(); private Map<String, DeployedComposite> stoppedComposites = new HashMap<String, DeployedComposite>(); private List<String> dependentContributionURIs; @@ -60,33 +60,30 @@ public class InstalledContribution { public List<Composite> getDefaultDeployables() { return defaultDeployables; } - public List<DeployedComposite> getDeployedComposites() { - return startededComposites; + public List<String> getStartedCompositeURIs() { + return new ArrayList<String>(startedComposites.keySet()); } public List<String> getDependentContributionURIs() { return dependentContributionURIs; } public void stop(String compositeURI) throws ActivationException { - for (DeployedComposite dc : getDeployedComposites()) { - if (compositeURI.equals(dc.getURI())) { - getDeployedComposites().remove(dc); - dc.stop(); - stoppedComposites.put(compositeURI, dc); - return; - } + DeployedComposite dc = startedComposites.remove(compositeURI); + if (dc == null) { + throw new IllegalStateException("composite not deployed: " + compositeURI); } - throw new IllegalStateException("composite not deployed: " + compositeURI); + dc.stop(); + stoppedComposites.put(compositeURI, dc); } public void start(DeployedComposite composite) { - startededComposites.add(composite); + startedComposites.put(composite.getURI(), composite); } public boolean restart(String compositeURI) throws ActivationException { DeployedComposite dc = stoppedComposites.remove(compositeURI); if (dc != null) { dc.start(); - startededComposites.add(dc); + startedComposites.put(dc.getURI(), dc); } return dc != null; } 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 2e0c4fea02..19e05f9408 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 @@ -232,10 +232,9 @@ public class NodeImpl implements Node { removedContributionURIs.addAll(removeContribution(dependent)); } installedContributions.remove(contributionURI); - for (DeployedComposite dc : ic.getDeployedComposites()) { - dc.stop(); + for (String compositeURI : ic.getStartedCompositeURIs()) { + ic.stop(compositeURI); } - ic.getDeployedComposites().clear(); } return removedContributionURIs; } @@ -404,15 +403,11 @@ public class NodeImpl implements Node { } public List<String> getStartedCompositeURIs(String contributionURI) { - ArrayList<String> compositeURIs = new ArrayList<String>(); InstalledContribution ic = installedContributions.get(contributionURI); if (ic == null) { throw new IllegalArgumentException("no contribution found for: " + contributionURI); } - for (DeployedComposite dc : ic.getDeployedComposites()) { - compositeURIs.add(dc.getURI()); - } - return compositeURIs; + return ic.getStartedCompositeURIs(); } public List<String> getInstalledContributionURIs() { |