geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r518223 - in /geronimo/server/trunk: configs/myfaces-deployer/ configs/myfaces-deployer/src/ configs/myfaces-deployer/src/plan/ modules/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/ modules/geronimo-myfaces/...
Date Wed, 14 Mar 2007 17:14:59 GMT
Author: djencks
Date: Wed Mar 14 10:14:58 2007
New Revision: 518223

URL: http://svn.apache.org/viewvc?view=rev&rev=518223
Log:
GERONMO-2958 further progress on myfaces support

Added:
    geronimo/server/trunk/configs/myfaces-deployer/
      - copied from r517399, geronimo/server/trunk/configs/myfaces/
    geronimo/server/trunk/configs/myfaces-deployer/LICENSE.txt
      - copied unchanged from r518029, geronimo/server/trunk/configs/myfaces/LICENSE.txt
    geronimo/server/trunk/configs/myfaces-deployer/NOTICE.txt
      - copied unchanged from r518029, geronimo/server/trunk/configs/myfaces/NOTICE.txt
    geronimo/server/trunk/configs/myfaces-deployer/pom.xml
      - copied, changed from r518029, geronimo/server/trunk/configs/myfaces/pom.xml
    geronimo/server/trunk/configs/myfaces-deployer/src/
      - copied from r518029, geronimo/server/trunk/configs/myfaces/src/
    geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java
  (with props)
    geronimo/server/trunk/modules/geronimo-myfaces/src/test/
    geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/
    geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/
    geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/
    geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/
    geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java
  (with props)
Modified:
    geronimo/server/trunk/configs/myfaces-deployer/src/plan/plan.xml
    geronimo/server/trunk/modules/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
    geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderFactoryGBean.java
    geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderGBean.java

Copied: geronimo/server/trunk/configs/myfaces-deployer/pom.xml (from r518029, geronimo/server/trunk/configs/myfaces/pom.xml)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/myfaces-deployer/pom.xml?view=diff&rev=518223&p1=geronimo/server/trunk/configs/myfaces/pom.xml&r1=518029&p2=geronimo/server/trunk/configs/myfaces-deployer/pom.xml&r2=518223
==============================================================================
--- geronimo/server/trunk/configs/myfaces/pom.xml (original)
+++ geronimo/server/trunk/configs/myfaces-deployer/pom.xml Wed Mar 14 10:14:58 2007
@@ -29,27 +29,29 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>myfaces</artifactId>
-    <name>Geronimo Configs :: MyFaces</name>
+    <artifactId>myfaces-deployer</artifactId>
+    <name>Geronimo Configs :: MyFaces Deployer</name>
     <packaging>car</packaging>
     
     <dependencies>
         <!-- parent -->
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
-            <artifactId>j2ee-server</artifactId>
+            <artifactId>j2ee-deployer</artifactId>
             <version>${version}</version>
             <type>car</type>
         </dependency>
         <dependency>
-            <groupId>org.apache.geronimo.modules</groupId>
-            <artifactId>geronimo-myfaces</artifactId>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>myfaces</artifactId>
             <version>${version}</version>
+            <type>car</type>
+            <scope>runtime</scope>
         </dependency>
-
         <dependency>
-            <groupId>org.apache.myfaces.core</groupId>
-            <artifactId>myfaces-impl</artifactId>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-myfaces-builder</artifactId>
+            <version>${version}</version>
         </dependency>
 
     </dependencies>    

Modified: geronimo/server/trunk/configs/myfaces-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/myfaces-deployer/src/plan/plan.xml?view=diff&rev=518223&r1=518029&r2=518223
==============================================================================
--- geronimo/server/trunk/configs/myfaces-deployer/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/myfaces-deployer/src/plan/plan.xml Wed Mar 14 10:14:58 2007
@@ -20,6 +20,22 @@
 
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
 
-    <gbean name="MyFacesLifecycleProviderFactory" class="org.apache.geronimo.myfaces.LifecycleProviderFactoryGBean"/>
+    <gbean name="MyFacesModuleBuilderExtension" class="org.apache.geronimo.myfaces.deployment.MyFacesModuleBuilderExtension">
+        <attribute name="providerFactoryNameQuery">?name=MyFacesLifecycleProviderFactory#org.apache.geronimo.myfaces.LifecycleProviderFactoryGBean</attribute>
+        <reference name="NamingBuilders">
+            <name>NamingBuilders</name>
+        </reference>
+        <xml-attribute name="defaultEnvironment">
+            <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.geronimo.configs</groupId>
+                        <artifactId>myfaces</artifactId>
+                        <type>car</type>
+                    </dependency>
+                </dependencies>
+            </environment>
+        </xml-attribute>
+    </gbean>
 
 </module>

Modified: geronimo/server/trunk/modules/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java?view=diff&rev=518223&r1=518222&r2=518223
==============================================================================
--- geronimo/server/trunk/modules/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
(original)
+++ geronimo/server/trunk/modules/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
Wed Mar 14 10:14:58 2007
@@ -102,7 +102,7 @@
         WebModule webModule = (WebModule) module;
         WebAppType webApp = (WebAppType) webModule.getSpecDD();
         XmlObject jettyWebApp = webModule.getVendorDD();
-        ClassFinder classFinder = createMyFacesClassFinder(webApp, webModule);
+        ClassFinder classFinder = createMyFacesClassFinder(webApp, webModule); 
         if (classFinder == null) {
             //no jsf config found, nothing to do
             return;
@@ -140,7 +140,11 @@
     protected ClassFinder createMyFacesClassFinder(WebAppType webApp, WebModule webModule)
throws DeploymentException {
 
         List<Class> classes = getFacesClasses(webApp, webModule);
-        return new ClassFinder(classes);
+        if (classes.isEmpty()) {
+            return null;
+        } else {
+            return new ClassFinder(classes);
+        }
     }
 
 

Added: geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java?view=auto&rev=518223
==============================================================================
--- geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java
(added)
+++ geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java
Wed Mar 14 10:14:58 2007
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.geronimo.myfaces;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.faces.context.ExternalContext;
+
+import org.apache.myfaces.config.annotation.LifecycleProvider;
+import org.apache.myfaces.config.annotation.LifecycleProviderFactory;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class ApplicationIndexedLifecycleProviderFactory extends LifecycleProviderFactory
{
+
+    private final Map<ClassLoader, LifecycleProvider> providers = new ConcurrentHashMap<ClassLoader,
LifecycleProvider>();
+
+    public LifecycleProvider getLifecycleProvider(ExternalContext externalContext) {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        LifecycleProvider provider = providers.get(cl);
+        if (provider == null) {
+            throw new IllegalStateException("No LifecycleProvider registered for application
classloader: " + cl);
+        }
+        return provider;
+    }
+
+    /**
+     * Register a lifecycle provider for an application classloader.  This method is intended
to be called
+     * by the container in which MyFaces is running, once for each application, during application
startup before
+     * any other myfaces initialization has taken place.
+     *
+     * @param cl       application classloader, used to index LifecycleProviders
+     * @param provider LifecycleProvider for the application.
+     */
+    public void registerLifecycleProvider(ClassLoader cl, LifecycleProvider provider) {
+        providers.put(cl, provider);
+    }
+
+    public void unregisterLifecycleProvider(ClassLoader cl) {
+        providers.remove(cl);
+    }
+
+    public void release() {
+        providers.clear();
+    }
+
+}

Propchange: geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/ApplicationIndexedLifecycleProviderFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderFactoryGBean.java?view=diff&rev=518223&r1=518222&r2=518223
==============================================================================
--- geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderFactoryGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderFactoryGBean.java
Wed Mar 14 10:14:58 2007
@@ -20,14 +20,13 @@
 
 package org.apache.geronimo.myfaces;
 
-import org.apache.myfaces.config.annotation.ApplicationIndexedLifecycleProviderFactory;
 import org.apache.myfaces.config.annotation.LifecycleProviderFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class LifecycleProviderFactoryGBean {
 
@@ -35,7 +34,7 @@
 
     public LifecycleProviderFactoryGBean() {
         factory = new ApplicationIndexedLifecycleProviderFactory();
-        LifecycleProviderFactory.setInstance(factory);
+        LifecycleProviderFactory.setLifecycleProviderFactory(factory);
     }
 
 

Modified: geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderGBean.java?view=diff&rev=518223&r1=518222&r2=518223
==============================================================================
--- geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/LifecycleProviderGBean.java
Wed Mar 14 10:14:58 2007
@@ -27,7 +27,6 @@
 import javax.naming.Context;
 
 import org.apache.myfaces.config.annotation.LifecycleProvider;
-import org.apache.myfaces.config.annotation.ApplicationIndexedLifecycleProviderFactory;
 import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.annotation.LifecycleMethod;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -38,7 +37,7 @@
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class LifecycleProviderGBean implements LifecycleProvider, GBeanLifecycle {
     
@@ -48,11 +47,11 @@
     private final ClassLoader classLoader;
 
 
-    public LifecycleProviderGBean(Holder holder, Map componentContext, ApplicationIndexedLifecycleProviderFactory
factory, Kernel kernel, ClassLoader classLoader) throws NamingException {
+    public LifecycleProviderGBean(Holder holder, Map componentContext, LifecycleProviderFactoryGBean
factory, Kernel kernel, ClassLoader classLoader) throws NamingException {
         this.holder = holder;
 //        GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
         context = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext,
null, kernel, classLoader);
-        this.factory = factory;
+        this.factory = factory.getLifecycleProviderFactory();
         this.classLoader = classLoader;
     }
 
@@ -88,7 +87,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(LifecycleProviderFactoryGBean.class,
NameFactory.GERONIMO_SERVICE);
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(LifecycleProviderGBean.class,
NameFactory.GERONIMO_SERVICE);
         infoBuilder.addAttribute("holder", Holder.class, true);
         infoBuilder.addAttribute("componentContext", Map.class, true);
 

Added: geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java?view=auto&rev=518223
==============================================================================
--- geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java
(added)
+++ geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java
Wed Mar 14 10:14:58 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.geronimo.myfaces;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.gbean.GBeanInfo;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class BasicTest extends TestCase {
+
+    public void testLifecycleProviderFactory() throws Exception {
+        GBeanInfo gbeanInfo = LifecycleProviderFactoryGBean.getGBeanInfo();
+        LifecycleProviderFactoryGBean factory = new LifecycleProviderFactoryGBean();
+        ApplicationIndexedLifecycleProviderFactory providerFactory = factory.getLifecycleProviderFactory();
+        assertNotNull(providerFactory);
+    }
+
+    public void testLifecycleProvider() throws Exception {
+        GBeanInfo gBeanInfo = LifecycleProviderGBean.getGBeanInfo();
+        
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-myfaces/src/test/java/org/apache/geronimo/myfaces/BasicTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message