geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r834443 - /geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
Date Tue, 10 Nov 2009 12:01:22 GMT
Author: vamsic007
Date: Tue Nov 10 12:01:22 2009
New Revision: 834443

URL: http://svn.apache.org/viewvc?rev=834443&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=834443&r1=834442&r2=834443&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 12:01:22 2009
@@ -638,9 +638,16 @@
             // Processing to support dependency injection starts here
             
             // Process reference injection points
+            List<String> runtimeReferences = new ArrayList<String>();
+            for(ComponentReference ref: component.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();
@@ -736,14 +743,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 : component.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