summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-08-24 16:35:15 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-08-24 16:35:15 +0000
commiteac10477a5c276af0ae55c2d908a08158efc2b98 (patch)
tree5daac9f924f4429bba8a681d0af9b0c9b62303a8 /java/sca/modules/assembly/src
parent146e3ea63d704b4bd141fadbbd66b316d43097e3 (diff)
Allow services/references/properties to be retrieved by name from a component
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@807302 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly/src')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java24
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java42
2 files changed, 66 insertions, 0 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
index 8aa2215b7a..cb213e9f11 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
@@ -78,6 +78,14 @@ public interface Component extends Base, Extensible, PolicySubject, Cloneable {
* @return a list of references used by the component
*/
List<ComponentReference> getReferences();
+
+ /**
+ * Return a reference by name
+ *
+ * @param name the reference name
+ * @return reference the reference
+ */
+ Reference getReference(String name);
/**
* Returns a list of services exposed by the component.
@@ -85,6 +93,14 @@ public interface Component extends Base, Extensible, PolicySubject, Cloneable {
* @return a list of services exposed by the component
*/
List<ComponentService> getServices();
+
+ /**
+ * Return a service by name
+ *
+ * @param name the service name
+ * @return service the service
+ */
+ Service getService(String name);
/**
* Returns a list of properties for the component.
@@ -92,6 +108,14 @@ public interface Component extends Base, Extensible, PolicySubject, Cloneable {
* @return a list of properties
*/
List<ComponentProperty> 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 component.
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
index 0f10fb50a4..d819fb6aa2 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
@@ -27,6 +27,9 @@ import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.ConstrainingType;
import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.policy.ExtensionType;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicySet;
@@ -97,14 +100,53 @@ public class ComponentImpl extends ExtensibleImpl implements Component, Cloneabl
public List<ComponentProperty> 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<ComponentReference> 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<ComponentService> 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;