geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r830981 - /geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
Date Thu, 29 Oct 2009 14:54:19 GMT
Author: vamsic007
Date: Thu Oct 29 14:54:19 2009
New Revision: 830981

URL: http://svn.apache.org/viewvc?rev=830981&view=rev
Log:
Reference injection for SCA references in implementation.web computed by Java EE optional
extension

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=830981&r1=830980&r2=830981&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
Thu Oct 29 14:54:19 2009
@@ -18,6 +18,7 @@
 package org.apache.geronimo.tuscany;
 
 import java.io.File;
+import org.apache.tuscany.sca.contribution.jee.InjectionTarget;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -70,6 +71,7 @@
 import org.apache.openejb.assembler.classic.ReferenceLocationInfo;
 import org.apache.openejb.assembler.classic.ResourceEnvReferenceInfo;
 import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.contribution.Artifact;
 import org.apache.tuscany.sca.contribution.Contribution;
@@ -415,12 +417,36 @@
                 }
             }
         }        
+
+        // Process reference injection points from optional extension
+        Map<InjectionTarget, Class<?>> optExtRefInjectionPoints = implementation.getOptExtensionReferenceInjectionPoints();
+        for(Map.Entry<InjectionTarget, Class<?>> entry : optExtRefInjectionPoints.entrySet())
{
+            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) {
+                continue;
+            }
+            String target = injectionTarget.targetClass+"/"+injectionTarget.targetName;
+            Class<?> targetType = entry.getValue();
+            holder.addInjection(injectionTarget.targetClass, new Injection(injectionTarget.targetClass,
injectionTarget.targetName, target));
+            compContext.put("env/"+target, new SCAServiceReference(targetType, thisComponentName,
referenceName, false));
+        }
         
         // Add dependency so that EmbeddedRuntime starts before the WebAppContext
         // ((GBeanData)earContext.getConfiguration().findGBeanDatas(Collections.singleton(new
AbstractNameQuery(module.getModuleName()))).toArray()[0]).addDependency(abstractName);
         // module name is not good enough to query the webappcontext gbean incase of web
modules in a EAR file
         ((GBeanData)module.getEarContext().getConfiguration().findGBeanDatas(Collections.singleton(new
AbstractNameQuery("org.apache.geronimo.management.geronimo.WebModule"))).toArray()[0]).addDependency(abstractName);
-        namingBuilders.buildNaming(webApp, vendorWebApp, webModule, buildingContext);
+        // TODO: The following is reconfiguring the EJB refs and undoing the effect of reference
injection
+        // for SCA references from optional extension. Check if commenting out this leads
to any regression.
+        //namingBuilders.buildNaming(webApp, vendorWebApp, webModule, buildingContext);
     }
 
     private void handleEjbModule(EARContext earContext, Module module, ClassLoader cl, Collection
repository) throws DeploymentException {



Mime
View raw message