geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1057962 - in /geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans: OpenWebBeansWebInitializer.java OsgiMetaDataScannerService.java
Date Wed, 12 Jan 2011 00:46:34 GMT
Author: djencks
Date: Wed Jan 12 00:46:34 2011
New Revision: 1057962

URL: http://svn.apache.org/viewvc?rev=1057962&view=rev
Log:
try to figure out if it's an owb app and configure servlet context so the jsf owb stuff will
know

Modified:
    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/OsgiMetaDataScannerService.java

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=1057962&r1=1057961&r2=1057962&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
Wed Jan 12 00:46:34 2011
@@ -33,31 +33,30 @@ import org.apache.webbeans.web.context.W
 import org.apache.webbeans.web.lifecycle.WebContainerLifecycle;
 
 /**
- *  
  * @version $Rev: 698441 $ $Date: 2008-09-24 00:10:08 -0700 (Wed, 24 Sep 2008) $
  */
 public class OpenWebBeansWebInitializer {
-    
-    public OpenWebBeansWebInitializer(WebBeansContext owbContext, ServletContext servletContext)
{
-        GeronimoSingletonService.contextEntered(owbContext);
+
+    public OpenWebBeansWebInitializer(WebBeansContext webBeansContext, ServletContext servletContext)
{
+        GeronimoSingletonService.contextEntered(webBeansContext);
 
         try {
-            setConfiguration(owbContext.getOpenWebBeansConfiguration());
+            setConfiguration(webBeansContext.getOpenWebBeansConfiguration());
             //from OWB's WebBeansConfigurationListener
             if (servletContext != null) {
-                ContainerLifecycle lifeCycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
+                ContainerLifecycle lifeCycle = webBeansContext.getService(ContainerLifecycle.class);
 
-                try
-                {
-                        lifeCycle.startApplication(new ServletContextEvent(servletContext));
-                        servletContext.setAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION,
"true");
+                try {
+                    lifeCycle.startApplication(new ServletContextEvent(servletContext));
                 }
-                catch (Exception e)
-                {
-    //             logger.error(OWBLogConst.ERROR_0018, event.getServletContext().getContextPath());
-                     WebBeansUtil.throwRuntimeExceptions(e);
+                catch (Exception e) {
+                    //             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 {
             GeronimoSingletonService.contextExited(null);
         }
@@ -65,7 +64,7 @@ public class OpenWebBeansWebInitializer 
 
     private void setConfiguration(OpenWebBeansConfiguration configuration) {
         configuration.setProperty(OpenWebBeansConfiguration.APPLICATION_IS_JSP, "true");
-        
+
         configuration.setProperty(OpenWebBeansConfiguration.CONTAINER_LIFECYCLE, WebContainerLifecycle.class.getName());
         configuration.setProperty(OpenWebBeansConfiguration.JNDI_SERVICE, NoopJndiService.class.getName());
         configuration.setProperty(OpenWebBeansConfiguration.SCANNER_SERVICE, OsgiMetaDataScannerService.class.getName());
@@ -77,18 +76,15 @@ public class OpenWebBeansWebInitializer 
     public static class NoopJndiService implements JNDIService {
 
         public void bind(String name, Object object) {
-            System.out.println("Bind");
         }
 
         public <T> T lookup(String name, Class<? extends T> expectedClass) {
-            System.out.println("Lookup");
             return null;
         }
 
         public void unbind(String name) {
-            System.out.println("Unbind");
         }
-        
+
     }
 
 }

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java?rev=1057962&r1=1057961&r2=1057962&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
Wed Jan 12 00:46:34 2011
@@ -53,7 +53,6 @@ public class OsgiMetaDataScannerService 
     private WebBeansLogger logger = WebBeansLogger.getLogger(OsgiMetaDataScannerService.class);
 
     private final WebBeansContext webBeansContext;
-    private boolean configured = false;
 
     private static final String META_INF_BEANS_XML = "META-INF/beans.xml";
     private static final String WEB_INF_BEANS_XML = "WEB-INF/beans.xml";
@@ -62,13 +61,13 @@ public class OsgiMetaDataScannerService 
     protected BDABeansXmlScanner bdaBeansXmlScanner;
 
     /** All classes which have to be scanned for Bean information */
-    private Set<Class<?>> beanClasses = new HashSet<Class<?>>();
+    private final Set<Class<?>> beanClasses = new HashSet<Class<?>>();
 
     /** the URLs of all META-INF/beans.xml files */
-    private Set<URL> beanXMLs = new HashSet<URL>();
+    private final Set<URL> beanXMLs = new HashSet<URL>();
 
     /**contains all the JARs we found with valid beans.xml in it */
-    private Set<String> beanArchiveJarNames = new HashSet<String>();
+    private final Set<String> beanArchiveJarNames = new HashSet<String>();
 
     public OsgiMetaDataScannerService(WebBeansContext webBeansContext) {
         this.webBeansContext = webBeansContext;
@@ -115,7 +114,6 @@ public class OsgiMetaDataScannerService 
             {
                 mainBundle.getBundleContext().ungetService(reference);
             }
-            configured = true;
         }
 
     }
@@ -137,8 +135,7 @@ public class OsgiMetaDataScannerService 
             @Override
             public boolean jarFileDiscoveryRequired(String jarUrl)
             {
-                boolean isValidBeanArchive = beanArchiveJarNames.contains(jarUrl);
-                return isValidBeanArchive;
+                return beanArchiveJarNames.contains(jarUrl);
             }
 
             @Override



Mime
View raw message