tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r801579 - in /tuscany/java/sca/modules: assembly/src/main/java/org/apache/tuscany/sca/assembly/ assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/
Date Thu, 06 Aug 2009 09:46:38 GMT
Author: slaws
Date: Thu Aug  6 09:46:37 2009
New Revision: 801579

URL: http://svn.apache.org/viewvc?rev=801579&view=rev
Log:
Add helper methods to return parameters/references/services by name. 

Modified:
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
    tuscany/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java?rev=801579&r1=801578&r2=801579&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
(original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
Thu Aug  6 09:46:37 2009
@@ -47,13 +47,29 @@
      * @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 @@
      * @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.

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java?rev=801579&r1=801578&r2=801579&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
(original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
Thu Aug  6 09:46:37 2009
@@ -86,14 +86,53 @@
     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;

Modified: tuscany/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java?rev=801579&r1=801578&r2=801579&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
(original)
+++ tuscany/java/sca/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
Thu Aug  6 09:46:37 2009
@@ -124,14 +124,6 @@
         }
     }
 
-    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 @@
         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;



Mime
View raw message