Skip to content

Commit

Permalink
merge gae support into numberguess
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Sep 23, 2009
1 parent 111428c commit 17b8798
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 1 deletion.
113 changes: 112 additions & 1 deletion jsf/numberguess/pom.xml
Expand Up @@ -194,6 +194,96 @@
</build>
</profile>

<profile>
<id>gae</id>
<dependencies>

<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_12</version>
</dependency>

<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<scope>runtime</scope>
<version>1.2_12</version>
</dependency>

<dependency>
<groupId>org.jboss.webbeans.servlet</groupId>
<artifactId>webbeans-servlet</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp-gae</directory>
<filtering>false</filtering>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>link</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
</classpathContainers>
<additionalBuildcommands>
<buildcommand>com.google.appengine.eclipse.core.projectValidator</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
</additionalProjectnatures>
<additionalConfig>
<file>
<name>.settings/com.google.appengine.eclipse.core.prefs</name>
<content>
<![CDATA[#Wed Sep 23 16:29:55 BST 2009
eclipse.preferences.version=1
filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.2.5.jar|appengine-api-labs-1.2.5.jar|datanucleus-appengine-1.0.3.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar]]>
</content>
</file>
</additionalConfig>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>jetty-ide</id>
<dependencies>
Expand Down Expand Up @@ -276,7 +366,28 @@
<warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
</configuration>
</plugin>

<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>unlink</id>
<phase>clean</phase>
<goals>
<goal>unlink</goal>
</goals>
</execution>
</executions>
<configuration>
<links>
<!-- link src/main/webapp -> war/ for GAE Eclipse plugin -->
<link>
<dst>${basedir}/war</dst>
<src>${basedir}/src/main/webapp</src>
</link>
</links>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
Expand Down
13 changes: 13 additions & 0 deletions jsf/numberguess/src/main/webapp-gae/WEB-INF/appengine-web.xml
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>webbeans-numberguess</application>
<version>1</version>

<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>

<sessions-enabled>true</sessions-enabled>

</appengine-web-app>
11 changes: 11 additions & 0 deletions jsf/numberguess/src/main/webapp-gae/WEB-INF/faces-config.xml
@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">

<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>

</faces-config>
16 changes: 16 additions & 0 deletions jsf/numberguess/src/main/webapp-gae/WEB-INF/jetty-env.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure id="webAppCtx" class="org.mortbay.jetty.webapp.WebAppContext">
<New id="appManager" class="org.mortbay.jetty.plus.naming.Resource">
<Arg><Ref id="webAppCtx"/></Arg>
<Arg>app/Manager</Arg>
<Arg>
<New class="javax.naming.Reference">
<Arg>javax.inject.manager.Manager</Arg>
<Arg>org.jboss.webbeans.resources.ManagerObjectFactory</Arg>
<Arg/>
</New>
</Arg>
</New>
</Configure>
28 changes: 28 additions & 0 deletions jsf/numberguess/src/main/webapp-gae/WEB-INF/logging.properties
@@ -0,0 +1,28 @@
# A default java.util.logging configuration.
# (All App Engine logging is through java.util.logging by default).
#
# To use this configuration, copy it into your application's WEB-INF
# folder and add the following to your appengine-web.xml:
#
# <system-properties>
# <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
# </system-properties>
#

# Set the default logging level for all loggers to WARNING
.level = DEBUG

# Set the default logging level for ORM, specifically, to WARNING
DataNucleus.JDO.level=WARNING
DataNucleus.Persistence.level=WARNING
DataNucleus.Cache.level=WARNING
DataNucleus.MetaData.level=WARNING
DataNucleus.General.level=WARNING
DataNucleus.Utility.level=WARNING
DataNucleus.Transaction.level=WARNING
DataNucleus.Datastore.level=WARNING
DataNucleus.ClassLoading.level=WARNING
DataNucleus.Plugin.level=WARNING
DataNucleus.ValueGeneration.level=WARNING
DataNucleus.Enhancer.level=WARNING
DataNucleus.SchemaTool.level=WARNING
51 changes: 51 additions & 0 deletions jsf/numberguess/src/main/webapp-gae/WEB-INF/web.xml
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<display-name>Web Beans Numberguess example</display-name>

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>

<!-- GAE doesn't work with the Mojarra default startup -->
<context-param>
<param-name>com.sun.faces.enableMultiThreadedStartup</param-name>
<param-value>false</param-value>
</context-param>

<!-- Specify the expression factory manually, JSF can't find it from JSP in GAE -->
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

<listener>
<listener-class>org.jboss.webbeans.environment.servlet.Listener</listener-class>
</listener>

<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>10</session-timeout>
</session-config>

<resource-env-ref>
<description>Object factory for the CDI Bean Manager</description>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>

</web-app>

0 comments on commit 17b8798

Please sign in to comment.