diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-15 20:08:35 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-15 20:08:35 +0000 |
commit | 138dfc96f415980a991ae0a05dbdc8762fd4e0a2 (patch) | |
tree | 8ffba5ee35ad1a2100035734b499d3f912d397fd | |
parent | 841c10e3ba7a65bfe8b3362ae27783e7bbc3e63e (diff) |
Add a EndpointRegistry method to update contributions and a ContributionListener so that clients can register for contributionUpdated and contributionRemoved events
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1103521 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 42 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java index 1e7e1751a6..e89a4396e0 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java @@ -43,6 +43,7 @@ public abstract class BaseEndpointRegistry implements EndpointRegistry, LifeCycl protected List<EndpointReference> endpointreferences = new CopyOnWriteArrayList<EndpointReference>(); protected List<EndpointListener> listeners = new CopyOnWriteArrayList<EndpointListener>(); + protected List<ContributionListener> contributionlisteners = new CopyOnWriteArrayList<ContributionListener>(); protected ExtensionPointRegistry registry; protected Map<String, String> attributes; @@ -156,4 +157,11 @@ public abstract class BaseEndpointRegistry implements EndpointRegistry, LifeCycl return domainURI; } + public void addContributionListener(ContributionListener listener) { + contributionlisteners.add(listener); + } + + public void removeContributionListener(ContributionListener listener) { + contributionlisteners.remove(listener); + } } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ContributionListener.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ContributionListener.java new file mode 100644 index 0000000000..d1eba27a79 --- /dev/null +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ContributionListener.java @@ -0,0 +1,29 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.runtime;
+
+import java.util.EventListener;
+
+public interface ContributionListener extends EventListener {
+
+ void contributionRemoved(String uri);
+
+ void contributionUpdated(String uri);
+}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java index 39dd9053c4..1337cab4b2 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java @@ -85,10 +85,15 @@ public interface EndpointRegistry { void uninstallContribution(String uri); List<String> getInstalledContributionURIs(); InstalledContribution getInstalledContribution(String uri); + void updateInstalledContribution(InstalledContribution ic); + + void addContributionListener(ContributionListener listener); + void removeContributionListener(ContributionListener listener); // TODO: Change to use the QName instead of Composite and have clients look up the Composite from the contribution themselves, but i need to get that working first void addRunningComposite(String contributionURI, Composite composite); void removeRunningComposite(String contributionURI, QName name); Map<String, List<QName>> getRunningCompositeNames(); Composite getRunningComposite(String contributionURI, QName name); + } |