diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-25 12:39:38 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-25 12:39:38 +0000 |
commit | 7122c1e316fdaf40f849dc095fee6b646e889cd2 (patch) | |
tree | fa9f7764cf85980e69b8e71f8dc9665edd62b090 | |
parent | 227d3937208323ae9d77704568bd1d244d70ab2c (diff) |
TUSCANY-3868 - allow binding to be retrieved by name
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1127498 13f79535-47bb-0310-9956-ffa450edef68
4 files changed, 30 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java index 0c57c74ec0..b3a1bf9b16 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java @@ -37,6 +37,13 @@ public interface Contract extends AbstractContract, PolicySubject, Cloneable { * @return the bindings supported by this contract */ List<Binding> getBindings(); + + /** + * Return the named binding + * + * @return the named binding or null if it can't be found + */ + Binding getBinding(String name); /** * Returns a binding of the specified type or null if there is no such diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java index f0c884797c..e157b78a7c 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java @@ -70,6 +70,15 @@ public class ReferenceImpl extends AbstractReferenceImpl implements Reference, C public List<Binding> getBindings() { return bindings; } + + public Binding getBinding(String name) { + for (Binding binding : bindings) { + if (binding.getName().equals(name)) { + return binding; + } + } + return null; + } public <B> B getBinding(Class<B> bindingClass) { for (Binding binding : bindings) { diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java index f8eb0fa6ec..618d0d6e7b 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java @@ -57,6 +57,15 @@ public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneab public List<Binding> getBindings() { return bindings; } + + public Binding getBinding(String name) { + for (Binding binding : bindings) { + if (binding.getName().equals(name)) { + return binding; + } + } + return null; + } public <B> B getBinding(Class<B> bindingClass) { for (Binding binding : bindings) { diff --git a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java index 175d81b7f0..e582ba0352 100644 --- a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java +++ b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java @@ -109,6 +109,11 @@ public class TestRuntimeComponentService implements RuntimeComponentService { // TODO Auto-generated method stub return null; } + + public Binding getBinding(String name) { + // TODO Auto-generated method stub + return null; + } public List<Binding> getBindings() { // TODO Auto-generated method stub |