diff options
Diffstat (limited to 'java/sca/modules/assembly')
2 files changed, 18 insertions, 1 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java index f95a8a424d..6b2f16732d 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java @@ -73,7 +73,12 @@ public interface Composite extends Implementation, Extensible, Cloneable, Policy * @return a list of components contained in this composite */ List<Component> getComponents(); - + + /** + * Returns a component by name + */ + Component getComponent(String name); + /** * Returns a list of wires contained in this composite. * diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java index 0aa63c4c92..1a45366d72 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java @@ -99,6 +99,18 @@ public class CompositeImpl extends ImplementationImpl implements Composite, Clon public List<Component> getComponents() { return components; } + + public Component getComponent(String name) { + Component component = null; + + for (Component tmp : getComponents()){ + if (tmp.getName().equals(name)){ + component = tmp; + break; + } + } + return component; + } public List<Composite> getIncludes() { return includes; |