geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1087186 - in /geronimo/server/trunk: ./ plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/
Date Thu, 31 Mar 2011 05:25:11 GMT
Author: xuhaihong
Date: Thu Mar 31 05:25:11 2011
New Revision: 1087186

URL: http://svn.apache.org/viewvc?rev=1087186&view=rev
Log:
Use OWB 1.1.0 and update integration codes

Modified:
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java
  (contents, props changed)
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansWebInitializer.java
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/WebBeansConfigurationListener.java
    geronimo/server/trunk/pom.xml

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java?rev=1087186&r1=1087185&r2=1087186&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java
Thu Mar 31 05:25:11 2011
@@ -27,28 +27,33 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+
 import org.apache.webbeans.component.ResourceBean;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.spi.ResourceInjectionService;
+import org.apache.webbeans.spi.SecurityService;
 import org.apache.webbeans.spi.api.ResourceReference;
 import org.apache.webbeans.util.AnnotationUtil;
-import org.apache.webbeans.util.SecurityUtil;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class GeronimoResourceInjectionService implements ResourceInjectionService {
 
     private final Context context;
+    
+    private WebBeansContext webBeansContext;
 
-    public GeronimoResourceInjectionService() {
+    public GeronimoResourceInjectionService(WebBeansContext webBeansContext) {
         try {
             this.context = new InitialContext();
+            this.webBeansContext = webBeansContext;
         } catch (NamingException e) {
             throw new WebBeansException("could not set up naming context", e);
         }
@@ -58,43 +63,31 @@ public class GeronimoResourceInjectionSe
     @Override
     public void injectJavaEEResources(Object managedBeanInstance) {
         Class<?> currentClass = managedBeanInstance.getClass();
-
-        while (currentClass != null && Object.class != currentClass)
-        {
-            Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(currentClass);
-
-            for(Field field : fields)
-            {
-                if(!field.isAnnotationPresent(Produces.class))
-                {
-                    if(!Modifier.isStatic(field.getModifiers()))
-                    {
+        
+        SecurityService securityService = webBeansContext.getSecurityService();
+        while (currentClass != null && Object.class != currentClass) {
+            Field[] fields = securityService.doPrivilegedGetDeclaredFields(currentClass);
+
+            for (Field field : fields) {
+                if (!field.isAnnotationPresent(Produces.class)) {
+                    if (!Modifier.isStatic(field.getModifiers())) {
                         Annotation ann = AnnotationUtil.hasOwbInjectableResource(field.getDeclaredAnnotations());
-                        if(ann != null)
-                        {
+                        if (ann != null) {
                             @SuppressWarnings("unchecked")
                             ResourceReference<Object, ?> resourceRef = new ResourceReference(field.getDeclaringClass(),
field.getName(), field.getType(), ann);
                             boolean acess = field.isAccessible();
-                            try
-                            {
-                                SecurityUtil.doPrivilegedSetAccessible(field, true);
+                            try {
+                                securityService.doPrivilegedSetAccessible(field, true);
                                 field.set(managedBeanInstance, getResourceReference(resourceRef));
-
-                            }
-                            catch(Exception e)
-                            {
+                            } catch (Exception e) {
                                 throw new WebBeansException("Unable to inject field" + field,
e);
-
-                            }
-                            finally
-                            {
-                                SecurityUtil.doPrivilegedSetAccessible(field, acess);
+                            } finally {
+                                securityService.doPrivilegedSetAccessible(field, acess);
                             }
                         }
                     }
                 }
             }
-
             currentClass = currentClass.getSuperclass();
         }
     }

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoResourceInjectionService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansWebInitializer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansWebInitializer.java?rev=1087186&r1=1087185&r2=1087186&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansWebInitializer.java
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansWebInitializer.java
Thu Mar 31 05:25:11 2011
@@ -53,8 +53,6 @@ public class OpenWebBeansWebInitializer 
                     //             logger.error(OWBLogConst.ERROR_0018, event.getServletContext().getContextPath());
                     WebBeansUtil.throwRuntimeExceptions(e);
                 }
-                boolean isWBApplication = !webBeansContext.getScannerService().getBeanXmls().isEmpty();
-                servletContext.setAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION,
Boolean.toString(isWBApplication));
             }
 
         } finally {
@@ -69,8 +67,8 @@ public class OpenWebBeansWebInitializer 
         configuration.setProperty(OpenWebBeansConfiguration.JNDI_SERVICE, NoopJndiService.class.getName());
         configuration.setProperty(OpenWebBeansConfiguration.SCANNER_SERVICE, OsgiMetaDataScannerService.class.getName());
         configuration.setProperty(OpenWebBeansConfiguration.CONTEXTS_SERVICE, WebContextsService.class.getName());
-        configuration.setProperty(ResourceInjectionService.class.getName(), GeronimoResourceInjectionService.class.getName());
-        configuration.setProperty(ELAdaptor.class.getName(), EL22Adaptor.class.getName());
+        configuration.setProperty(OpenWebBeansConfiguration.RESOURCE_INJECTION_SERVICE, GeronimoResourceInjectionService.class.getName());
+        configuration.setProperty(OpenWebBeansConfiguration.EL_ADAPTOR_CLASS, EL22Adaptor.class.getName());
     }
 
     public static class NoopJndiService implements JNDIService {

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/WebBeansConfigurationListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/WebBeansConfigurationListener.java?rev=1087186&r1=1087185&r2=1087186&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/WebBeansConfigurationListener.java
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/WebBeansConfigurationListener.java
Thu Mar 31 05:25:11 2011
@@ -76,17 +76,7 @@ public class WebBeansConfigurationListen
     public void contextInitialized(ServletContextEvent event)
     {
         this.webBeansContext = WebBeansContext.getInstance();
-        this.failoverService = webBeansContext.getService(FailOverService.class);
-        try
-        {
-//                this.lifeCycle.startApplication(event);
-                event.getServletContext().setAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION,
"true");
-        }
-        catch (Exception e)
-        {
-             logger.error(OWBLogConst.ERROR_0018, event.getServletContext().getContextPath());
-             WebBeansUtil.throwRuntimeExceptions(e);
-        }
+        this.failoverService = webBeansContext.getService(FailOverService.class);     
     }
 
 
@@ -97,7 +87,6 @@ public class WebBeansConfigurationListen
     {
         this.webBeansContext.getService(ContainerLifecycle.class).stopApplication(event);
         this.webBeansContext = null;
-        event.getServletContext().setAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION,
"false");
     }
 
     /**

Modified: geronimo/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?rev=1087186&r1=1087185&r2=1087186&view=diff
==============================================================================
--- geronimo/server/trunk/pom.xml (original)
+++ geronimo/server/trunk/pom.xml Thu Mar 31 05:25:11 2011
@@ -71,7 +71,7 @@
 
         <openejbVersion>3.2-SNAPSHOT</openejbVersion>
         <openjpaVersion>2.0.1</openjpaVersion>
-        <openwebbeansVersion>1.1.0-SNAPSHOT</openwebbeansVersion>
+        <openwebbeansVersion>1.1.0</openwebbeansVersion>
         <derbyVersion>10.6.1.0</derbyVersion>
         <cxfVersion>2.1.10</cxfVersion>
         <axis2Version>1.6.0</axis2Version>



Mime
View raw message