From 5d5faccceb78ab2bc806551ba5910de3c5db8f10 Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 17 Oct 2011 12:37:54 +0000 Subject: Get binding and implementation types given a QName git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1185128 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/definitions/Definitions.java | 21 +++++++++++++++++++ .../sca/definitions/impl/DefinitionsImpl.java | 24 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'sca-java-2.x/trunk') diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java index 9ae5e6f26f..611eadee8d 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java @@ -20,6 +20,8 @@ package org.apache.tuscany.sca.definitions; import java.util.List; +import javax.xml.namespace.QName; + import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.policy.BindingType; import org.apache.tuscany.sca.policy.ImplementationType; @@ -69,6 +71,15 @@ public interface Definitions { */ List getBindingTypes(); + /** + * Returns the requested Binding Type or null + * if the requested Binding Type is not defined + * in the domain + * + * @param bindingTypeName the name of the Binding Type to return + * @return Binding Type or null if the Binding Type is not present + */ + BindingType getBindingType(QName bindingTypeName); /** * Returns a list of domain wide Implementation Types @@ -77,6 +88,16 @@ public interface Definitions { */ List getImplementationTypes(); + /** + * Returns the requested Implementation Type or null + * if the requested Implementation Type is not defined + * in the domain + * + * @param implementationTypeName the name of the implementation type to return + * @return Implementation Type or null if the Implementation Type is not present + */ + ImplementationType getImplementationType(QName implementationTypeName); + /** * Returns a list of domain wide binding definition objects * diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java index e58261cda2..2e34346ef0 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java @@ -22,6 +22,8 @@ package org.apache.tuscany.sca.definitions.impl; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import javax.xml.namespace.QName; + import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.definitions.Definitions; import org.apache.tuscany.sca.policy.BindingType; @@ -48,10 +50,32 @@ public class DefinitionsImpl implements Definitions { public List getBindingTypes() { return bindingTypes; } + + public BindingType getBindingType(QName bindingTypeName) { + + for(BindingType bindingType : bindingTypes){ + if (bindingType.getType().equals(bindingTypeName)){ + return bindingType; + } + } + + return null; + } public List getImplementationTypes() { return implementationTypes; } + + public ImplementationType getImplementationType(QName implementationTypeName) { + + for(ImplementationType implementationType : implementationTypes){ + if (implementationType.getType().equals(implementationTypeName)){ + return implementationType; + } + } + + return null; + } public List getIntents() { return intents; -- cgit v1.2.3