geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r834400 - /geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
Date Tue, 10 Nov 2009 09:37:30 GMT
Author: vamsic007
Date: Tue Nov 10 09:37:24 2009
New Revision: 834400

URL: http://svn.apache.org/viewvc?rev=834400&view=rev
Log:
Setup reference injection only if the runtime component has that reference configured.

Modified:
    geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java

Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java?rev=834400&r1=834399&r2=834400&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
(original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
Tue Nov 10 09:37:24 2009
@@ -26,6 +26,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -355,9 +356,16 @@
         WebImplementation implementation = (WebImplementation)thisComponent.getImplementation();
         
         // Process reference injection points
+        List<String> runtimeReferences = new ArrayList<String>();
+        for(ComponentReference ref: thisComponent.getReferences()) {
+            runtimeReferences.add(ref.getName());
+        }
         Map<String, JavaElementImpl> injectionPoints =  implementation.getReferenceInjectionPoints();
         for(Map.Entry<String, JavaElementImpl> entry : injectionPoints.entrySet())
{
             String referenceName = entry.getKey();
+            if(!runtimeReferences.contains(referenceName)) {
+                continue;
+            }
             JavaElementImpl target = entry.getValue();
             if(target.getElementType().equals(ElementType.FIELD)) {
                 Field field = (Field)target.getAnchor();
@@ -432,14 +440,7 @@
             InjectionTarget injectionTarget = entry.getKey();
             String referenceName = injectionTarget.targetClass+"_"+injectionTarget.targetName;
             // Check if the runtime component has this reference configured
-            boolean found = false;
-            for(ComponentReference runtimeRef : thisComponent.getReferences()) {
-                if(runtimeRef.getName().equals(referenceName)) {
-                    found = true;
-                    break;
-                }
-            }
-            if(!found) {
+            if(!runtimeReferences.contains(referenceName)) {
                 continue;
             }
             String target = injectionTarget.targetClass+"/"+injectionTarget.targetName;



Mime
View raw message