diff options
Diffstat (limited to 'java/sca')
3 files changed, 64 insertions, 17 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; diff --git a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java index c3244aa750..26e0799e45 100644 --- a/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java +++ b/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java @@ -124,14 +124,6 @@ class WebImplementationImpl extends ImplementationImpl implements WebImplementat } } - protected Reference getReference(String name) { - for (Reference reference : getReferences()) { - if (reference.getName().equals(name)) { - return reference; - } - } - return null; - } protected Reference createReference(Reference reference) { Reference newReference; @@ -143,14 +135,6 @@ class WebImplementationImpl extends ImplementationImpl implements WebImplementat return newReference; } - protected Property getProperty(String name) { - for (Property property : getProperties()) { - if (property.getName().equals(name)) { - return property; - } - } - return null; - } protected Property createProperty(Property property) { Property newProperty; |