[jboss-cvs] JBossAS SVN: r93529 - in projects/webbeans-ri-int/trunk: deployer and 23 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 15 09:02:10 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-09-15 09:02:09 -0400 (Tue, 15 Sep 2009)
New Revision: 93529

Added:
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebTierIntegrationDeployer.java
   projects/webbeans-ri-int/trunk/webtier/
   projects/webbeans-ri-int/trunk/webtier/pom.xml
   projects/webbeans-ri-int/trunk/webtier/src/
   projects/webbeans-ri-int/trunk/webtier/src/main/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplication.java
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplicationFactory.java
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplication.java
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplicationFactory.java
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsp/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsp/JspInitializationListener.java
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/BeanManagers.java
   projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/Reflections.java
   projects/webbeans-ri-int/trunk/webtier/src/main/resources/
   projects/webbeans-ri-int/trunk/webtier/src/main/resources/META-INF/
   projects/webbeans-ri-int/trunk/webtier/src/test/
   projects/webbeans-ri-int/trunk/webtier/src/test/java/
   projects/webbeans-ri-int/trunk/webtier/src/test/java/org/
   projects/webbeans-ri-int/trunk/webtier/src/test/java/org/jboss/
   projects/webbeans-ri-int/trunk/webtier/src/test/java/org/jboss/test/
Modified:
   projects/webbeans-ri-int/trunk/deployer/
   projects/webbeans-ri-int/trunk/deployer/pom.xml
   projects/webbeans-ri-int/trunk/deployer/src/main/assembly/assembly.xml
   projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml
   projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/PostWebMetadataDeployer.java
   projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java
   projects/webbeans-ri-int/trunk/pom.xml
Log:
add jsf/jsp integration code


Property changes on: projects/webbeans-ri-int/trunk/deployer
___________________________________________________________________
Name: svn:ignore
   - .settings

.project

.classpath

target

test-output

   + .settings

.project

.classpath

target

test-output

temp-testng-customsuite.xml


Modified: projects/webbeans-ri-int/trunk/deployer/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/pom.xml	2009-09-15 12:07:28 UTC (rev 93528)
+++ projects/webbeans-ri-int/trunk/deployer/pom.xml	2009-09-15 13:02:09 UTC (rev 93529)
@@ -57,6 +57,13 @@
       <scope>runtime</scope>
       <optional>true</optional>
     </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.webbeans.integration</groupId>
+      <artifactId>webbeans-jboss-int-webtier</artifactId>
+      <scope>runtime</scope>
+      <optional>true</optional>
+    </dependency>
    
     <dependency>
       <groupId>org.jboss.webbeans</groupId>

Modified: projects/webbeans-ri-int/trunk/deployer/src/main/assembly/assembly.xml
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/assembly/assembly.xml	2009-09-15 12:07:28 UTC (rev 93528)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/assembly/assembly.xml	2009-09-15 13:02:09 UTC (rev 93529)
@@ -32,6 +32,7 @@
             <include>org.jboss.webbeans:webbeans-logging</include>
             <include>org.jboss.webbeans.integration:webbeans-jboss-int-jboss-ejb</include>
             <include>org.jboss.webbeans.integration:webbeans-jboss-int-deployer</include>
+            <include>org.jboss.webbeans.integration:webbeans-jboss-int-webtier</include>
          </includes>
       </dependencySet>
       <dependencySet>

Modified: projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml	2009-09-15 12:07:28 UTC (rev 93528)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml	2009-09-15 13:02:09 UTC (rev 93529)
@@ -29,9 +29,12 @@
   <!-- Responsible for booting Web Beans -->
   <bean name="WebBeansBootstrapDeployer" class="org.jboss.webbeans.integration.deployer.env.WebBeansBootstrapDeployer"/>
   
-  <!-- Responsible for pushing the JSF onto the application classpath -->
+  <!-- Responsible for pushing the JSF faces-config.xml onto the application classpath -->
   <bean name="WebBeansFacesIntegrationDeployer" class="org.jboss.webbeans.integration.deployer.cl.WebBeansFacesIntegrationDeployer"/>
   
+  <!-- Responsible for pushing the webtier integration jar onto the application classpath -->
+<!--  <bean name="WebBeansWenTierIntegrationDeployer" class="org.jboss.webbeans.integration.deployer.cl.WebBeansWebTierIntegrationDeployer"/>-->
+  
   <!-- Responsible for pushing the WB RI onto the application classpath -->
   <bean name="WebBeansCoreIntegrationDeployer" class="org.jboss.webbeans.integration.deployer.cl.WebBeansCoreIntegrationDeployer"/>
 

Modified: projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml	2009-09-15 12:07:28 UTC (rev 93528)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/lib-int/faces/META-INF/faces-config.xml	2009-09-15 13:02:09 UTC (rev 93529)
@@ -5,12 +5,13 @@
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
 
    <factory>
-      <application-factory>org.jboss.webbeans.jsf.WebBeansApplicationFactory</application-factory>
+      <application-factory>org.jboss.webbeans.integration.webtier.jsf.WebBeansApplicationFactory</application-factory>
    </factory>
 
    <application>
       <view-handler>org.jboss.webbeans.jsf.ConversationAwareViewHandler</view-handler>
    </application>
+   
 	<lifecycle>
 		<phase-listener>org.jboss.webbeans.jsf.WebBeansPhaseListener</phase-listener>
 	</lifecycle>

Added: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebTierIntegrationDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebTierIntegrationDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebTierIntegrationDeployer.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,24 @@
+package org.jboss.webbeans.integration.deployer.cl;
+
+
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Web Beans RI integration deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WebBeansWebTierIntegrationDeployer extends WebBeansUrlIntegrationDeployer<JBossWebMetaData>
+{
+   public WebBeansWebTierIntegrationDeployer()
+   {
+      super(JBossWebMetaData.class); // we only look at wars
+      setDisableOptional(true); // it needs to be web deployment, or why would you use JSF?
+      setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
+   }
+
+   protected String getShortLibName()
+   {
+      return "webbeans-jboss-int-webtier.jar";
+   }
+}
\ No newline at end of file


Property changes on: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebTierIntegrationDeployer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/PostWebMetadataDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/PostWebMetadataDeployer.java	2009-09-15 12:07:28 UTC (rev 93528)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/PostWebMetadataDeployer.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -43,9 +43,10 @@
  */
 public class PostWebMetadataDeployer extends WebBeansAwareMetadataDeployer<JBossWebMetaData>
 {
-   private ListenerMetaData WBL;
-   private FilterMetaData CPF;
-   private FilterMappingMetaData CPFM;
+   private final ListenerMetaData WBL;
+   private final ListenerMetaData JIL;
+   private final FilterMetaData CPF;
+   private final FilterMappingMetaData CPFM;
 
    public PostWebMetadataDeployer()
    {
@@ -57,6 +58,8 @@
       // create wbl listener
       WBL = new ListenerMetaData();
       WBL.setListenerClass("org.jboss.webbeans.servlet.WebBeansListener");
+      JIL = new ListenerMetaData();
+      JIL.setListenerClass("org.jboss.webbeans.integration.webtier.jsp.JspInitializationListener");
       CPF = new FilterMetaData();
       CPF.setFilterName("Web Beans Conversation Propagation Filter");
       CPF.setFilterClass("org.jboss.webbeans.servlet.ConversationPropagationFilter");
@@ -76,6 +79,7 @@
             deployment.setListeners(listeners);
          }
          listeners.add(WBL);
+         listeners.add(JIL);
          
          FiltersMetaData filters = deployment.getFilters();
          if (filters == null)

Modified: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java	2009-09-15 12:07:28 UTC (rev 93528)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -190,7 +190,7 @@
       assertNotNull(jbwmd);
       List<ListenerMetaData> listeners = jbwmd.getListeners();
       assertNotNull(listeners);
-      assertEquals(1, listeners.size());
+      assertEquals(2, listeners.size());
       ListenerMetaData lmd = listeners.get(0);
       assertNotNull(lmd);
       assertEquals("org.jboss.webbeans.servlet.WebBeansListener", lmd.getListenerClass());

Modified: projects/webbeans-ri-int/trunk/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/pom.xml	2009-09-15 12:07:28 UTC (rev 93528)
+++ projects/webbeans-ri-int/trunk/pom.xml	2009-09-15 13:02:09 UTC (rev 93529)
@@ -18,6 +18,7 @@
 
   <modules>
     <module>ejb</module>
+    <module>webtier</module>
     <module>deployer</module>
   </modules>
   
@@ -39,6 +40,7 @@
     <version.jboss.ejb3.endpoint>0.1.3</version.jboss.ejb3.endpoint>
     <version.jboss.jpa>1.0.0-CR1</version.jboss.jpa>
     <version.servlet.api>2.5</version.servlet.api>
+    <version.jsp.api>2.1</version.jsp.api>
     <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
     <version.junit>4.4</version.junit>
     <version.validation>1.0.CR3</version.validation>
@@ -348,12 +350,24 @@
       	<artifactId>webbeans-jboss-int-jboss-ejb</artifactId>
       	<version>${project.version}</version>
     	</dependency>
+      
+      <dependency>
+         <groupId>org.jboss.webbeans.integration</groupId>
+         <artifactId>webbeans-jboss-int-webtier</artifactId>
+         <version>${project.version}</version>
+      </dependency>
 
       <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <version>${version.servlet.api}</version>
       </dependency>
+      
+      <dependency>
+         <groupId>javax.servlet.jsp</groupId>
+         <artifactId>jsp-api</artifactId>
+         <version>${version.jsp.api}</version>
+      </dependency>
 
       <dependency>
          <groupId>org.jboss.ejb3</groupId>

Added: projects/webbeans-ri-int/trunk/webtier/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/pom.xml	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/pom.xml	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,88 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.jboss.webbeans.integration</groupId>
+    <artifactId>webbeans-jboss-int</artifactId>
+    <version>5.2.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>webbeans-jboss-int-webtier</artifactId>
+  <version>5.2.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Web Beans Container Services: JBoss AS Webtier</name>
+  
+  <!-- Do not add version information here, use ../pom.xml instead -->
+  <dependencies>
+  
+    <!-- Global dependencies -->
+        
+    <dependency>
+      <groupId>org.jboss.webbeans</groupId>
+      <artifactId>webbeans-spi</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.faces</groupId>
+      <artifactId>jsf-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>javax.servlet.jsp</groupId>
+      <artifactId>jsp-api</artifactId>
+      <optional>true</optional>
+    </dependency>
+    
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>jboss.profiler.jvmti</groupId>
+          <artifactId>jboss-profiler-jvmti</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>log4j</groupId>
+          <artifactId>log4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.ant</groupId>
+          <artifactId>ant-junit</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>  
+</project>

Added: projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplication.java
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplication.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplication.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,289 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.webtier.jsf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.NavigationHandler;
+import javax.faces.application.StateManager;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.PropertyResolver;
+import javax.faces.el.ReferenceSyntaxException;
+import javax.faces.el.ValueBinding;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.ActionListener;
+import javax.faces.validator.Validator;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingApplication extends Application
+{
+   
+   protected abstract Application delegate();
+
+   @Override
+   public void addComponent(String componentType, String componentClass)
+   {
+      delegate().addComponent(componentType, componentClass);
+   }
+
+   @Override
+   public void addConverter(String converterId, String converterClass)
+   {
+      delegate().addConverter(converterId, converterClass);
+   }
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public void addConverter(Class targetClass, String converterClass)
+   {
+      delegate().addConverter(targetClass, converterClass);
+   }
+
+   @Override
+   public void addValidator(String validatorId, String validatorClass)
+   {
+      delegate().addValidator(validatorId, validatorClass);
+   }
+
+   @Override
+   public UIComponent createComponent(String componentType) throws FacesException
+   {
+      return delegate().createComponent(componentType);
+   }
+
+   @Override
+   @Deprecated
+   public UIComponent createComponent(ValueBinding componentBinding, FacesContext context, String componentType) throws FacesException
+   {
+      return delegate().createComponent(componentBinding, context, componentType);
+   }
+
+   @Override
+   public Converter createConverter(String converterId)
+   {
+      return delegate().createConverter(converterId);
+   }
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public Converter createConverter(Class targetClass)
+   {
+      return delegate().createConverter(targetClass);
+   }
+
+   @SuppressWarnings("unchecked")
+   @Deprecated
+   @Override
+   public MethodBinding createMethodBinding(String ref, Class[] params) throws ReferenceSyntaxException
+   {
+      return delegate().createMethodBinding(ref, params);
+   }
+
+   @Override
+   public Validator createValidator(String validatorId) throws FacesException
+   {
+      return delegate().createValidator(validatorId);
+   }
+
+   @Override
+   @Deprecated
+   public ValueBinding createValueBinding(String ref) throws ReferenceSyntaxException
+   {
+      return delegate().createValueBinding(ref);
+   }
+
+   @Override
+   public ActionListener getActionListener()
+   {
+      return delegate().getActionListener();
+   }
+
+   @Override
+   public Iterator<String> getComponentTypes()
+   {
+      return delegate().getComponentTypes();
+   }
+
+   @Override
+   public Iterator<String> getConverterIds()
+   {
+      return delegate().getConverterIds();
+   }
+
+   @SuppressWarnings("unchecked")
+   @Override
+   public Iterator<Class> getConverterTypes()
+   {
+      return delegate().getConverterTypes();
+   }
+
+   @Override
+   public Locale getDefaultLocale()
+   {
+      return delegate().getDefaultLocale();
+   }
+
+   @Override
+   public String getDefaultRenderKitId()
+   {
+      return delegate().getDefaultRenderKitId();
+   }
+
+   @Override
+   public String getMessageBundle()
+   {
+      return delegate().getMessageBundle();
+   }
+
+   @Override
+   public NavigationHandler getNavigationHandler()
+   {
+      return delegate().getNavigationHandler();
+   }
+
+   @Override
+   @Deprecated
+   public PropertyResolver getPropertyResolver()
+   {
+      return delegate().getPropertyResolver();
+   }
+
+   @Override
+   public StateManager getStateManager()
+   {
+      return delegate().getStateManager();
+   }
+
+   @Override
+   public Iterator<Locale> getSupportedLocales()
+   {
+      return delegate().getSupportedLocales();
+   }
+
+   @Override
+   public Iterator<String> getValidatorIds()
+   {
+      return delegate().getValidatorIds();
+   }
+
+   @Override
+   @Deprecated
+   public VariableResolver getVariableResolver()
+   {
+      return delegate().getVariableResolver();
+   }
+
+   @Override
+   public ViewHandler getViewHandler()
+   {
+      return delegate().getViewHandler();
+   }
+
+   @Override
+   public void setActionListener(ActionListener listener)
+   {
+      delegate().setActionListener(listener);
+   }
+
+   @Override
+   public void setDefaultLocale(Locale locale)
+   {
+      delegate().setDefaultLocale(locale);
+   }
+
+   @Override
+   public void setDefaultRenderKitId(String renderKitId)
+   {
+      delegate().setDefaultRenderKitId(renderKitId);
+   }
+
+   @Override
+   public void setMessageBundle(String bundle)
+   {
+      delegate().setMessageBundle(bundle);
+   }
+
+   @Override
+   public void setNavigationHandler(NavigationHandler handler)
+   {
+      delegate().setNavigationHandler(handler);
+   }
+
+
+   @Override
+   @Deprecated
+   public void setPropertyResolver(PropertyResolver resolver)
+   {
+      delegate().setPropertyResolver(resolver);
+   }
+
+   @Override
+   public void setStateManager(StateManager manager)
+   {
+      delegate().setStateManager(manager);
+   }
+
+   @Override
+   public void setSupportedLocales(Collection<Locale> locales)
+   {
+      delegate().setSupportedLocales(locales);
+
+   }
+
+   @Override
+   @Deprecated
+   public void setVariableResolver(VariableResolver resolver)
+   {
+      delegate().setVariableResolver(resolver);
+   }
+
+   @Override
+   public void setViewHandler(ViewHandler handler)
+   {
+      delegate().setViewHandler(handler);
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      return delegate().equals(obj);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return delegate().hashCode();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return delegate().toString();
+   }
+
+}

Added: projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplicationFactory.java
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplicationFactory.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/ForwardingApplicationFactory.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.webtier.jsf;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingApplicationFactory extends ApplicationFactory
+{
+
+   protected abstract ApplicationFactory delegate();
+   
+   @Override
+   public Application getApplication()
+   {
+      return delegate().getApplication();
+   }
+
+   @Override
+   public void setApplication(Application application)
+   {
+      delegate().setApplication(application);
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      return delegate().equals(obj);
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return delegate().hashCode();
+   }
+   
+   @Override
+   public String toString()
+   {
+      return delegate().toString();
+   }
+
+}

Added: projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplication.java
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplication.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplication.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.webtier.jsf;
+
+import javax.el.ELContextListener;
+import javax.el.ExpressionFactory;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.application.Application;
+
+import org.jboss.webbeans.integration.webtier.util.BeanManagers;
+import org.jboss.webbeans.integration.webtier.util.Reflections;
+
+/**
+ * @author pmuir
+ *
+ */
+public class WebBeansApplication extends ForwardingApplication
+{
+   
+   private static final ELContextListener[] EMPTY_LISTENERS = {};
+   
+   private final Application application;
+   private ExpressionFactory expressionFactory;
+   
+   public WebBeansApplication(Application application)
+   {
+      this.application = application;
+      BeanManager beanManager = BeanManagers.getBeanManager();
+      if (beanManager != null)
+      {
+         application.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.webbeans.el.WebBeansELContextListener"));
+         application.addELResolver(beanManager.getELResolver());
+      }
+   }
+
+   @Override
+   protected Application delegate()
+   {
+      return application;
+   }
+   
+   @Override
+   public ExpressionFactory getExpressionFactory()
+   {
+      // Application is multi-threaded, but no need to guard against races (re-
+      // creating the cached expression factory doesn't matter) or liveness
+      // (the value read by all threads will be the same)
+      // We have to do this lazily as Mojarra hasn't set the ExpressionFactory
+      // when the object is created
+      if (this.expressionFactory == null)
+      {
+         BeanManager beanManager = BeanManagers.getBeanManager();
+         if (beanManager != null)
+         {
+            this.expressionFactory = beanManager.wrapExpressionFactory(delegate().getExpressionFactory());
+         }
+         else
+         {
+            // WB failed to initialize properly
+            this.expressionFactory = delegate().getExpressionFactory(); 
+         }
+      }
+      return expressionFactory;
+   }
+
+}

Added: projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplicationFactory.java
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplicationFactory.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsf/WebBeansApplicationFactory.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.webtier.jsf;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class WebBeansApplicationFactory extends ForwardingApplicationFactory
+{
+
+   private final ApplicationFactory applicationFactory;
+   
+   private Application application;
+   
+   public WebBeansApplicationFactory(ApplicationFactory applicationFactory)
+   {
+      this.applicationFactory = applicationFactory;
+   }
+   
+   @Override
+   protected ApplicationFactory delegate()
+   {
+      return applicationFactory;
+   }
+   
+   @Override
+   public Application getApplication()
+   {
+      if (application == null)
+      {
+         application = new WebBeansApplication(delegate().getApplication());
+      }
+      return application;
+   }
+
+}

Added: projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsp/JspInitializationListener.java
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsp/JspInitializationListener.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/jsp/JspInitializationListener.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,65 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.webtier.jsp;
+
+import javax.el.ELContextListener;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.jsp.JspApplicationContext;
+import javax.servlet.jsp.JspFactory;
+
+import org.jboss.webbeans.integration.webtier.util.Reflections;
+import org.jboss.webbeans.servlet.api.helpers.AbstractServletListener;
+
+/**
+ * The Web Beans JSP initialization listener
+ * 
+ * 
+ * @author Pete Muir
+ *
+ */
+public class JspInitializationListener extends AbstractServletListener
+{
+   
+   @Inject 
+   private BeanManager beanManager;
+   
+   @Override
+   public void contextInitialized(ServletContextEvent sce)
+   {
+      
+      if (beanManager != null)
+      {
+
+         // get JspApplicationContext.
+         JspApplicationContext jspAppContext = JspFactory.getDefaultFactory().getJspApplicationContext(sce.getServletContext());
+         
+         // register compositeELResolver with JSP
+         jspAppContext.addELResolver(beanManager.getELResolver());
+   
+         jspAppContext.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.webbeans.el.WebBeansELContextListener"));
+      }
+      // otherwise something went wrong starting WB, so don't register with JSP
+   }
+}

Added: projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/BeanManagers.java
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/BeanManagers.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/BeanManagers.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.webtier.util;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author pmuir
+ *
+ */
+public class BeanManagers
+{
+   
+   public static BeanManager getBeanManager()
+   {
+      try
+      {
+         InitialContext context = new InitialContext();
+         return (BeanManager) context.lookup("java:app/BeanManager");
+      }
+      catch (NamingException e)
+      {
+         return null;
+      }
+      
+   }
+
+}

Added: projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/Reflections.java
===================================================================
--- projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/Reflections.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/webtier/src/main/java/org/jboss/webbeans/integration/webtier/util/Reflections.java	2009-09-15 13:02:09 UTC (rev 93529)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.webtier.util;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class Reflections
+{
+   
+   
+   public static <T> T newInstance(String className)
+   {
+      try
+      {
+         return Reflections.<T>classForName(className).newInstance();
+      }
+      catch (InstantiationException e)
+      {
+         throw new IllegalArgumentException("Cannot instantiate instance of " + className + " with no-argument constructor", e);
+      }
+      catch (IllegalAccessException e)
+      {
+         throw new IllegalArgumentException("Cannot instantiate instance of " + className + " with no-argument constructor", e);
+      }
+   }
+   
+   
+   public static <T> Class<T> classForName(String name)
+   {
+      
+      try
+      {
+         if (Thread.currentThread().getContextClassLoader() != null)
+         {
+            Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(name);
+            
+            @SuppressWarnings("unchecked")
+            Class<T> clazz = (Class<T>)  c;
+            
+            return clazz;
+         }
+         else
+         {
+            Class<?> c = Class.forName(name);
+            
+            @SuppressWarnings("unchecked")
+            Class<T> clazz = (Class<T>)  c;
+            
+            return clazz;
+         }
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new IllegalArgumentException("Cannot load class for " + name, e);
+      }
+      catch (NoClassDefFoundError e)
+      {
+         throw new IllegalArgumentException("Cannot load class for " + name, e);
+      }
+   }
+
+}




More information about the jboss-cvs-commits mailing list