geronimo-scm mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=832370&view=rev
Log:
Injection of SCA properties 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=832370&r1=832369&r2=832370&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  3 10:03:11 2009
@@ -71,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.ComponentProperty;
 import org.apache.tuscany.sca.assembly.ComponentReference;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.contribution.Artifact;
@@ -440,6 +441,31 @@
             compContext.put("env/"+target, new SCAServiceReference(targetType, thisComponentName,
referenceName, false));
         }
         
+        // Process property injection points from optional extension
+        for(Map.Entry<String, String> entry : implementation.getOptExtensionPropertyInjectionPoints().entrySet())
{
+            String target = entry.getKey();
+            String propertyName = target.replace("/", "_");
+            // Check if the runtime component has this property configured
+            boolean found = false;
+            for(ComponentProperty runtimeProp : thisComponent.getProperties()) {
+                if(runtimeProp.getName().equals(propertyName)) {
+                    found = true;
+                    break;
+                }
+            }
+            if(!found) {
+                continue;
+            }
+            Class<?> targetType = null;
+            try {
+                targetType = Class.forName(entry.getValue());
+            } catch (ClassNotFoundException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+            
+            compContext.put("env/"+target, new SCAPropertyReference(targetType, thisComponentName,
propertyName, 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



Mime
View raw message