Seam SVN: r9123 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-09-23 12:28:39 -0400 (Tue, 23 Sep 2008)
New Revision: 9123
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Xml.xml
Log:
document JBSEAM-2133
Modified: trunk/doc/Seam_Reference_Guide/en-US/Xml.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Xml.xml 2008-09-23 15:47:57 UTC (rev 9122)
+++ trunk/doc/Seam_Reference_Guide/en-US/Xml.xml 2008-09-23 16:28:39 UTC (rev 9123)
@@ -340,13 +340,45 @@
</para>
- <programlisting role="XML"><![CDATA[<drools:managed-working-memory name="policyPricingWorkingMemory" rule-base="#{policyPricingRules}"/>]]></programlisting>
+ <programlisting role="XML"><![CDATA[<drools:managed-working-memory name="policyPricingWorkingMemory"
+ rule-base="#{policyPricingRules}"/>]]></programlisting>
<programlisting role="XML"><![CDATA[<component name="policyPricingWorkingMemory"
- class="org.jboss.seam.drools.ManagedWorkingMemory">
+ class="org.jboss.seam.drools.ManagedWorkingMemory">
<property name="ruleBase">#{policyPricingRules}</property>
</component>]]></programlisting>
+ <para>
+ Seam also resolves an EL expression string prior to assigning the initial value to the bean property of
+ the component. So you can inject some contextual data into your components.
+ </para>
+
+ <programlisting role="XML"><![CDATA[<component name="greeter" class="com.example.action.Greeter">
+ <property name="message">Nice to see you, #{identity.username}!</property>
+</component>]]></programlisting>
+
+ <para>
+ However, there is one important exception. If the type of the property to which the initial value is
+ being assigned is either a Seam <literal>ValueExpression</literal> or
+ <literal>MethodExpression</literal>, then the evaluation of the EL is deferred. Instead, the appropriate
+ expression wrapper is created and assigned to the property. The message templates on the Home component
+ from the Seam Application Framework serve as an example.
+ </para>
+
+ <programlisting role="XML"><![CDATA[<framework:entity-home name="myEntityHome"
+ class="com.example.action.MyEntityHome" entity-class="com.example.model.MyEntity"
+ created-message="'#{myEntityHome.instance.name}' has been successfully added."/>]]></programlisting>
+
+ <para>
+ Inside the component, you can access the expression string by calling
+ <literal>getExpressionString()</literal> on the <literal>ValueExpression</literal> or
+ <literal>MethodExpression</literal>. If the property is a <literal>ValueExpression</literal>, you can
+ resolve the value using <literal>getValue()</literal> and if the property is a
+ <literal>MethodExpression</literal>, you can invoke the method using <literal>invoke(Object
+ args...)</literal>. Obviously, to assign a value to a <literal>MethodExpression</literal> property, the
+ entire initial value must be a single EL expression.
+ </para>
+
</sect1>
<sect1>
16 years, 2 months
Seam SVN: r9122 - in trunk/src: main/org/jboss/seam/framework and 3 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-09-23 11:47:57 -0400 (Tue, 23 Sep 2008)
New Revision: 9122
Modified:
trunk/src/main/org/jboss/seam/Component.java
trunk/src/main/org/jboss/seam/framework/Home.java
trunk/src/main/org/jboss/seam/framework/Query.java
trunk/src/main/org/jboss/seam/util/Conversions.java
trunk/src/test/unit/org/jboss/seam/test/unit/HomeTest.java
trunk/src/test/unit/org/jboss/seam/test/unit/InitializationTest.java
trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.component.xml
trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.java
Log:
JBSEAM-2133
Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/main/org/jboss/seam/Component.java 2008-09-23 15:47:57 UTC (rev 9122)
@@ -496,7 +496,9 @@
private static InitialValue getInitialValue(Conversions.PropertyValue propertyValue, Class parameterClass, Type parameterType)
{
- if ( propertyValue.isExpression() )
+ if ( parameterClass.equals(ValueExpression.class) ||
+ parameterClass.equals(MethodExpression.class) ||
+ propertyValue.isExpression() )
{
return new ELInitialValue(propertyValue, parameterClass, parameterType);
}
Modified: trunk/src/main/org/jboss/seam/framework/Home.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/Home.java 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/main/org/jboss/seam/framework/Home.java 2008-09-23 15:47:57 UTC (rev 9122)
@@ -10,6 +10,7 @@
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Expressions.ValueExpression;
/**
@@ -30,11 +31,11 @@
private Object id;
protected E instance;
private Class<E> entityClass;
- protected ValueExpression newInstance;
+ protected ValueExpression<T> newInstance;
- private String deletedMessage = "Successfully deleted";
- private String createdMessage = "Successfully created";
- private String updatedMessage = "Successfully updated";
+ private ValueExpression deletedMessage;
+ private ValueExpression createdMessage;
+ private ValueExpression updatedMessage;
/**
* Add a {@link javax.faces.application.FacesMessage} and log a message when
@@ -51,7 +52,7 @@
protected void updatedMessage()
{
debug("updated entity #0 #1", getEntityClass().getName(), getId());
- getStatusMessages().addFromResourceBundleOrDefault( INFO, getUpdatedMessageKey(), getUpdatedMessage() );
+ getStatusMessages().addFromResourceBundleOrDefault( INFO, getUpdatedMessageKey(), getUpdatedMessage().getExpressionString() );
}
/**
@@ -69,7 +70,7 @@
protected void deletedMessage()
{
debug("deleted entity #0 #1", getEntityClass().getName(), getId());
- getStatusMessages().addFromResourceBundleOrDefault( INFO, getDeletedMessageKey(), getDeletedMessage() );
+ getStatusMessages().addFromResourceBundleOrDefault( INFO, getDeletedMessageKey(), getDeletedMessage().getExpressionString() );
}
/**
@@ -87,7 +88,7 @@
protected void createdMessage()
{
debug("created entity #0 #1", getEntityClass().getName(), getId());
- getStatusMessages().addFromResourceBundleOrDefault( INFO, getCreatedMessageKey(), getCreatedMessage() );
+ getStatusMessages().addFromResourceBundleOrDefault( INFO, getCreatedMessageKey(), getCreatedMessage().getExpressionString() );
}
/**
@@ -103,7 +104,22 @@
{
throw new IllegalStateException("entityClass is null");
}
+ initDefaultMessages();
}
+
+ protected void initDefaultMessages()
+ {
+ Expressions expressions = new Expressions();
+ if (createdMessage == null) {
+ createdMessage = expressions.createValueExpression("Successfully created");
+ }
+ if (updatedMessage == null) {
+ updatedMessage = expressions.createValueExpression("Successfully updated");
+ }
+ if (deletedMessage == null) {
+ deletedMessage = expressions.createValueExpression("Successfully deleted");
+ }
+ }
/**
* Get the managed entity, using the id from {@link #getId()} to load it from
@@ -340,7 +356,7 @@
/**
* Message displayed to user when the managed entity is created.
*/
- public String getCreatedMessage()
+ public ValueExpression getCreatedMessage()
{
return createdMessage;
}
@@ -348,7 +364,7 @@
/**
* Message displayed to user when the managed entity is created.
*/
- public void setCreatedMessage(String createdMessage)
+ public void setCreatedMessage(ValueExpression createdMessage)
{
this.createdMessage = createdMessage;
}
@@ -356,7 +372,7 @@
/**
* Message displayed to user when the managed entity is deleted.
*/
- public String getDeletedMessage()
+ public ValueExpression getDeletedMessage()
{
return deletedMessage;
}
@@ -364,7 +380,7 @@
/**
* Message displayed to user when the managed entity is deleted.
*/
- public void setDeletedMessage(String deletedMessage)
+ public void setDeletedMessage(ValueExpression deletedMessage)
{
this.deletedMessage = deletedMessage;
}
@@ -372,7 +388,7 @@
/**
* Message displayed to user when the managed entity is updated.
*/
- public String getUpdatedMessage()
+ public ValueExpression getUpdatedMessage()
{
return updatedMessage;
}
@@ -380,7 +396,7 @@
/**
* Message displayed to user when the managed entity is updated.
*/
- public void setUpdatedMessage(String updatedMessage)
+ public void setUpdatedMessage(ValueExpression updatedMessage)
{
this.updatedMessage = updatedMessage;
}
Modified: trunk/src/main/org/jboss/seam/framework/Query.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/Query.java 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/main/org/jboss/seam/framework/Query.java 2008-09-23 15:47:57 UTC (rev 9122)
@@ -39,7 +39,7 @@
private String ejbql;
private Integer firstResult;
private Integer maxResults;
- private List<String> restrictions = new ArrayList<String>(0);
+ private List<ValueExpression> restrictions = new ArrayList<ValueExpression>(0);
private String order;
private String orderColumn;
private String orderDirection;
@@ -213,12 +213,12 @@
queryParameters = qp.getParameterValueBindings();
parsedEjbql = qp.getEjbql();
- List<String> restrictionFragments = getRestrictions();
+ List<ValueExpression> restrictionFragments = getRestrictions();
parsedRestrictions = new ArrayList<String>( restrictionFragments.size() );
restrictionParameters = new ArrayList<ValueExpression>( restrictionFragments.size() );
- for ( String restriction: restrictionFragments )
+ for ( ValueExpression restriction: restrictionFragments )
{
- QueryParser rqp = new QueryParser( restriction, queryParameters.size() + restrictionParameters.size() );
+ QueryParser rqp = new QueryParser( restriction.getExpressionString(), queryParameters.size() + restrictionParameters.size() );
if ( rqp.getParameterValueBindings().size()!=1 )
{
throw new IllegalArgumentException("there should be exactly one value binding in a restriction: " + restriction);
@@ -286,7 +286,8 @@
Matcher orderMatcher = ORDER_PATTERN.matcher(ejbql);
int orderLoc = orderMatcher.find() ? orderMatcher.start(1) : ejbql.length();
- return "select count(*) " + ejbql.substring(fromLoc, orderLoc);
+ String fromClause = ejbql.substring(fromLoc, orderLoc);
+ return "select count(" + fromClause.substring(5, fromClause.indexOf(" ", 5)) + ") " + fromClause;
}
public String getEjbql()
@@ -355,7 +356,7 @@
* For a query such as 'from Foo f' a restriction could be
* 'f.bar = #{foo.bar}'
*/
- public List<String> getRestrictions()
+ public List<ValueExpression> getRestrictions()
{
return restrictions;
}
@@ -364,7 +365,7 @@
* Calling setRestrictions causes the restrictions to be reparsed and the
* query refreshed
*/
- public void setRestrictions(List<String> restrictions)
+ public void setRestrictions(List<ValueExpression> restrictions)
{
this.restrictions = restrictions;
parsedRestrictions = null;
Modified: trunk/src/main/org/jboss/seam/util/Conversions.java
===================================================================
--- trunk/src/main/org/jboss/seam/util/Conversions.java 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/main/org/jboss/seam/util/Conversions.java 2008-09-23 15:47:57 UTC (rev 9122)
@@ -14,6 +14,8 @@
@SuppressWarnings("serial")
public class Conversions
{
+ private static final String EXPRESSION_MARKER = "#{";
+ private static final char EXPRESSION_ESCAPE_CHAR = '\\';
private static Map<Class, Converter> converters = new HashMap<Class, Converter>() {{
put(String.class, new StringConverter());
@@ -300,7 +302,23 @@
public boolean isExpression()
{
- return string.startsWith("#{");
+ boolean containsExpr = false;
+ int idx = string.indexOf(EXPRESSION_MARKER);
+ if (idx == 0) {
+ containsExpr = true;
+ }
+ else {
+ while (idx != -1) {
+ if (string.charAt(idx - 1) == EXPRESSION_ESCAPE_CHAR) {
+ idx = string.indexOf(EXPRESSION_MARKER, idx + 2);
+ }
+ else {
+ containsExpr = true;
+ break;
+ }
+ }
+ }
+ return containsExpr;
}
public boolean isMultiValued()
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/HomeTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/HomeTest.java 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/HomeTest.java 2008-09-23 15:47:57 UTC (rev 9122)
@@ -1,13 +1,18 @@
package org.jboss.seam.test.unit;
+import java.lang.reflect.Field;
+import java.util.List;
+
import javax.persistence.EntityManager;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.framework.EntityHome;
import org.jboss.seam.framework.HibernateEntityHome;
import org.jboss.seam.framework.Home;
+import org.jboss.seam.international.StatusMessage;
import org.jboss.seam.international.StatusMessages;
import org.jboss.seam.test.unit.entity.SimpleEntity;
+import org.jboss.seam.util.Reflections;
import org.testng.annotations.Test;
public class HomeTest
@@ -93,6 +98,8 @@
// emulate @Create method
home.create();
home.triggerCreatedMessage();
+ List<StatusMessage> registeredMessages = home.getRegisteredMessages();
+ assert registeredMessages.size() == 1;
}
/**
@@ -140,6 +147,16 @@
{
return statusMessages;
}
+
+ protected List<StatusMessage> getRegisteredMessages()
+ {
+ Field field = Reflections.getField(statusMessages.getClass(), "messages");
+ if (!field.isAccessible())
+ {
+ field.setAccessible(true);
+ }
+ return (List<StatusMessage>) Reflections.getAndWrap(field, statusMessages);
+ }
@Override
public Class<SimpleEntity> getEntityClass()
@@ -160,5 +177,4 @@
}
}
-
}
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/InitializationTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/InitializationTest.java 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/InitializationTest.java 2008-09-23 15:47:57 UTC (rev 9122)
@@ -10,7 +10,11 @@
import org.jboss.seam.init.Initialization;
import org.jboss.seam.mock.MockServletContext;
import org.jboss.seam.test.unit.component.ConfigurableComponent;
+import org.jboss.seam.test.unit.component.MyEntityHome;
import org.jboss.seam.test.unit.component.PrimaryColor;
+import org.jboss.seam.transaction.NoTransaction;
+import org.jboss.seam.transaction.Transaction;
+import org.testng.Assert;
import org.testng.annotations.Test;
public class InitializationTest
@@ -47,6 +51,26 @@
ServletLifecycle.endApplication();
}
+
+ @Test
+ public void testEntityHomeConfiguration()
+ {
+ MockServletContext servletContext = new MockServletContext();
+ ServletLifecycle.beginApplication(servletContext);
+ new Initialization( servletContext ).create().init();
+ Lifecycle.beginCall();
+ Contexts.getEventContext().set(Seam.getComponentName(Transaction.class), new NoTransaction());
+ MyEntityHome myEntityHome = (MyEntityHome) Component.getInstance("myEntityHome");
+ assert myEntityHome != null;
+ // verify that the reference to new-instance remains unparsed
+ Assert.assertEquals(myEntityHome.getNewInstance().getExpressionString(), "#{simpleEntity}");
+ // verify that the message string for the created/updated/deleted message remains unparsed
+ Assert.assertEquals(myEntityHome.getCreatedMessage().getExpressionString(), "You #{'created'} it! Yeah!");
+ // verify that the id is parsed prior to assignment
+ Assert.assertEquals(String.valueOf(myEntityHome.getId()), "11");
+
+ ServletLifecycle.endApplication();
+ }
//TODO: write a test for components.xml
}
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.component.xml
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.component.xml 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.component.xml 2008-09-23 15:47:57 UTC (rev 9122)
@@ -10,9 +10,13 @@
The reason this attribute is significant in this case is because the namespace references a class that does not have @Name.
To allow Seam to locate the @Name annotation, the subclass must be provided. -->
<framework:entity-home name="myEntityHome" class="org.jboss.seam.test.unit.component.MyEntityHome">
- <framework:created-message>You created it! Yeah!</framework:created-message>
+ <framework:id>1#{1}</framework:id>
+ <framework:new-instance>#{simpleEntity}</framework:new-instance>
+ <framework:created-message>You #{'created'} it! Yeah!</framework:created-message>
<framework:updated-message>You updated it! Yeah!</framework:updated-message>
<framework:deleted-message>You deleted it! Yeah!</framework:deleted-message>
- </framework:entity-home>
+ </framework:entity-home>
+
+ <component name="simpleEntity" class="org.jboss.seam.test.unit.entity.SimpleEntity"/>
</components>
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.java 2008-09-23 15:21:06 UTC (rev 9121)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/component/MyEntityHome.java 2008-09-23 15:47:57 UTC (rev 9122)
@@ -2,8 +2,18 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;
+import org.jboss.seam.test.unit.entity.SimpleEntity;
@Name("myEntityHome")
-public class MyEntityHome extends EntityHome
+public class MyEntityHome extends EntityHome<SimpleEntity>
{
+ @Override
+ public void create()
+ {
+ if ( getEntityClass()==null )
+ {
+ throw new IllegalStateException("entityClass is null");
+ }
+ initDefaultMessages();
+ }
}
16 years, 2 months
Seam SVN: r9121 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-09-23 11:21:06 -0400 (Tue, 23 Sep 2008)
New Revision: 9121
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Websphere.xml
Log:
fixed some typos
Modified: trunk/doc/Seam_Reference_Guide/en-US/Websphere.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Websphere.xml 2008-09-23 15:19:32 UTC (rev 9120)
+++ trunk/doc/Seam_Reference_Guide/en-US/Websphere.xml 2008-09-23 15:21:06 UTC (rev 9121)
@@ -13,7 +13,7 @@
environment that we used for these examples. After a good deal of research
and work we were able to get EJB3 applications to function correctly. We will
go over the details of those steps with the jee5 example. We will also deploy
- the the JPA example application. </para>
+ the JPA example application. </para>
<section>
<title>Websphere environment and deployment information</title>
@@ -50,13 +50,13 @@
pack you follow the instructions to create a new server
profile with the EJB3 feature pack enabled, or augment one of your
existing ones. This can also be done after the installation
- by running the profile managment tool.</para>
+ by running the profile management tool.</para>
<note>
<title>A note about restarting the server</title>
<para>There are times that restarting the server will be required after
deploying or changes the examples in this chapter. Its does not seem
like every change requires a restart. If you get errors or exceptions
- after modifing a property or deploying an application try to restart
+ after modifying a property or deploying an application try to restart
the server. </para> </note>
</section>
@@ -1463,8 +1463,8 @@
</itemizedlist>
<para>You should end up with something like:</para>
- <programlisting role="XML"><![CDATA[
-<fileset dir="${basedir}">
+ <programlisting role="XML"><![CDATA[<fileset dir="${basedir}">
+
<include name="lib/jbpm*.jar" />
<include name="lib/jboss-el.jar" />
<include name="lib/drools-*.jar"/>
@@ -1489,7 +1489,6 @@
<include name="lib/el-ri.jar"/>
<!-- 3rd party and supporting jars -->
- <!--<include name="lib/log4j.jar" />-->
<include name="lib/javassist.jar"/>
<include name="lib/dom4j.jar" />
<include name="lib/concurrent.jar" />
16 years, 2 months
Seam SVN: r9119 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-09-23 11:19:02 -0400 (Tue, 23 Sep 2008)
New Revision: 9119
Added:
trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
Log:
Added Glassfish chapter
Modified: trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml 2008-09-23 14:51:16 UTC (rev 9118)
+++ trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml 2008-09-23 15:19:02 UTC (rev 9119)
@@ -64,6 +64,10 @@
<firstname>Jacob</firstname>
<surname>Orshalick</surname>
</author>
+ <author>
+ <firstname>Marek</firstname>
+ <surname>Novotny</surname>
+ </author>
<othercredit>
<firstname>James</firstname>
<surname>Cobb</surname>
Added: trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml (rev 0)
+++ trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml 2008-09-23 15:19:02 UTC (rev 9119)
@@ -0,0 +1,917 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="glassfish">
+ <title>Seam on Glassfish application server</title>
+
+ <para>Glassfish is an open source application server which
+ fully implements
+ Java EE 5. The latest stable release is v2 UR2.</para>
+
+ <para>First we will go over some basic information about the
+ Glassfish environment that we used for these examples. We will go over
+ the details of those steps with the jee5 example. We will also deploy
+ the JPA example application. Finally we show customizing of seam-gen's
+ generated application.</para>
+
+ <section>
+ <title>Glassfish environment and deployment information
+ </title>
+
+ <para>Glassfish is a open source project and its installation
+ is very
+ easy. This section will detail the exact server versions used and
+ installation tips.</para>
+
+ <section>
+ <title>Installation version and tips</title>
+
+ <para>
+ All of the examples and information in this chapter are based on
+ the the latest version of Glassfish at the time of this writing.
+ <itemizedlist>
+ <listitem>
+ <para>
+ <ulink url="https://glassfish.dev.java.net/downloads/v2ur2-b04.html">
+ Glassfish v2 UR2 - download page</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ After downloading suitable jar file with Glassfish, install it by
+ writing on command line in case of linux version:
+ <programlisting>java -Xmx256m -jar
+ glassfish-installer-v2ur2-b04-linux.jar</programlisting>
+ </para>
+
+ <para>
+ After installing, setup glassfish, the following command creates
+ Glassfish server domain:
+ <programlisting>cd glassfish; ant -f setup.xml</programlisting>
+ The created domain name is domain1.
+ </para>
+
+ <para>
+ Start the embedded JavaDB server:
+ <programlisting>bin/asadmin start-database
+ </programlisting>
+ This is default embedded database server in Glassfish.
+ </para>
+
+ <para>
+ Start the Glassfish server domain1:
+ <programlisting>bin/asadmin start-domain domain1
+ </programlisting>
+ </para>
+
+ <para>
+ The deployment and configuration is available at the Web
+ Administration console at http://localhost:4848/. Access the web
+ admin
+ console with default username/password: admin/adminadmin. You can also
+ copy EAR/WAR file to
+ <literal>glassfish/domains/domain1/autodeploy
+ </literal>
+ for quick
+ automatic deployment.
+ </para>
+
+ <para>
+ Stopping the server and database can be done by the following
+ command:
+ <programlisting>bin/asadmin stop-domain domain1;
+ bin/asadmin stop-database</programlisting>
+ </para>
+ </section>
+ </section>
+
+ <section id="jee5-glassfish-section">
+ <title>
+ The
+ <literal>jee5/booking</literal>
+ example
+ </title>
+
+ <para>
+ The
+ <literal>jee5/booking</literal>
+ example is based on the Hotel
+ Booking example (which runs on JBoss AS). Out of the box it is also
+ designed to run on Glassfish. It is located in the
+ <literal>$SEAM_DIST/examples/jee5/booking
+ </literal>
+ directory.
+ </para>
+
+ <section id="jee5-glassfish-deploy">
+ <title>Deploying the application to Glassfish</title>
+
+ <para>We will deploy the application on Glassfish with using of
+ Glassfish's administration console.</para>
+
+ <para>
+ The steps below are for the Glassfish version stated above.
+ <orderedlist>
+ <listitem>
+ <para>
+ Log in to the administration console
+ <programlisting>http://localhost:4848
+ </programlisting>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Access the
+ <literal>Enterprise Applications</literal>
+ in the
+ menu option under the
+ <literal>Applications</literal>
+ left side
+ menu.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ At the top of the
+ <literal>Enterprise Application</literal>
+ table select
+ <literal>Deploy</literal>
+ . Below are installation
+ wizard pages and what needs to done on each:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>Preparing for the application
+ installation</literal>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Browse to the
+ <literal>examples/jee5/booking/dist/jboss-seam-jee5.ear
+ </literal>
+ file using the file upload widget.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Select the
+ <literal>OK</literal>
+ button.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You can now access the application at
+ <literal>http://localhost:8081/seam-jee5/
+ </literal>
+ .
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </section>
+ </section>
+
+ <section id="jpa-glassfish-section">
+ <title>
+ The
+ <literal>jpa</literal>
+ booking example
+ </title>
+
+ <para>This is the Hotel Booking example implemented in Seam POJOs
+ and
+ using Hibernate JPA with JPA transactions. It does not require EJB3
+ support to run on application server.</para>
+
+ <para>The example already has a break-out of configurations and
+ build
+ scripts for many of the common containers including Glassfish.</para>
+
+ <para>First thing we are going to do is build and deploy that
+ example.</para>
+
+ <section>
+ <title>
+ Building the
+ <literal>jpa</literal>
+ example
+ </title>
+
+ <para>
+ Building it only requires running the correct ant command:
+ <programlisting>ant glassfish</programlisting>
+ This will create
+ container specific distribution and exploded archive directories with
+ the
+ <literal>glassfish</literal>
+ suffix.
+ </para>
+ </section>
+
+ <section>
+ <title>
+ Deploying the
+ <literal>jpa</literal>
+ example
+ </title>
+
+ <para>
+ This is very similar to the
+ <literal>jee5</literal>
+ example at
+ <xref linkend="jee5-glassfish-deploy" />
+ .
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ Log in to the administration console
+ <programlisting>http://localhost:4848
+ </programlisting>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Access the
+ <literal>Web Applications</literal>
+ in the menu
+ option under the
+ <literal>Applications</literal>
+ left side menu.
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>Preparing for the application
+ installation</literal>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Browse to the
+ <literal>examples/jpa/dist-glassfish/jboss-seam-jpa.war
+ </literal>
+ file using the file upload widget.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Select the
+ <literal>OK</literal>
+ button.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You can now access the application at
+ <literal>http://localhost:8081/jboss-seam-jpa/
+ </literal>
+ .
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <note>
+ <title>Using Derby instead of Hypersonic SQL DB</title>
+
+ In order for the app to work out of the box with Glassfish, we have
+ used the Derby (i.e., Java DB) database in Glassfish. However, we
+ strongly recommend you to use a non-Derby data source (e.g., HSQL is
+ a much better embeded DB) if possible. The
+ examples/jpa/resources-glassfish/WEB-INF/classes/GlassfishDerbyDialect.class
+ is a special hack to get around a Derby bug in Glassfish server. You
+ must use it as your Hibernate dialect if you use Derby with
+ Glassfish.
+ </note>
+ </section>
+
+ <section>
+ <title>What's different for Glassfish v2 UR2</title>
+
+ <para>The differences between the JPA examples that deploys to
+ JBoss 4.2
+ and Glassfish v2 UR2. Expected differences are in persistence related
+ configurations.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ Configuration file changes
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>META-INF/persistence.xml
+ </literal>
+ — the main
+ changes here are for the datasource JNDI path, switching to
+ the Glassfish transaction manager look up class, and changing
+ the hibernate dialect to be
+ <literal>GlassfishDerbyDialect</literal>
+ .
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>WEB-INF/classes/GlassfishDerbyDialect.class
+ </literal>
+ — this class is needed for the hibernate dialect
+ change to
+ <literal>GlassfishDerbyDialect</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>import.sql</literal>
+ — either for the dialect
+ or Derby DB the
+ <literal>ID</literal>
+ column can not be
+ populated by this file and was removed.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+
+ <section>
+ <title>
+ Deploying an application generated by
+ <literal>seam-gen</literal>
+ on Glassfish v2 UR2
+ </title>
+
+ <para>
+ <literal>seam-gen</literal>
+ is a very useful tool for developers to
+ quickly get an application up and running, and provides a foundation to
+ add your own functionality. Out of box
+ <literal>seam-gen</literal>
+ will
+ produce applications configured to run on JBoss AS. These instructions
+ will show the steps needed to get it to run on Glassfish. As stated above
+ in
+ <xref linkend="jee5-glassfish-section" />
+ there is easy to deploy on
+ glassfish either EJB3 or Seam POJOs based application
+ </para>
+
+ <section>
+ <title>
+ Running
+ <literal>seam-gen</literal>
+ Setup
+ </title>
+
+ <para>
+ The first step is setting up
+ <literal>seam-gen</literal>
+ to
+ construct the base project. There are several choices made below,
+ specifically the datasource and hibernate values that we will adjust
+ once the project is created.
+ </para>
+
+ <programlisting>
+ ./seam setup
+ Buildfile: build.xml
+
+ init:
+
+ setup:
+ [echo] Welcome to seam-gen :-)
+ [input] Enter your Java project workspace (the directory that contains your
+ Seam projects) [C:/Projects] [C:/Projects]
+ /home/mnovotny/projects
+ [input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.3.GA]
+ [C:/Program Files/jboss-4.2.3.GA]
+
+ [input] Enter the project name [myproject] [myproject]
+ seamgen_example
+ [echo] Accepted project name as: seamgen_example
+ [input] Do you want to use ICEfaces instead of RichFaces [n] (y, [n])
+
+ [input] skipping input as property icefaces.home.new has already
+ been set.
+ [input] Select a RichFaces skin [blueSky] ([blueSky], classic, ruby, wine,
+ deepMarine, emeraldTown, japanCherry, DEFAULT)
+
+ [input] Is this project deployed as an EAR (with EJB components) or a WAR
+ (with no EJB support) [ear] ([ear], war)
+
+ [input] Enter the Java package name for your session beans
+ [com.mydomain.seamgen_example] [com.mydomain.seamgen_example]
+ org.jboss.seam.tutorial.glassfish.action
+ [input] Enter the Java package name for your entity beans
+ [org.jboss.seam.tutorial.glassfish.action]
+ [org.jboss.seam.tutorial.glassfish.action]
+ org.jboss.seam.tutorial.glassfish.model
+ [input] Enter the Java package name for your test cases
+ [org.jboss.seam.tutorial.glassfish.action.test]
+ [org.jboss.seam.tutorial.glassfish.action.test]
+ org.jboss.seam.tutorial.glassfish.test
+ [input] What kind of database are you using? [hsql] ([hsql], mysql, oracle,
+ postgres, mssql, db2, sybase, enterprisedb, h2)
+
+ [input] Enter the Hibernate dialect for your database
+ [org.hibernate.dialect.HSQLDialect]
+ [org.hibernate.dialect.HSQLDialect]
+
+ [input] Enter the filesystem path to the JDBC driver jar
+ [../lib/hsqldb.jar] [../lib/hsqldb.jar]
+
+ [input] Enter JDBC driver class for your database [org.hsqldb.jdbcDriver]
+ [org.hsqldb.jdbcDriver]
+
+ [input] Enter the JDBC URL for your database [jdbc:hsqldb:.]
+ [jdbc:hsqldb:.]
+
+ [input] Enter database username [sa] [sa]
+
+ [input] Enter database password [] []
+
+ [input] Enter the database schema name (it is OK to leave this blank) [] []
+
+ [input] Enter the database catalog name (it is OK to leave this
+ blank) [] []
+
+ [input] Are you working with tables that already exist in the database? [n]
+ (y, [n])
+
+ [input] Do you want to drop and recreate the database tables and data in
+ import.sql each time you deploy? [n] (y, [n])
+
+ [propertyfile] Creating new property file:
+ /home/mnovotny/workspaces/jboss/jboss-seam/seam-gen/build.properties
+ [echo] Installing JDBC driver jar to JBoss server
+ [copy] Copying 1 file to
+ /home/mnovotny/workspaces/jboss/jboss-seam/seam-gen/C:/Program
+ Files/jboss-4.2.3.GA/server/default/lib
+ [echo] Type 'seam create-project' to create the new project
+
+ BUILD SUCCESSFUL
+ Total time: 4 minutes 5 seconds
+</programlisting>
+
+ <para>
+ Type
+ <literal>./seam new-project</literal>
+ to create your project
+ and
+ <literal>cd /home/mnovotny/projects/seamgen_example</literal>
+ to
+ the newly created structure.
+ </para>
+ </section>
+
+ <section>
+ <title>Changes needed for deployment to Glassfish</title>
+
+ <para>We now need to make some changes to the generated project.
+ </para>
+
+ <section>
+ <title>Configuration file changes</title>
+
+ <variablelist>
+ <varlistentry>
+ <term>
+ <literal>resources/META-INF/persistence-dev.xml
+ </literal>
+ </term>
+
+ <listitem>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Alter the
+ <literal>jta-data-source</literal>
+ to be
+ <literal>jdbc/__default</literal>
+ . We are going to be
+ using the integrated Glassfish Derby DB.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Add or change the properties below. These are
+ described in detail at
+ <xref linkend="jee5-glassfish-section" />
+ :
+ </para>
+
+ <programlisting role="XML">
+<property name="hibernate.dialect" value="GlassfishDerbyDialect"/>
+<property name="hibernate.hbm2ddl.auto" value="update"/>
+<property name="hibernate.show_sql" value="true"/>
+<property name="hibernate.format_sql" value="true"/>
+<property name="hibernate.cache.provider_class"
+ value="org.hibernate.cache.HashtableCacheProvider"/>
+<property name="hibernate.transaction.manager_lookup_class"
+ value="org.hibernate.transaction.SunONETransactionManagerLookup"/></programlisting>
+ </listitem>
+
+ <listitem>
+ <para>You'll need to alter
+ <literal>persistence-prod.xml</literal> as well if you want
+ to deploy to Glassfish using the prod profile.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>resources/GlassfishDerbyDialect.class</literal></term>
+
+ <listitem>
+ <para>As with other examples we need to include this class for
+ DB support. It can be copied from the <literal>jpa</literal>
+ example into the <literal>seamgen_example/resources</literal>
+ directory. <programlisting>
+cp $SEAM_DIST/examples/jpa/resources-glassfish/WEB-INF/classes/GlassfishDerbyDialect.class
+ ./resources</programlisting></para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>resources/META-INF/jboss-app.xml</literal></term>
+
+ <listitem>
+ <para>You can delete this file as we aren't deploying to JBoss
+ AS ( <literal>jboss-app.xml</literal> is used to enable
+ classloading isolation in JBoss AS)</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>resources/*-ds.xml</literal></term>
+
+ <listitem>
+ <para>You can delete these file as we aren't deploying to JBoss
+ AS (these files define data sources in JBoss AS, we are using
+ Glassfish's default data source)</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>resources/WEB-INF/components.xml</literal></term>
+
+ <listitem>
+ <itemizedlist>
+ <listitem>
+ <para>Enable container managed transaction integration - add
+ the <literal> <transaction:ejb-transaction />
+ </literal> component, and it's namespace declaration
+ <literal>
+ xmlns:transaction="http://jboss.com/products/seam/transaction"
+ </literal></para>
+ </listitem>
+
+ <listitem>
+ <para>Alter the <literal>jndi-pattern</literal> to <literal>
+ java:comp/env/seamgen_example/#{ejbName}/local </literal></para>
+ </listitem>
+
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> <literal>resources/WEB-INF/web.xml</literal>
+ </term>
+ <listitem>
+ <para>As with the <literal>jee5/booking</literal>
+ example we need to add EJB references to the web.xml. These
+ references require the empty
+ <literal>local-home</literal> to flag them for
+ Glassfish to perform the proper binding.</para>
+
+
+ <programlisting role="XML"><![CDATA[
+ <ejb-local-ref>
+ <ejb-ref-name>seamgen_example/AuthenticatorAction</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home></local-home>
+ <local>org.jboss.seam.tutorial.glassfish.action.Authenticator</local>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>seamgen_example/EjbSynchronizations</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home></local-home>
+ <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
+ </ejb-local-ref>]]></programlisting>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </section>
+
+ <section>
+ <title>Creating the <literal>AuthenticatorAction</literal> EJB</title>
+
+ <para>We want to take the existing <literal>Authenticator</literal>
+ Seam POJO component and create an EJB3 out of it.</para>
+
+ <orderedlist>
+ <listitem>
+ <itemizedlist>
+ <listitem>
+ <para>Rename the class to
+ <literal>AuthenticatorAction</literal></para>
+ </listitem>
+
+ <listitem>
+ <para>Add the <literal>@Stateless</literal> annotation to the
+ new <literal>AuthenticatorAction</literal> class.</para>
+ </listitem>
+
+ <listitem>
+ <para>Create an interface called
+ <literal>Authenticator</literal> which
+ <literal>AuthenticatorAction</literal> implements (EJB3
+ requires session beans to have a local interface). Annotate
+ the interface with <literal>@Local</literal> , and add a
+ single method with same signature as the
+ <literal>authenticate</literal> in
+ <literal>AuthenticatorAction</literal> .</para>
+ </listitem>
+ </itemizedlist>
+
+ <programlisting role="JAVA">
+@Name("authenticator") @Stateless
+public class AuthenticatorAction implements Authenticator {</programlisting>
+
+ <programlisting role="JAVA">
+@Local
+public interface Authenticator {
+ public boolean authenticate();
+}</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>We've already added its reference to the
+ <literal>web.xml</literal> file so are good to go.</para>
+ </listitem>
+ </orderedlist>
+ </section>
+
+ <section>
+ <title>Extra jar dependencies and other changes to the
+ <literal>build.xml</literal></title>
+
+ <para>This application has similar requirements as the
+ <literal>jee5/booking</literal> example.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Change the default target to <literal>archive</literal> (we
+ aren't going to cover automatic deployment to Websphere).</para>
+
+ <programlisting role="XML">
+<project name="seamgen_example" default="archive" basedir="."></programlisting>
+ </listitem>
+
+ <listitem>
+ <para>Websphere looks for the drools
+ <literal>/security.drl</literal> file in the root of the
+ <literal>war</literal> file instead of the root of the
+ <literal>seamgen_example.jar</literal> so we need to have the
+ <literal>build.xml</literal> move it to the correct location at
+ build time. The following must be added at the top of the
+ <literal> <target name="war" depends="compile"
+ description="Build the distribution .war file"> </literal>
+ target.</para>
+
+ <programlisting role="XML">
+<copy todir="${war.dir}">
+ <fileset dir="${basedir}/resources" >
+ <include name="*.drl" />
+ </fileset>
+</copy></programlisting>
+ </listitem>
+
+ <listitem>
+ <para>We need to get the
+ <literal>GlassfishDerbyDialect.class</literal> into our
+ application jar. To do that find the <literal>jar</literal> task
+ and modify the top of it so that it looks like this:</para>
+
+ <programlisting role="XML">
+<target name="jar" depends="compile,copyclasses"
+ description="Build the distribution .jar file">
+ <copy todir="${jar.dir}">
+ <fileset dir="${basedir}/resources">
+ <include name="seam.properties" />
+ <include name="*.drl" />
+ <include name="GlassfishDerbyDialect.class" />
+ </fileset>
+ </copy>
+...</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>Next we need to get the <literal>jboss-seam.jar</literal>
+ into the base of the <literal>EAR</literal> file. For deployment
+ Glassfish requires this jar to be in both the
+ <literal>/lib</literal> directory and at the base of the
+ <literal>EAR</literal>. You must add the following to the
+ <literal>archive</literal> task:</para>
+
+ <programlisting role="XML">
+<fileset dir="${lib.dir}">
+ <include name="jboss-seam.jar" />
+</fileset></programlisting>
+
+ <para>So that the whole <literal>archive</literal> task looks
+ like:</para>
+
+ <programlisting role="XML">
+<target name="archive" depends="jar,war,ear"
+ description="Package the archives">
+ <jar jarfile="${dist.dir}/${project.name}.jar" basedir="${jar.dir}"/>
+ <jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
+ <jar jarfile="${dist.dir}/${project.name}.ear">
+ <fileset dir="${ear.dir}"/>
+ <fileset dir="${dist.dir}">
+ <include name="${project.name}.jar"/>
+ <include name="${project.name}.war"/>
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="jboss-seam.jar" />
+ </fileset>
+ </jar>
+</target></programlisting>
+ </listitem>
+ <listitem>
+ <para>Now we need to get extra jars into the
+ <literal>build.xml</literal>. Look for the <literal><fileset
+ dir="${basedir}"></literal> section of the task below. Add the
+ new includes at the bottom of the fileset.</para>
+
+ <programlisting role="XML">
+<target name="ear" description="Build the EAR">
+ <copy todir="${ear.dir}">
+ <fileset dir="${basedir}/resources">
+ <include name="*jpdl.xml" />
+ <include name="*hibernate.cfg.xml" />
+ <include name="jbpm.cfg.xml" />
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="jboss-seam.jar" />
+ </fileset>
+ <fileset dir="${basedir}">
+ <include name="lib/jbpm*.jar" />
+ <include name="lib/jboss-el.jar" />
+ <include name="lib/drools-*.jar"/>
+ <include name="lib/core.jar"/>
+ <include name="lib/janino*.jar"/>
+ <include name="lib/antlr-*.jar"/>
+ <include name="lib/mvel*.jar"/>
+ <include name="lib/richfaces-api*.jar" />
+ </fileset>
+ </copy>
+ <copy todir="${ear.dir}/META-INF">
+ <fileset dir="${basedir}/resources/META-INF">
+ <include name="application.xml" />
+ <include name="jboss-app.xml" />
+ </fileset>
+ </copy>
+</target></programlisting>
+
+ <itemizedlist>
+ <listitem>
+ <para>Add Hibernate dependencies</para>
+
+ <programlisting role="XML">
+ <!-- Hibernate and deps -->
+ <include name="lib/hibernate.jar"/>
+ <include name="lib/hibernate-commons-annotations.jar"/>
+ <include name="lib/hibernate-annotations.jar"/>
+ <include name="lib/hibernate-entitymanager.jar"/>
+ <include name="lib/hibernate-validator.jar"/>
+ <include name="lib/jboss-common-core.jar" /></programlisting>
+ </listitem>
+
+ <listitem>
+ <para>Add JSF dependencies. You will need to copy the
+ <literal>el-ri.jar</literal> from the
+ <literal>$SEAM_DIST/lib</literal> directory.</para>
+
+ <programlisting role="XML">
+ <!-- jsf libs -->
+ <include name="lib/jsf-api.jar" />
+ <include name="lib/jsf-impl.jar" />
+ <include name="lib/el-api.jar" />
+ <include name="lib/el-ri.jar"/></programlisting>
+ </listitem>
+
+ <listitem>
+ <para>Add third party dependencies.</para>
+
+ <programlisting role="XML">
+ <!-- 3rd party and supporting jars -->
+ <include name="lib/javassist.jar"/>
+ <include name="lib/dom4j.jar" />
+ <include name="lib/concurrent.jar" />
+ <include name="lib/cglib.jar"/>
+ <include name="lib/asm.jar"/>
+ <include name="lib/antlr.jar" />
+ <include name="lib/commons-logging.jar" />
+ <include name="lib/commons-collections.jar" /></programlisting>
+ </listitem>
+ </itemizedlist>
+
+ <para>You should end up with something like:</para>
+
+ <programlisting role="XML">
+<fileset dir="${basedir}">
+
+ <include name="lib/jbpm*.jar" />
+ <include name="lib/jboss-el.jar" />
+ <include name="lib/drools-*.jar"/>
+ <include name="lib/core.jar"/>
+ <include name="lib/janino*.jar"/>
+ <include name="lib/antlr-*.jar"/>
+ <include name="lib/mvel*.jar"/>
+ <include name="lib/richfaces-api*.jar" />
+
+ <!-- Hibernate and deps -->
+ <include name="lib/hibernate.jar"/>
+ <include name="lib/hibernate-commons-annotations.jar"/>
+ <include name="lib/hibernate-annotations.jar"/>
+ <include name="lib/hibernate-entitymanager.jar"/>
+ <include name="lib/hibernate-validator.jar"/>
+ <include name="lib/jboss-common-core.jar" />
+
+ <!-- jsf libs -->
+ <include name="lib/jsf-api.jar" />
+ <include name="lib/jsf-impl.jar" />
+ <include name="lib/el-api.jar" />
+ <include name="lib/el-ri.jar"/>
+
+ <!-- 3rd party and supporting jars -->
+ <include name="lib/javassist.jar"/>
+ <include name="lib/dom4j.jar" />
+ <include name="lib/concurrent.jar" />
+ <include name="lib/cglib.jar"/>
+ <include name="lib/asm.jar"/>
+ <include name="lib/antlr.jar" />
+ <include name="lib/commons-logging.jar" />
+ <include name="lib/commons-collections.jar" />
+
+</fileset></programlisting>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>Building and deploying the seam-gen'd application to
+ Glassfish</title>
+
+ <itemizedlist>
+ <listitem>
+ <para>Build your application by calling <literal>ant</literal> in
+ the base directory of your project (ex.
+ <literal>/projects/seamgen-example</literal> ). The target of the
+ build will be <literal>dist/seamgen-example.ear</literal> .</para>
+ </listitem>
+
+ <listitem>
+ <para>To deploy the application follow the instructions here :
+ <xref linkend="jee5-glassfish-deploy" /> but use references to
+ this project <literal>seamgen-example</literal> instead of
+ <literal>jboss-seam-jee5</literal>.</para>
+ </listitem>
+
+ <listitem>
+ <para>Checkout the app at:
+ <literal>http://localhost:8081/seamgen_example/</literal></para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+ </section>
+</chapter>
\ No newline at end of file
Property changes on: trunk/doc/Seam_Reference_Guide/en-US/Glassfish.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
16 years, 2 months
Seam SVN: r9118 - branches/community/Seam_2_0/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: danielc.roth
Date: 2008-09-23 10:51:16 -0400 (Tue, 23 Sep 2008)
New Revision: 9118
Modified:
branches/community/Seam_2_0/doc/Seam_Reference_Guide/en-US/Jms.xml
Log:
JBSEAM-3210 backport
Modified: branches/community/Seam_2_0/doc/Seam_Reference_Guide/en-US/Jms.xml
===================================================================
--- branches/community/Seam_2_0/doc/Seam_Reference_Guide/en-US/Jms.xml 2008-09-23 14:28:02 UTC (rev 9117)
+++ branches/community/Seam_2_0/doc/Seam_Reference_Guide/en-US/Jms.xml 2008-09-23 14:51:16 UTC (rev 9118)
@@ -56,7 +56,9 @@
<para>
Another alternative is to use the open source Quartz library to manage asynchronous method.
You need to bundle the Quartz library JAR (found in the <literal>lib</literal> directory)
- in your EAR and declare it as a Java module in <literal>application.xml</literal>. In addition,
+ in your EAR and declare it as a Java module in <literal>application.xml</literal>. The
+ Quartz dispatcher may be configured by adding a Quartz property file to the classpath.
+ It must be named <literal>seam.quartz.properties</literal>. In addition,
you need to add the following line to <literal>components.xml</literal> to install the Quartz
dispatcher.
</para>
16 years, 2 months
Seam SVN: r9117 - trunk/examples/hibernate/view.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2008-09-23 10:28:02 -0400 (Tue, 23 Sep 2008)
New Revision: 9117
Modified:
trunk/examples/hibernate/view/book.xhtml
trunk/examples/hibernate/view/conversations.xhtml
trunk/examples/hibernate/view/main.xhtml
trunk/examples/hibernate/view/password.xhtml
trunk/examples/hibernate/view/register.xhtml
Log:
Added ids for hibernate example.
Modified: trunk/examples/hibernate/view/book.xhtml
===================================================================
--- trunk/examples/hibernate/view/book.xhtml 2008-09-23 13:45:59 UTC (rev 9116)
+++ trunk/examples/hibernate/view/book.xhtml 2008-09-23 14:28:02 UTC (rev 9117)
@@ -49,10 +49,10 @@
<s:validateAll>
<f:facet name="aroundInvalidField">
- <s:span styleClass="errors"/>
+ <s:span id="Error" styleClass="errors"/>
</f:facet>
<f:facet name="afterInvalidField">
- <s:div styleClass="errors">
+ <s:div id="Message" styleClass="errors">
<s:message/>
</s:div>
</f:facet>
@@ -78,7 +78,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="beds">Room Preference:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="bedsDecorate">
<h:selectOneMenu id="beds" value="#{booking.beds}">
<f:selectItem itemLabel="One king-size bed" itemValue="1"/>
<f:selectItem itemLabel="Two double beds" itemValue="2"/>
@@ -91,7 +91,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="smoking">Smoking Preference:</h:outputLabel></div>
<div id="radio" class="input">
- <s:decorate>
+ <s:decorate id="smokingDecorate">
<h:selectOneRadio id="smoking" value="#{booking.smoking}" layout="pageDirection">
<f:selectItem itemLabel="Smoking" itemValue="true"/>
<f:selectItem itemLabel="Non Smoking" itemValue="false"/>
@@ -125,7 +125,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="creditCardExpiryMonth">Credit Card Expiry:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="creditCardExpiryDecorate">
<h:selectOneMenu id="creditCardExpiryMonth" value="#{booking.creditCardExpiryMonth}">
<f:selectItem itemLabel="Jan" itemValue="1"/>
<f:selectItem itemLabel="Feb" itemValue="2"/>
Modified: trunk/examples/hibernate/view/conversations.xhtml
===================================================================
--- trunk/examples/hibernate/view/conversations.xhtml 2008-09-23 13:45:59 UTC (rev 9116)
+++ trunk/examples/hibernate/view/conversations.xhtml 2008-09-23 14:28:02 UTC (rev 9117)
@@ -11,19 +11,19 @@
</div>
<div class="section">
- <h:form>
- <h:dataTable value="#{conversationList}" var="entry">
- <h:column>
- <h:commandLink action="#{entry.select}" value="#{entry.description}"/>
+ <h:form id="ConversationListForm">
+ <h:dataTable id="ConversationListDataTable" value="#{conversationList}" var="entry">
+ <h:column id="column1">
+ <h:commandLink id="EntryDescriptionLink" action="#{entry.select}" value="#{entry.description}"/>
 
- <h:outputText value="[current]" rendered="#{entry.current}"/>
+ <h:outputText id="CurrentEntry" value="[current]" rendered="#{entry.current}"/>
</h:column>
- <h:column>
- <h:outputText value="#{entry.startDatetime}">
+ <h:column id="column2">
+ <h:outputText id="EntryStartDateTime" value="#{entry.startDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
-
- <h:outputText value="#{entry.lastDatetime}">
+ <h:outputText id="EntryLastDateTime" value="#{entry.lastDatetime}">
<s:convertDateTime type="time" pattern="hh:mm"/>
</h:outputText>
</h:column>
Modified: trunk/examples/hibernate/view/main.xhtml
===================================================================
--- trunk/examples/hibernate/view/main.xhtml 2008-09-23 13:45:59 UTC (rev 9116)
+++ trunk/examples/hibernate/view/main.xhtml 2008-09-23 14:28:02 UTC (rev 9117)
@@ -14,7 +14,7 @@
<h:form id="main">
<span class="errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</span>
<h1>Search Hotels</h1>
@@ -27,7 +27,7 @@
 
<a:status>
<f:facet name="start">
- <h:graphicImage value="/img/spinner.gif"/>
+ <h:graphicImage id="Spinner" value="/img/spinner.gif"/>
</f:facet>
</a:status>
<br/>
@@ -44,7 +44,7 @@
<a:outputPanel id="searchResults">
<div class="section">
- <h:outputText value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
+ <h:outputText id="NoHotelsFoundMessage" value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
<h:column>
<f:facet name="header">Name</f:facet>
Modified: trunk/examples/hibernate/view/password.xhtml
===================================================================
--- trunk/examples/hibernate/view/password.xhtml 2008-09-23 13:45:59 UTC (rev 9116)
+++ trunk/examples/hibernate/view/password.xhtml 2008-09-23 14:28:02 UTC (rev 9117)
@@ -15,11 +15,11 @@
<h:form id="setpassword">
<f:facet name="aroundInvalidField">
- <s:span styleClass="errors"/>
+ <s:span id="Error" styleClass="errors"/>
</f:facet>
<f:facet name="afterInvalidField">
<s:div styleClass="errors">
- <s:message/>
+ <s:message id="Message" />
</s:div>
</f:facet>
@@ -28,7 +28,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="password">Password:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="PasswordDecorate">
<h:inputSecret id="password" value="#{user.password}" required="true">
<s:validate/>
</h:inputSecret>
@@ -39,7 +39,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="verify">Verify:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="VerifyDecorate">
<h:inputSecret id="verify" value="#{changePassword.verify}" required="true"/>
</s:decorate>
</div>
Modified: trunk/examples/hibernate/view/register.xhtml
===================================================================
--- trunk/examples/hibernate/view/register.xhtml 2008-09-23 13:45:59 UTC (rev 9116)
+++ trunk/examples/hibernate/view/register.xhtml 2008-09-23 14:28:02 UTC (rev 9117)
@@ -34,7 +34,7 @@
</f:facet>
<f:facet name="afterInvalidField">
<s:div styleClass="errors">
- <s:message/>
+ <s:message id="message"/>
</s:div>
</f:facet>
@@ -63,7 +63,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="password">Password:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="passwordDecorate">
<h:inputSecret id="password" value="#{user.password}" required="true"/>
</s:decorate>
</div>
@@ -72,7 +72,7 @@
<div class="entry">
<div class="label"><h:outputLabel for="verify">Verify Password:</h:outputLabel></div>
<div class="input">
- <s:decorate>
+ <s:decorate id="verifyDecorate">
<h:inputSecret id="verify" value="#{register.verify}" required="true"/>
</s:decorate>
</div>
@@ -81,7 +81,7 @@
</s:validateAll>
<div class="entry errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</div>
<div class="entry">
16 years, 2 months
Seam SVN: r9116 - in trunk/src/main/org/jboss/seam: init and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-09-23 09:45:59 -0400 (Tue, 23 Sep 2008)
New Revision: 9116
Modified:
trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
trunk/src/main/org/jboss/seam/init/Initialization.java
Log:
JBSEAM-3350
Modified: trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java 2008-09-23 13:25:48 UTC (rev 9115)
+++ trunk/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java 2008-09-23 13:45:59 UTC (rev 9116)
@@ -2,6 +2,9 @@
import java.io.File;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
/**
* A special deployment strategy that can be used to scan the war root. This
* is treated as a special case.
@@ -11,6 +14,8 @@
*/
public class WarRootDeploymentStrategy extends DeploymentStrategy
{
+
+ private static LogProvider log = Logging.getLogProvider(WarRootDeploymentStrategy.class);
private ClassLoader classLoader;
@@ -24,7 +29,15 @@
{
this.classLoader = classLoader;
this.warRoot = new File[1];
- this.warRoot[0] = warRoot;
+ if (warRoot != null)
+ {
+ this.warRoot[0] = warRoot;
+ }
+ else
+ {
+ log.warn("Unable to discover war root, .page.xml files won't be found");
+ this.warRoot = new File[0];
+ }
getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, new DotPageDotXmlDeploymentHandler());
}
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-09-23 13:25:48 UTC (rev 9115)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-09-23 13:45:59 UTC (rev 9116)
@@ -8,6 +8,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@@ -733,9 +734,19 @@
String realPath = servletContext.getRealPath(path);
if (realPath==null) //WebLogic!
{
- log.debug("Could not find path for " + path);
+ try
+ {
+ URL resourcePath = servletContext.getResource(path);
+ if (resourcePath.getProtocol().equals("file"))
+ {
+ realPath = resourcePath.getPath();
+ }
+ }
+ catch (MalformedURLException e) {}
+
}
- else
+
+ if (realPath != null)
{
File file = new File(realPath);
if (file.exists())
16 years, 2 months
Seam SVN: r9115 - trunk/examples/jpa/view.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2008-09-23 09:25:48 -0400 (Tue, 23 Sep 2008)
New Revision: 9115
Modified:
trunk/examples/jpa/view/book.xhtml
trunk/examples/jpa/view/conversations.xhtml
trunk/examples/jpa/view/password.xhtml
Log:
JBSEAM-3431 Added ids for jpa example.
Modified: trunk/examples/jpa/view/book.xhtml
===================================================================
--- trunk/examples/jpa/view/book.xhtml 2008-09-23 13:14:08 UTC (rev 9114)
+++ trunk/examples/jpa/view/book.xhtml 2008-09-23 13:25:48 UTC (rev 9115)
@@ -49,11 +49,11 @@
<s:validateAll id="validateAll">
<f:facet id="AroundInvalidFieldFacet" name="aroundInvalidField">
- <s:span id="ErrorsSpan" styleClass="errors"/>
+ <s:span id="Error" styleClass="errors"/>
</f:facet>
<f:facet id="AfterInvalidFieldFacet" name="afterInvalidField">
- <s:div id="ErrosDiv" styleClass="errors">
- <s:message id="message"/>
+ <s:div id="Message" styleClass="errors">
+ <s:message/>
</s:div>
</f:facet>
@@ -77,7 +77,7 @@
<div class="entry">
<div class="label"><h:outputLabel id="RoomPrefLabel" for="beds">Room Preference:</h:outputLabel></div>
<div class="input">
- <s:decorate id="BookingBedsDecorate">
+ <s:decorate id="bedsDecorate">
<h:selectOneMenu id="beds" value="#{booking.beds}">
<f:selectItem id="OneKingBed" itemLabel="One king-size bed" itemValue="1"/>
<f:selectItem id="TwoDoubleBeds" itemLabel="Two double beds" itemValue="2"/>
@@ -90,7 +90,7 @@
<div class="entry">
<div class="label"><h:outputLabel id="SmokingPrefLabel" for="smoking">Smoking Preference:</h:outputLabel></div>
<div id="radio" class="input">
- <s:decorate id="SmokingDecorate">
+ <s:decorate id="smokingDecorate">
<h:selectOneRadio id="smoking" value="#{booking.smoking}" layout="pageDirection">
<f:selectItem id="Smoking" itemLabel="Smoking" itemValue="true"/>
<f:selectItem id="NonSmoking" itemLabel="Non Smoking" itemValue="false"/>
Modified: trunk/examples/jpa/view/conversations.xhtml
===================================================================
--- trunk/examples/jpa/view/conversations.xhtml 2008-09-23 13:14:08 UTC (rev 9114)
+++ trunk/examples/jpa/view/conversations.xhtml 2008-09-23 13:25:48 UTC (rev 9115)
@@ -12,12 +12,12 @@
</div>
<div class="section">
- <h:form id="Conversations">
- <h:dataTable id="ConversationList" value="#{conversationList}" var="entry">
+ <h:form id="ConversationListForm">
+ <h:dataTable id="ConversationListDataTable" value="#{conversationList}" var="entry">
<h:column id="column1">
<h:commandLink id="EntryDescriptionLink" action="#{entry.select}" value="#{entry.description}"/>
 
- <h:outputText id="EntryCurrent" value="[current]" rendered="#{entry.current}"/>
+ <h:outputText id="CurrentEntry" value="[current]" rendered="#{entry.current}"/>
</h:column>
<h:column id="column2">
<h:outputText id="EntryStartDateTime" value="#{entry.startDatetime}">
Modified: trunk/examples/jpa/view/password.xhtml
===================================================================
--- trunk/examples/jpa/view/password.xhtml 2008-09-23 13:14:08 UTC (rev 9114)
+++ trunk/examples/jpa/view/password.xhtml 2008-09-23 13:25:48 UTC (rev 9115)
@@ -19,7 +19,7 @@
</f:facet>
<f:facet id="AfterInvalidFieldFacet" name="afterInvalidField">
<s:div styleClass="errors">
- <s:message id="message"/>
+ <s:message id="Message"/>
</s:div>
</f:facet>
@@ -28,7 +28,7 @@
<div class="entry">
<div class="label"><h:outputLabel id="PasswordLabel" for="password">Password:</h:outputLabel></div>
<div class="input">
- <s:decorate id="DecoratePassword">
+ <s:decorate id="PasswordDecorate">
<h:inputSecret id="password" value="#{user.password}" required="true">
<s:validate/>
</h:inputSecret>
@@ -39,7 +39,7 @@
<div class="entry">
<div class="label"><h:outputLabel id="VerifyLabel" for="verify">Verify:</h:outputLabel></div>
<div class="input">
- <s:decorate id="DecoratePasswordVerify">
+ <s:decorate id="VerifyDecorate">
<h:inputSecret id="verify" value="#{changePassword.verify}" required="true"/>
</s:decorate>
</div>
16 years, 2 months
Seam SVN: r9114 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: danielc.roth
Date: 2008-09-23 09:14:08 -0400 (Tue, 23 Sep 2008)
New Revision: 9114
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Jms.xml
Log:
Modified: trunk/doc/Seam_Reference_Guide/en-US/Jms.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Jms.xml 2008-09-23 13:06:27 UTC (rev 9113)
+++ trunk/doc/Seam_Reference_Guide/en-US/Jms.xml 2008-09-23 13:14:08 UTC (rev 9114)
@@ -56,9 +56,11 @@
<para>
Another alternative is to use the open source Quartz library to manage asynchronous method.
You need to bundle the Quartz library JAR (found in the <literal>lib</literal> directory)
- in your EAR and declare it as a Java module in <literal>application.xml</literal>. In addition,
- you need to add the following line to <literal>components.xml</literal> to install the Quartz
- dispatcher.
+ in your EAR and declare it as a Java module in <literal>application.xml</literal>.
+ The Quartz dispatcher may be configured by adding a Quartz property file to the classpath.
+ It must be named <literal>seam.quartz.properties</literal>. In addition,
+ you need to add the following line to <literal>components.xml</literal> to install the
+ Quartz dispatcher.
</para>
<programlisting role="XML"><![CDATA[<async:quartz-dispatcher/>]]></programlisting>
16 years, 2 months