diff options
Diffstat (limited to 'java/sca/modules/assembly/src')
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; |