diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-06 09:46:37 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-06 09:46:37 +0000 |
commit | 3b188662bf519fd5b7d53f94a288d59c928fc888 (patch) | |
tree | b3ca1830fa9ee83d388fd8c840a1a985cf84b37b /java/sca/modules/assembly/src/main | |
parent | a708acc77d446fb00589b0555fe12aaf21c13446 (diff) |
Add helper methods to return parameters/references/services by name.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@801579 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly/src/main')
2 files changed, 64 insertions, 1 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java index 2847132093..216a56b032 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java @@ -47,13 +47,29 @@ public interface ComponentType extends Base, PolicySubject { * @return a list of services that are offered */ List<Service> getServices(); - + + /** + * Return a service by name + * + * @param name the service name + * @return service the service + */ + Service getService(String name); + /** * Returns the list of reference types that are used. * * @return the list of reference types that are used */ List<Reference> getReferences(); + + /** + * Return a reference by name + * + * @param name the reference name + * @return reference the reference + */ + Reference getReference(String name); /** * Returns the list of properties that can be set. @@ -61,6 +77,14 @@ public interface ComponentType extends Base, PolicySubject { * @return the list of properties that can be set */ List<Property> getProperties(); + + /** + * Return a property by name + * + * @param name the property name + * @return property the property + */ + Property getProperty(String name); /** * Returns a constraining type defining the shape of the implementation. diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java index 03164f76b8..07c0b59384 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java @@ -86,14 +86,53 @@ public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType, public List<Property> getProperties() { return properties; } + + public Property getProperty(String name){ + Property property = null; + + for (Property tmp : properties){ + if (tmp.getName().equals(name)){ + property = tmp; + break; + } + } + + return property; + } public List<Reference> getReferences() { return references; } + + public Reference getReference(String name){ + Reference reference = null; + + for (Reference tmp : references){ + if (tmp.getName().equals(name)){ + reference = tmp; + break; + } + } + + return reference; + } public List<Service> getServices() { return services; } + + public Service getService(String name){ + Service service = null; + + for (Service tmp : services){ + if (tmp.getName().equals(name)){ + service = tmp; + break; + } + } + + return service; + } public void setConstrainingType(ConstrainingType constrainingType) { this.constrainingType = constrainingType; |