summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
diff options
context:
space:
mode:
authoradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-08-17 06:23:38 +0000
committeradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-08-17 06:23:38 +0000
commita4f020f2df42181bf54587acddb3b748ff5f698f (patch)
treea081922d46f0cffecb06ff84f4d15533c4b898fd /branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
parent6a8186a0b6d2a6bf91db9ded7cf6986c8c8416cc (diff)
committing domain-manager changes from patch tuscany_2552_phillipe_ramalho_08_16_2009.patch
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@804870 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java')
-rw-r--r--branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java b/branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
index 1bce1c135c..6531d43e4a 100644
--- a/branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
+++ b/branches/sca-java-1.x/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
@@ -222,7 +222,12 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl
// Write the workspace
writeWorkspace(workspace);
+ // add it to the search index, contributionUpdated is called to guarantee
+ // only one contribution with the same URI in the index
+ this.domainSearch.contributionUpdated(contribution, contribution);
+
return key;
+
}
public void put(String key, Item item) throws NotFoundException {
@@ -256,11 +261,18 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl
Workspace workspace = readWorkspace();
List<Contribution> contributions = workspace.getContributions();
for (int i = 0, n = contributions.size(); i < n; i++) {
- if (contributions.get(i).getURI().equals(key)) {
+
+ Contribution contribution = contributions.get(i);
+
+ if (contribution.getURI().equals(key)) {
contributions.remove(i);
-
+
// Write the workspace
writeWorkspace(workspace);
+
+ // delete it from the search index
+ this.domainSearch.contributionRemoved(contribution);
+
return;
}