openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r939041 - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/resources/META-INF/openwebbeans/
Date Wed, 28 Apr 2010 18:25:08 GMT
Author: covener
Date: Wed Apr 28 18:25:07 2010
New Revision: 939041

URL: http://svn.apache.org/viewvc?rev=939041&view=rev
Log:
[OWB-365] make EJB injection via the OWB interceptor suppressable with a property.
(Do injection by default)


Modified:
    openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
    openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties

Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java?rev=939041&r1=939040&r2=939041&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
(original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
Wed Apr 28 18:25:07 2010
@@ -42,6 +42,7 @@ import javax.interceptor.InvocationConte
 
 import org.apache.webbeans.component.InjectionTargetBean;
 import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
@@ -228,17 +229,19 @@ public class OpenWebBeansEjbInterceptor
             }                        
         }
         
-        Object instance = context.getTarget();
-        this.injector = new OWBInjector();
-        try
-        {
-            this.injector.inject(instance, threadLocalCreationalContext.get());
-        }
-        catch (Exception e)
-        {
-            logger.error("Error is occured while injecting dependencies of bean : " + threadLocal.get(),e);
+        if (OpenWebBeansConfiguration.getInstance().isUseEJBInterceptorInjection()) 
+        { 
+            Object instance = context.getTarget();
+            this.injector = new OWBInjector();
+            try
+            {
+                this.injector.inject(instance, threadLocalCreationalContext.get());
+            }
+            catch (Exception e)
+            {
+                logger.error("Error is occured while injecting dependencies of bean : " +
threadLocal.get(),e);
+            }
         }
-        
     }
     
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=939041&r1=939040&r2=939041&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
Wed Apr 28 18:25:07 2010
@@ -97,9 +97,12 @@ public class OpenWebBeansConfiguration
     /**Application is core JSP*/
     public static final String APPLICATION_IS_JSP = "org.apache.webbeans.application.jsp";
     
-    /**Use of JSF2 extnesions*/
+    /**Use of JSF2 extensions*/
     public static final String USE_JSF2_EXTENSIONS = "org.apache.webbeans.application.useJSF2Extensions";
     
+    /**Use of EJB interceptor to inject EJBs*/
+    public static final String USE_EJBINTERCEPTOR_INJECTION = "org.apache.webbeans.application.useEJBInterceptorInjection";
+    
     /**
      * Gets singleton instance.
      * @return singleton instance
@@ -135,6 +138,9 @@ public class OpenWebBeansConfiguration
         value = properties.getProperty(USE_EJB_DISCOVERY);
         setPropertyFromSystemProperty(USE_EJB_DISCOVERY, value);
         
+        value = properties.getProperty(USE_EJBINTERCEPTOR_INJECTION);
+        setPropertyFromSystemProperty(USE_EJBINTERCEPTOR_INJECTION, value);
+        
         value = properties.getProperty(CONTAINER_LIFECYCLE);
         setPropertyFromSystemProperty(CONTAINER_LIFECYCLE, value);
 
@@ -318,4 +324,14 @@ public class OpenWebBeansConfiguration
         return Boolean.valueOf(value);
     }
     
+    /**
+     * Gets EJB injection property.
+     * @return true if EJB interceptor should do injection
+     */
+    public boolean isUseEJBInterceptorInjection()
+    {
+        String value = getProperty(USE_EJBINTERCEPTOR_INJECTION);
+        
+        return Boolean.valueOf(value);
+    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties?rev=939041&r1=939040&r2=939041&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
Wed Apr 28 18:25:07 2010
@@ -55,6 +55,11 @@ org.apache.webbeans.spi.ContextsService=
 org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=false
 ################################################################################################
 
+#################################### Use Embedded OpenEJB Discovery ############################
+#If it is true, the OWB EJB interceptor performs injection on the EJB instance
+org.apache.webbeans.application.useEJBInterceptorInjection=true
+################################################################################################
+
 ################################### Use OWB Specific XML Configuration #########################
 #Use OWB Specific XML configuration. Not recommended to use as true.
 #It will be removed in future development. 
@@ -65,4 +70,4 @@ org.apache.webbeans.useOwbSpecificXmlCon
 #If false, uses spec. defined injection with @Inject. Not recommended use as true.
 #It will be removed in future development. 
 org.apache.webbeans.fieldInjection.useOwbSpecificInjection=false
-################################################################################################
\ No newline at end of file
+################################################################################################



Mime
View raw message