[seam-commits] Seam SVN: r9664 - in trunk/examples: openid and 10 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Nov 26 12:13:35 EST 2008
Author: norman.richards at jboss.com
Date: 2008-11-26 12:13:35 -0500 (Wed, 26 Nov 2008)
New Revision: 9664
Added:
trunk/examples/openid/
trunk/examples/openid/build.xml
trunk/examples/openid/resources/
trunk/examples/openid/resources/META-INF/
trunk/examples/openid/resources/META-INF/application.xml
trunk/examples/openid/resources/META-INF/ejb-jar.xml
trunk/examples/openid/resources/META-INF/jboss-app.xml
trunk/examples/openid/resources/META-INF/persistence.xml
trunk/examples/openid/resources/WEB-INF/
trunk/examples/openid/resources/WEB-INF/components.xml
trunk/examples/openid/resources/WEB-INF/faces-config.xml
trunk/examples/openid/resources/WEB-INF/pages.xml
trunk/examples/openid/resources/WEB-INF/web.xml
trunk/examples/openid/resources/components.properties
trunk/examples/openid/resources/import.sql
trunk/examples/openid/resources/jboss-seam-openid-ds.xml
trunk/examples/openid/resources/seam.properties
trunk/examples/openid/src/
trunk/examples/openid/src/org/
trunk/examples/openid/src/org/jboss/
trunk/examples/openid/src/org/jboss/seam/
trunk/examples/openid/src/org/jboss/seam/example/
trunk/examples/openid/src/org/jboss/seam/example/openid/
trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java
trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java
trunk/examples/openid/view/
trunk/examples/openid/view/index.html
trunk/examples/openid/view/login-bg.gif
trunk/examples/openid/view/main.xhtml
Log:
JBSEAM-2655
Added: trunk/examples/openid/build.xml
===================================================================
--- trunk/examples/openid/build.xml (rev 0)
+++ trunk/examples/openid/build.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<project name="openid" default="deploy" basedir=".">
+
+ <!-- Naming -->
+ <property name="Name" value="Seam OpenID Example"/>
+ <property name="example.name" value="jboss-seam-openid"/>
+
+ <!-- Libraries to include -->
+ <property name="seam.ui.lib" value="yes"/>
+ <property name="seam.debug.lib" value="yes"/>
+ <property name="facelets.lib" value="yes"/>
+ <property name="richfaces.lib" value="yes"/>
+
+ <property name="openid.lib" value="yes"/>
+
+ <!-- Datasource -->
+ <property name="example.ds" value="jboss-seam-openid-ds.xml"/>
+ <import file="../build.xml"/>
+
+</project>
Added: trunk/examples/openid/resources/META-INF/application.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/application.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/application.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application 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/application_5.xsd"
+ version="5">
+
+ <display-name>Seam Openid</display-name>
+
+ <module>
+ <web>
+ <web-uri>jboss-seam-openid.war</web-uri>
+ <context-root>/seam-openid</context-root>
+ </web>
+ </module>
+
+ <module>
+ <ejb>jboss-seam-openid.jar</ejb>
+ </module>
+
+ <module>
+ <ejb>jboss-seam.jar</ejb>
+ </module>
+
+</application>
Added: trunk/examples/openid/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/ejb-jar.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/ejb-jar.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar 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/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Added: trunk/examples/openid/resources/META-INF/jboss-app.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/jboss-app.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/jboss-app.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE jboss-app
+ PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
+
+<jboss-app>
+ <loader-repository>
+ seam.jboss.org:loader=seam-openid
+ </loader-repository>
+</jboss-app>
Added: trunk/examples/openid/resources/META-INF/persistence.xml
===================================================================
--- trunk/examples/openid/resources/META-INF/persistence.xml (rev 0)
+++ trunk/examples/openid/resources/META-INF/persistence.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="openidDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/openidDatasource</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="jboss.entity.manager.factory.jndi.name"
+ value="java:/openidEntityManagerFactory"/>
+ </properties>
+ </persistence-unit>
+</persistence>
+
+
Added: trunk/examples/openid/resources/WEB-INF/components.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/components.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/components.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:persistence="http://jboss.com/products/seam/persistence"
+ xmlns:security="http://jboss.com/products/seam/security" xmlns:framework="http://jboss.com/products/seam/framework"
+ xmlns:transaction="http://jboss.com/products/seam/transaction"
+ xmlns:international="http://jboss.com/products/seam/international"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.com/products/seam/core /Users/orb/proj/jboss/seam/trunk/src/main/org/jboss/seam/core-2.1.xsd
+ http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
+ http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.1.xsd
+ http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
+ http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
+
+ <core:init jndi-pattern="@jndiPattern@" debug="true"/>
+
+ <core:manager conversation-timeout="1200000" concurrent-request-timeout="50000" conversation-id-parameter="cid"/>
+
+ <transaction:ejb-transaction/>
+
+ <security:identity authenticate-method="#{authenticator.authenticate}"/>
+
+ <persistence:managed-persistence-context name="entityManager" auto-create="true"
+ persistence-unit-jndi-name="java:/openidEntityManagerFactory"/>
+
+ <component name="newpost" class="org.jboss.seam.example.openid.Post">
+ <property name="createDate">#{currentDate}</property>
+ <property name="creator">#{openid.validatedId}</property>
+ </component>
+
+ <framework:entity-query name="posts">
+ <framework:ejbql>select p from Post p</framework:ejbql>
+ </framework:entity-query>
+
+ <framework:entity-home name="postHome" entity-class="org.jboss.seam.example.openid.Post" new-instance="#{newpost}"/>
+
+
+ <event type="org.jboss.seam.security.loggedOut">
+ <action execute="#{openid.logout}" />
+ </event>
+ <!-- not used here -->
+ <event type="org.jboss.seam.openid.ok">
+ <action execute="#{openid.loginImmediately}"/>
+ <!--
+ <action execute="#{redirect.returnToCapturedView}" />
+ -->
+ </event>
+</components>
Added: trunk/examples/openid/resources/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/faces-config.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/faces-config.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<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-faces
+config_1_2.xsd">
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+ <lifecycle>
+ <phase-listener>org.jboss.seam.security.openid.OpenIdPhaseListener</phase-listener>
+ </lifecycle>
+</faces-config>
+
Added: trunk/examples/openid/resources/WEB-INF/pages.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/pages.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/pages.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pages xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
+ no-conversation-view-id="/main.xhtml" login-view-id="/home.xhtml">
+
+ <page view-id="/openid.xhtml">
+ <navigation evaluate="#{openid.loginImmediately()}">
+ <rule if-outcome="true">
+ <redirect view-id="/main.xhtml">
+ <message>Welcome #{openid.validatedId}</message>
+ </redirect>
+ </rule>
+ <rule if-outcome="false">
+ <redirect view-id="/main.xhtml">
+ <message>OpenID login failed...</message>
+ </redirect>
+ </rule>
+ </navigation>
+ </page>
+
+ <page view-id="/main.xhtml">
+ <navigation from-action="#{postHome.persist}" evaluate="#{postHome.clearInstance()}">
+ <redirect />
+ </navigation>
+ </page>
+
+ <exception class="org.jboss.seam.security.NotLoggedInException">
+ <redirect view-id="/home.xhtml">
+ <message severity="warn">You must be logged in to use this feature</message>
+ </redirect>
+ </exception>
+
+</pages>
Added: trunk/examples/openid/resources/WEB-INF/web.xml
===================================================================
--- trunk/examples/openid/resources/WEB-INF/web.xml (rev 0)
+++ trunk/examples/openid/resources/WEB-INF/web.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5"
+ 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">
+
+ <display-name>Seam openid Example</display-name>
+
+ <!-- Seam -->
+
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <url-pattern>/seam/resource/*</url-pattern>
+ </servlet-mapping>
+
+ <filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+ <context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>emeraldTown</param-value>
+ </context-param>
+
+ <!-- JSF -->
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <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>*.seam</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
Added: trunk/examples/openid/resources/components.properties
===================================================================
--- trunk/examples/openid/resources/components.properties (rev 0)
+++ trunk/examples/openid/resources/components.properties 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,3 @@
+# The pattern in components.xml is replaced by an application server specific value in the ant build. This value is used for running tests
+
+jndiPattern \#{ejbName}/local
\ No newline at end of file
Added: trunk/examples/openid/resources/import.sql
===================================================================
--- trunk/examples/openid/resources/import.sql (rev 0)
+++ trunk/examples/openid/resources/import.sql 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1 @@
+insert into post (creator,message,createDate) values ('http://maximoburrito.myopenid.com/','This is too cool',now());
Added: trunk/examples/openid/resources/jboss-seam-openid-ds.xml
===================================================================
--- trunk/examples/openid/resources/jboss-seam-openid-ds.xml (rev 0)
+++ trunk/examples/openid/resources/jboss-seam-openid-ds.xml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>openidDatasource</jndi-name>
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+</datasources>
+
Added: trunk/examples/openid/resources/seam.properties
===================================================================
Added: trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java
===================================================================
--- trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java (rev 0)
+++ trunk/examples/openid/src/org/jboss/seam/example/openid/Auth.java 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,23 @@
+package org.jboss.seam.example.openid;
+
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.security.openid.*;
+
+ at Name("authenticator")
+public class Auth
+{
+ @In(create=false) OpenId openid;
+
+ public boolean authenticate()
+ {
+ System.out.println("AUTH: " + openid + "-" + openid.getValidatedId());
+
+ return true;
+ }
+
+
+ public boolean authenticateOpenID() {
+ return true;
+ }
+
+}
Added: trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java
===================================================================
--- trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java (rev 0)
+++ trunk/examples/openid/src/org/jboss/seam/example/openid/Post.java 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,56 @@
+package org.jboss.seam.example.openid;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+
+
+ at Entity
+ at Table(name="post")
+public class Post {
+ long id;
+ String creator;
+ String message;
+ Date createDate;
+
+ @Id
+ @GeneratedValue
+ @Column(name="id")
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Column(name="creator")
+ public String getCreator() {
+ return creator;
+ }
+ public void setCreator(String creator) {
+ this.creator = creator;
+ }
+
+ @Column(name="message")
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+
+ @Column(name="createDate")
+ public Date getCreateDate() {
+ return createDate;
+ }
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+}
Added: trunk/examples/openid/view/index.html
===================================================================
--- trunk/examples/openid/view/index.html (rev 0)
+++ trunk/examples/openid/view/index.html 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=main.seam">
+</head>
+</html>
Added: trunk/examples/openid/view/login-bg.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/openid/view/login-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/openid/view/main.xhtml
===================================================================
--- trunk/examples/openid/view/main.xhtml (rev 0)
+++ trunk/examples/openid/view/main.xhtml 2008-11-26 17:13:35 UTC (rev 9664)
@@ -0,0 +1,98 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich"
+ xmlns:s="http://jboss.com/products/seam/taglib" xmlns:a="http://richfaces.org/a4j">
+
+<html>
+ <head>
+ <title>OpenID Wall</title>
+ <style type="text/css">
+.openid_input {
+ background: #fff url("login-bg.gif") no-repeat;
+ border: 1px solid #666;
+ width: 232px;
+ padding-left: 18px;
+}
+ </style>
+
+
+ </head>
+ <body>
+
+ <div id="top">
+
+
+
+ <rich:toolBar height="34" itemSeparator="line">
+ <rich:toolBarGroup>
+ <h:outputLabel value="OpenId Wall Demo" />
+ </rich:toolBarGroup>
+
+ <rich:toolBarGroup location="right">
+ <s:div rendered="#{!identity.loggedIn}">
+ <h:form>
+ <h:inputText value="#{openid.id}" styleClass="openid_input"/>
+ <h:commandButton action="#{openid.login}" value="OpenID Login"/>
+ </h:form>
+ </s:div>
+ <s:div rendered="#{identity.loggedIn}">
+ <h:form>
+ <h:outputLabel value="#{openid.validatedId}" />
+ <h:commandButton action="#{identity.logout}" value="Logout"/>
+ </h:form>
+ </s:div>
+ </rich:toolBarGroup>
+ </rich:toolBar>
+ </div>
+
+ <rich:panel>
+ <f:facet name="header">About the Demo</f:facet>
+ <rich:modalPanel id="panel" width="350" height="100">
+ <f:facet name="header">
+ <h:panelGroup>OpenID</h:panelGroup>
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/modal/close.png" style="cursor:pointer" id="hidelink"/>
+ <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+
+ OpenID is cool...
+ </rich:modalPanel>
+
+
+
+ <rich:messages />
+
+ <h:outputLink value="#" id="link">
+ Learn more about OpenID
+ <rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
+ </h:outputLink>
+ </rich:panel>
+
+
+
+ <rich:panel rendered="#{identity.loggedIn}">
+ <f:facet name="header">New Post</f:facet>
+
+ <h:form>
+ <h:inputText value="#{postHome.instance.message}" required="true" />
+ <h:commandButton value="Post" action="#{postHome.persist}" />
+ </h:form>
+ </rich:panel>
+
+
+ <rich:panel>
+ <f:facet name="header">Wall Posts</f:facet>
+ <ui:repeat value="#{posts.resultList}" var="post">
+ <rich:panel>
+ #{post.message}
+ <br />
+ #{post.creator} -- #{post.createDate}
+ </rich:panel>
+ </ui:repeat>
+ </rich:panel>
+ </body>
+</html>
+</ui:composition>
More information about the seam-commits
mailing list