Seam SVN: r10238 - trunk/doc/Seam_Reference_Guide/it-IT.
by seam-commits@lists.jboss.org
Author: nico.ben
Date: 2009-03-30 15:39:14 -0400 (Mon, 30 Mar 2009)
New Revision: 10238
Modified:
trunk/doc/Seam_Reference_Guide/it-IT/Controls.po
Log:
JBSEAM-3767: Italian translation of Seam guide
Modified: trunk/doc/Seam_Reference_Guide/it-IT/Controls.po
===================================================================
--- trunk/doc/Seam_Reference_Guide/it-IT/Controls.po 2009-03-30 18:13:38 UTC (rev 10237)
+++ trunk/doc/Seam_Reference_Guide/it-IT/Controls.po 2009-03-30 19:39:14 UTC (rev 10238)
@@ -6,7 +6,7 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-01-05 00:19+0000\n"
-"PO-Revision-Date: 2009-03-28 15:41+0100\n"
+"PO-Revision-Date: 2009-03-30 21:38+0100\n"
"Last-Translator: Nicola Benaglia <nico.benaz(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@ -1806,7 +1806,7 @@
#: Controls.xml:1233
#, no-c-format
msgid "Registers the Seam component as a JSF converter. Shown here is a converter which is able to access the JPA EntityManager inside a JTA transaction, when converting the value back to it's object representation."
-msgstr ""
+msgstr "Registra il componente Seam come converter JSF. Qua è mostrato un converter capace di accedere all'EntityManager JPA dentro ad una transazione JTA, quando converte il valore legato alla rappresentazione del suo oggetto."
#. Tag: literal
#: Controls.xml:1243
@@ -1858,5 +1858,5 @@
#: Controls.xml:1249
#, no-c-format
msgid "Registers the Seam component as a JSF validator. Shown here is a validator which injects another Seam component; the injected component is used to validate the value."
-msgstr ""
+msgstr "Registra il componente Seam come validatore JSF. Qua è mostrato un validatore che inietta un altro componente Seam; il componente iniettato è usato per validare il valore."
15 years, 8 months
Seam SVN: r10237 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 14:13:38 -0400 (Mon, 30 Mar 2009)
New Revision: 10237
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml
Log:
add note about back button and redirect
Modified: trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml 2009-03-30 18:08:19 UTC (rev 10236)
+++ trunk/doc/Seam_Reference_Guide/en-US/Jbpm.xml 2009-03-30 18:13:38 UTC (rev 10237)
@@ -298,10 +298,10 @@
no-conversation-view-id="/main.xhtml"/>]]></programlisting>
<para>
- On the other hand, in the stateful model, backbuttoning is
+ On the other hand, in the stateful model, using the back button is
interpreted as an undefined transition back to a previous state.
Since the stateful model enforces a defined set of transitions
- from the current state, back buttoning is by default disallowed
+ from the current state, the back button is not permitted by default
in the stateful model! Seam transparently detects the use of the
back button, and blocks any attempt to perform an action from
a previous, "stale" page, and simply redirects the user to
@@ -322,10 +322,19 @@
</page>]]></programlisting>
<para>
- This allows backbuttoning <emphasis>from</emphasis> the
- <literal>checkout</literal> state to <emphasis>any previous
+ This allows navigation via the back button <emphasis>from</emphasis>
+ the <literal>checkout</literal> state to <emphasis>any previous
state!</emphasis>
</para>
+
+ <note>
+ If a page is set to redirect after a transition, it is not possible
+ to use the back button to return to that page even when back is
+ enabled on a page later in the flow. The reason is because Seam
+ stores information about the pageflow in the page scope and the back
+ button must result in a POST for that information to be restored
+ (i.e., a Faces request). A redirect severs this linkage.
+ </note>
<para>
Of course, we still need to define what happens if a request
15 years, 8 months
Seam SVN: r10236 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 14:08:19 -0400 (Mon, 30 Mar 2009)
New Revision: 10236
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Events.xml
Log:
fix broken end tag
Modified: trunk/doc/Seam_Reference_Guide/en-US/Events.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Events.xml 2009-03-30 17:40:32 UTC (rev 10235)
+++ trunk/doc/Seam_Reference_Guide/en-US/Events.xml 2009-03-30 18:08:19 UTC (rev 10236)
@@ -144,6 +144,8 @@
This condition consults the <literal>ResponseStateManager#isPostback(FacesContext)</literal> to
determine if the request is a postback. The ResponseStateManager is accessed using
<literal>FacesContext.getCurrentInstance().getRenderKit().getResponseStateManager()</literal>.
+ </para>
+
<para>
To save you from the verbosity of JSF's API, Seam offers a built-in condition that allows you to
accomplish the same result with a heck of a lot less typing. You can disable a page action on postback
15 years, 8 months
Seam SVN: r10235 - in trunk/seam-gen: icefaces/ide-project-files/idea and 3 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 13:40:32 -0400 (Mon, 30 Mar 2009)
New Revision: 10235
Modified:
trunk/seam-gen/icefaces/ide-project-files/eclipse/.classpath
trunk/seam-gen/icefaces/ide-project-files/idea/module.iml
trunk/seam-gen/ide-project-files/eclipse/.classpath
trunk/seam-gen/ide-project-files/idea/module.iml
trunk/seam-gen/ide-project-files/netbeans/project.xml
Log:
update mvel and drools library references
Modified: trunk/seam-gen/icefaces/ide-project-files/eclipse/.classpath
===================================================================
--- trunk/seam-gen/icefaces/ide-project-files/eclipse/.classpath 2009-03-30 17:21:15 UTC (rev 10234)
+++ trunk/seam-gen/icefaces/ide-project-files/eclipse/.classpath 2009-03-30 17:40:32 UTC (rev 10235)
@@ -24,7 +24,8 @@
<classpathentry kind="lib" path="lib/testng.jar"/>
<classpathentry kind="lib" path="lib/jboss-el.jar"/>
<classpathentry kind="lib" path="lib/el-api.jar"/>
- <classpathentry kind="lib" path="lib/mvel14.jar"/>
+ <classpathentry kind="lib" path="lib/mvel2.jar"/>
+ <classpathentry kind="lib" path="lib/drools-api.jar"/>
<classpathentry kind="lib" path="lib/drools-core.jar"/>
<classpathentry kind="lib" path="lib/drools-compiler.jar"/>
<classpathentry kind="lib" path="lib/janino.jar"/>
Modified: trunk/seam-gen/icefaces/ide-project-files/idea/module.iml
===================================================================
--- trunk/seam-gen/icefaces/ide-project-files/idea/module.iml 2009-03-30 17:21:15 UTC (rev 10234)
+++ trunk/seam-gen/icefaces/ide-project-files/idea/module.iml 2009-03-30 17:40:32 UTC (rev 10235)
@@ -241,7 +241,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/lib/mvel14.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/mvel2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -250,6 +250,15 @@
<orderEntry type="module-library">
<library>
<CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/drools-api.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
<root url="jar://$MODULE_DIR$/lib/drools-core.jar!/" />
</CLASSES>
<JAVADOC />
Modified: trunk/seam-gen/ide-project-files/eclipse/.classpath
===================================================================
--- trunk/seam-gen/ide-project-files/eclipse/.classpath 2009-03-30 17:21:15 UTC (rev 10234)
+++ trunk/seam-gen/ide-project-files/eclipse/.classpath 2009-03-30 17:40:32 UTC (rev 10235)
@@ -23,7 +23,8 @@
<classpathentry kind="lib" path="lib/testng.jar"/>
<classpathentry kind="lib" path="lib/jboss-el.jar"/>
<classpathentry kind="lib" path="lib/el-api.jar"/>
- <classpathentry kind="lib" path="lib/mvel14.jar"/>
+ <classpathentry kind="lib" path="lib/mvel2.jar"/>
+ <classpathentry kind="lib" path="lib/drools-api.jar"/>
<classpathentry kind="lib" path="lib/drools-core.jar"/>
<classpathentry kind="lib" path="lib/drools-compiler.jar"/>
<classpathentry kind="lib" path="lib/janino.jar"/>
Modified: trunk/seam-gen/ide-project-files/idea/module.iml
===================================================================
--- trunk/seam-gen/ide-project-files/idea/module.iml 2009-03-30 17:21:15 UTC (rev 10234)
+++ trunk/seam-gen/ide-project-files/idea/module.iml 2009-03-30 17:40:32 UTC (rev 10235)
@@ -236,7 +236,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/lib/mvel14.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/mvel2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -245,6 +245,15 @@
<orderEntry type="module-library">
<library>
<CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/drools-api.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
<root url="jar://$MODULE_DIR$/lib/drools-core.jar!/" />
</CLASSES>
<JAVADOC />
Modified: trunk/seam-gen/ide-project-files/netbeans/project.xml
===================================================================
--- trunk/seam-gen/ide-project-files/netbeans/project.xml 2009-03-30 17:21:15 UTC (rev 10234)
+++ trunk/seam-gen/ide-project-files/netbeans/project.xml 2009-03-30 17:40:32 UTC (rev 10235)
@@ -96,18 +96,18 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>src/main</package-root>
- <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel14.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
+ <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
<source-level>1.5</source-level>
</compilation-unit>
<compilation-unit>
<package-root>src/hot</package-root>
- <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel14.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
+ <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
<source-level>1.5</source-level>
</compilation-unit>
<compilation-unit>
<package-root>src/test</package-root>
<unit-tests/>
- <classpath mode="compile">bootstrap:lib/hibernate-validator.jar:lib/hibernate.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/testng.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel14.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
+ <classpath mode="compile">bootstrap:lib/hibernate-validator.jar:lib/hibernate.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/testng.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
<source-level>1.5</source-level>
</compilation-unit>
</java-data>
15 years, 8 months
Seam SVN: r10234 - trunk/src/main/org/jboss/seam/core.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 13:21:15 -0400 (Mon, 30 Mar 2009)
New Revision: 10234
Modified:
trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java
Log:
provide proper message when attempting to begin pageflow w/o bpm component installed
Modified: trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java 2009-03-30 15:37:09 UTC (rev 10233)
+++ trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java 2009-03-30 17:21:15 UTC (rev 10234)
@@ -240,6 +240,9 @@
{
if ( !pageflowName.equals("") )
{
+ if ( !Init.instance().isJbpmInstalled() ) {
+ throw new IllegalArgumentException("attempting to begin pageflow but required org.jboss.seam.bpm.jbpm component is not installed");
+ }
Pageflow.instance().begin(pageflowName);
}
}
15 years, 8 months
Seam SVN: r10233 - in trunk/examples/restbay: src/org/jboss/seam/example/restbay and 1 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-03-30 11:37:09 -0400 (Mon, 30 Mar 2009)
New Revision: 10233
Added:
trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceHome.java
trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceQuery.java
trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceHomeTest.java
trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceQueryTest.java
Modified:
trunk/examples/restbay/resources/WEB-INF/components.xml
trunk/examples/restbay/src/org/jboss/seam/example/restbay/Category.java
trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml
Log:
JBSEAM-3987 added tests
Modified: trunk/examples/restbay/resources/WEB-INF/components.xml
===================================================================
--- trunk/examples/restbay/resources/WEB-INF/components.xml 2009-03-30 15:16:52 UTC (rev 10232)
+++ trunk/examples/restbay/resources/WEB-INF/components.xml 2009-03-30 15:37:09 UTC (rev 10233)
@@ -7,6 +7,7 @@
xmlns:async="http://jboss.com/products/seam/async"
xmlns:web="http://jboss.com/products/seam/web"
xmlns:resteasy="http://jboss.com/products/seam/resteasy"
+ xmlns:framework="http://jboss.com/products/seam/framework"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
@@ -15,8 +16,10 @@
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.1.xsd
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
- http://jboss.com/products/seam/resteasy http://jboss.com/products/seam/resteasy-2.1.xsd
+ http://jboss.com/products/seam/resteasy /home/jharting/jboss/workspace/Seam_trunk_working_copy/src/resteasy/org/jboss/seam/resteasy/resteasy-2.1.xsd
+ http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.1.xsd
http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.1.xsd">
+ <!-- TODO change back the reference -->
<core:init jndi-pattern="@jndiPattern@" debug="true"/>
@@ -29,7 +32,19 @@
<async:quartz-dispatcher/>
+ <framework:entity-home name="categoryHome"
+ entity-class="org.jboss.seam.example.restbay.Category"
+ auto-create="true" />
+
<resteasy:application resource-path-prefix="/restv1">
</resteasy:application>
+
+ <resteasy:resource-home path="/configuredCategory" name="configuredCategoryResourceHome"
+ entity-home="#{categoryHome}" entity-id-class="java.lang.Integer"
+ media-types="application/xml application/json" />
+
+ <resteasy:resource-query path="/configuredCategory" name="configuredCategoryResourceQuery"
+ entity-class="org.jboss.seam.example.restbay.Category"
+ media-types="application/xml application/json"/>
</components>
Modified: trunk/examples/restbay/src/org/jboss/seam/example/restbay/Category.java
===================================================================
--- trunk/examples/restbay/src/org/jboss/seam/example/restbay/Category.java 2009-03-30 15:16:52 UTC (rev 10232)
+++ trunk/examples/restbay/src/org/jboss/seam/example/restbay/Category.java 2009-03-30 15:37:09 UTC (rev 10233)
@@ -3,11 +3,14 @@
import java.io.Serializable;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.xml.bind.annotation.XmlRootElement;
@Entity
+@XmlRootElement
public class Category implements Serializable
{
private static final long serialVersionUID = 411989568594034566L;
@@ -17,6 +20,7 @@
private Category parent;
@Id
+ @GeneratedValue
public Integer getCategoryId()
{
return categoryId;
Added: trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceHome.java
===================================================================
--- trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceHome.java (rev 0)
+++ trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceHome.java 2009-03-30 15:37:09 UTC (rev 10233)
@@ -0,0 +1,37 @@
+package org.jboss.seam.example.restbay;
+
+import javax.ws.rs.Path;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.framework.EntityHome;
+import org.jboss.seam.framework.Home;
+import org.jboss.seam.resteasy.ResourceHome;
+
+/**
+ * This resource demonstrates using ResourceHome component. This resource is
+ * used for testing purposes.
+ *
+ * @author Jozef Hartinger
+ *
+ */
+
+@Name("categoryResourceHome")
+@Path("extendedCategory")
+public class CategoryResourceHome extends ResourceHome<Category, Integer>
+{
+
+ @In
+ private EntityHome<Category> categoryHome;
+
+ @Override
+ public Home<?, Category> getEntityHome()
+ {
+ return categoryHome;
+ }
+
+ public CategoryResourceHome()
+ {
+ setMediaTypes(new String[] { "application/xml", "application/json" });
+ }
+}
Property changes on: trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceHome.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceQuery.java
===================================================================
--- trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceQuery.java (rev 0)
+++ trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceQuery.java 2009-03-30 15:37:09 UTC (rev 10233)
@@ -0,0 +1,19 @@
+package org.jboss.seam.example.restbay;
+
+import javax.ws.rs.Path;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.resteasy.ResourceQuery;
+
+/**
+ * Example of ResourceQuery usage. Used for testing purposes.
+ *
+ * @author Jozef Hartinger
+ *
+ */
+@Name("categoryResourceQuery")
+@Path("extendedCategory")
+public class CategoryResourceQuery extends ResourceQuery<Category>
+{
+
+}
Property changes on: trunk/examples/restbay/src/org/jboss/seam/example/restbay/CategoryResourceQuery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceHomeTest.java
===================================================================
--- trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceHomeTest.java (rev 0)
+++ trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceHomeTest.java 2009-03-30 15:37:09 UTC (rev 10233)
@@ -0,0 +1,164 @@
+package org.jboss.seam.example.restbay.test;
+
+import org.jboss.seam.example.restbay.test.fwk.MockHttpServletRequest;
+import org.jboss.seam.example.restbay.test.fwk.MockHttpServletResponse;
+import org.jboss.seam.example.restbay.test.fwk.ResourceSeamTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class ResourceHomeTest extends ResourceSeamTest
+{
+
+ @DataProvider(name = "queryPaths")
+ public Object[][] getData()
+ {
+ String[][] data = { { "/configuredCategory" }, { "/extendedCategory" } };
+ return data;
+ }
+
+ @Test(dataProvider = "queryPaths")
+ public void testResourceHomeRead(final String resourcePath) throws Exception
+ {
+ final String expectedResponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><categoryId>1</categoryId><name>Antiques</name></category>";
+ final String path = "/restv1" + resourcePath + "/1";
+
+ new ResourceRequest(Method.GET, path)
+ {
+
+ @Override
+ protected void prepareRequest(MockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "application/xml");
+ }
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ assertEquals(response.getContentAsString(), expectedResponse, "Unexpected response.");
+ }
+
+ }.run();
+ }
+
+ @Test(dataProvider = "queryPaths")
+ public void testResourceHomeCreate(final String resourcePath) throws Exception
+ {
+ final String name = "Airplanes";
+ final String body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><name>" + name + "</name></category>";
+ final String mediaType = "application/xml";
+ final String path = "/restv1" + resourcePath;
+
+ new ResourceRequest(Method.POST, path)
+ {
+ @Override
+ protected void prepareRequest(MockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ // TODO for some reason content type must be set using both these
+ // methods
+ request.addHeader("Content-Type", mediaType);
+ request.setContentType(mediaType);
+ request.setContent(body.getBytes());
+ }
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 201, "Unexpected response code.");
+ }
+
+ }.run();
+ }
+
+ @Test(dataProvider = "queryPaths")
+ public void testResourceHomeUpdate(String resourcePath) throws Exception
+ {
+ final String body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><categoryId>5</categoryId><name>" + resourcePath.hashCode() + "</name></category>";
+ final String mediaType = "application/xml";
+ final String path = "/restv1" + resourcePath + "/5";
+
+ new ResourceRequest(Method.PUT, path)
+ {
+
+ @Override
+ protected void prepareRequest(MockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.setContentType(mediaType);
+ request.addHeader("Content-Type", mediaType);
+ request.setContent(body.getBytes());
+ }
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 204, "Unexpected response code.");
+ }
+
+ }.run();
+
+ new ResourceRequest(Method.GET, path)
+ {
+
+ @Override
+ protected void prepareRequest(MockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", mediaType);
+ }
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 200, "Unexpected response code.");
+ assertEquals(response.getContentAsString(), body, "Unexpected response.");
+ }
+
+ }.run();
+
+ }
+
+ @Test
+ public void testResourceHomeDelete() throws Exception
+ {
+
+ final String path = "/restv1/configuredCategory/15004";
+
+ new ResourceRequest(Method.DELETE, path)
+ {
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 204, "Unexpected response code.");
+ }
+
+ }.run();
+
+ new ResourceRequest(Method.GET, path)
+ {
+
+ @Override
+ protected void prepareRequest(MockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "application/xml");
+ }
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 404, "Unexpected response code.");
+ }
+
+ }.run();
+ }
+}
Property changes on: trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceHomeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceQueryTest.java
===================================================================
--- trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceQueryTest.java (rev 0)
+++ trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceQueryTest.java 2009-03-30 15:37:09 UTC (rev 10233)
@@ -0,0 +1,52 @@
+package org.jboss.seam.example.restbay.test;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jboss.seam.example.restbay.test.fwk.MockHttpServletRequest;
+import org.jboss.seam.example.restbay.test.fwk.MockHttpServletResponse;
+import org.jboss.seam.example.restbay.test.fwk.ResourceSeamTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class ResourceQueryTest extends ResourceSeamTest
+{
+
+ @DataProvider(name = "queryPaths")
+ public Object[][] getData()
+ {
+ String[][] data = new String[2][1];
+ data[0][0] = "/configuredCategory";
+ data[1][0] = "/extendedCategory";
+ return data;
+ }
+
+ @Test(dataProvider = "queryPaths")
+ public void testResourceQuery(String path) throws Exception
+ {
+ new ResourceRequest(Method.GET, "/restv1" + path)
+ {
+
+ @Override
+ protected void prepareRequest(MockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "application/xml");
+ request.setQueryString("start=2&show=2");
+ }
+
+ @Override
+ protected void onResponse(MockHttpServletResponse response)
+ {
+ String expectedResponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><resteasy:collection xmlns:resteasy=\"http://jboss.org/resteasy\"><category><categoryId>3</categoryId><name>Books</name></category><category><categoryId>4</categoryId><name>Cameras and Photography</name></category></resteasy:collection>";
+ assertEquals(response.getContentAsString(), expectedResponse, "Unexpected response.");
+ }
+
+ }.run();
+ }
+
+}
Property changes on: trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/ResourceQueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml
===================================================================
--- trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml 2009-03-30 15:16:52 UTC (rev 10232)
+++ trunk/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml 2009-03-30 15:37:09 UTC (rev 10233)
@@ -13,5 +13,16 @@
<class name="org.jboss.seam.example.restbay.test.AuctionServiceTest"/>
</classes>
</test>
-
+
+ <test name="RestBay: ResourceHome">
+ <classes>
+ <class name="org.jboss.seam.example.restbay.test.ResourceHomeTest"/>
+ </classes>
+ </test>
+
+ <test name="RestBay: ResourceQuery">
+ <classes>
+ <class name="org.jboss.seam.example.restbay.test.ResourceQueryTest"/>
+ </classes>
+ </test>
</suite>
\ No newline at end of file
15 years, 8 months
Seam SVN: r10232 - in trunk: src/resteasy/org/jboss/seam/resteasy and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-03-30 11:16:52 -0400 (Mon, 30 Mar 2009)
New Revision: 10232
Added:
trunk/src/resteasy/org/jboss/seam/resteasy/AbstractResource.java
trunk/src/resteasy/org/jboss/seam/resteasy/EntityHomeWrapper.java
trunk/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java
trunk/src/resteasy/org/jboss/seam/resteasy/ResourceQuery.java
Modified:
trunk/build/resteasy.pom.xml
trunk/build/root.pom.xml
trunk/src/resteasy/org/jboss/seam/resteasy/Application.java
trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java
trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyDispatcher.java
trunk/src/resteasy/org/jboss/seam/resteasy/resteasy-2.1.xsd
Log:
JBSEAM-3987
Modified: trunk/build/resteasy.pom.xml
===================================================================
--- trunk/build/resteasy.pom.xml 2009-03-30 05:19:29 UTC (rev 10231)
+++ trunk/build/resteasy.pom.xml 2009-03-30 15:16:52 UTC (rev 10232)
@@ -27,11 +27,28 @@
</dependency>
<dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/build/root.pom.xml
===================================================================
--- trunk/build/root.pom.xml 2009-03-30 05:19:29 UTC (rev 10231)
+++ trunk/build/root.pom.xml 2009-03-30 15:16:52 UTC (rev 10232)
@@ -348,6 +348,22 @@
</dependency>
<dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ <version>1.1-RC1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.4.sp1</version>
Added: trunk/src/resteasy/org/jboss/seam/resteasy/AbstractResource.java
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/AbstractResource.java (rev 0)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/AbstractResource.java 2009-03-30 15:16:52 UTC (rev 10232)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.resteasy;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Resource class used by ResourceHome and ResourceQuery components. Contains
+ * information about path, media types and entity class the component operates
+ * on.
+ *
+ * @author Jozef Hartinger
+ *
+ * @param <T> entity class
+ */
+public abstract class AbstractResource<T>
+{
+
+ @Context
+ private HttpHeaders httpHeaders;
+
+ private String path = null;
+ private MediaType[] mediaTypes = null;
+ private Class entityClass = null;
+
+ public AbstractResource()
+ {
+ mediaTypes = new MediaType[] { MediaType.APPLICATION_XML_TYPE };
+ }
+
+ public MediaType[] getMediaTypes()
+ {
+ return mediaTypes;
+ }
+
+ public void setMediaTypes(String[] mediaTypes)
+ {
+ this.mediaTypes = new MediaType[mediaTypes.length];
+ for (int i = 0; i < mediaTypes.length; i++)
+ {
+ this.mediaTypes[i] = MediaType.valueOf(mediaTypes[i]);
+ }
+ }
+
+ public void setMediaTypes(MediaType[] mediaTypes)
+ {
+ this.mediaTypes = mediaTypes;
+ }
+
+ public void setEntityClass(Class entityClass)
+ {
+ this.entityClass = entityClass;
+ }
+
+ /**
+ * Retrieve entity class. If not set, type parameters of a superclass are
+ * examined.
+ *
+ * @return entity class
+ */
+ public Class<T> getEntityClass()
+ {
+ if (entityClass == null)
+ {
+ Type superclass = this.getClass().getGenericSuperclass();
+ if (superclass instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedSuperclass = (ParameterizedType) superclass;
+ if (parameterizedSuperclass.getActualTypeArguments().length > 0)
+ {
+ return (Class) parameterizedSuperclass.getActualTypeArguments()[0];
+ }
+ }
+ throw new RuntimeException("Unable to determine entity class.");
+ }
+ else
+ {
+ return entityClass;
+ }
+ }
+
+ /**
+ * Retrieve a suffix of this resource's URI. This property does not have to
+ * be set. @Path annotation can be used insted to set the URI.
+ *
+ * @see javax.ws.rs.Path
+ * @return path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * see {@link #getPath()}
+ *
+ * @param path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /**
+ * Select a media type that will be used for marshalling entity. Media type
+ * is selected from the intersection of media types supported by this
+ * resource and media types accepted by client.
+ *
+ * @return selected media type, returns null if no suitable media type is
+ * found
+ */
+ protected MediaType selectResponseMediaType()
+ {
+ for (MediaType acceptedMediaType : httpHeaders.getAcceptableMediaTypes())
+ {
+ for (MediaType availableMediaType : mediaTypes)
+ {
+ if (acceptedMediaType.isCompatible(availableMediaType))
+ return availableMediaType;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Check if media type passed as parameter is supported by this resource.
+ *
+ * @param mediaType
+ * @return true if and only if the media type is accepted by this resource
+ */
+ public boolean isMediaTypeCompatible(MediaType mediaType)
+ {
+ for (MediaType availableMediaType : mediaTypes)
+ {
+ if (availableMediaType.isCompatible(mediaType))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Property changes on: trunk/src/resteasy/org/jboss/seam/resteasy/AbstractResource.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/resteasy/org/jboss/seam/resteasy/Application.java
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/Application.java 2009-03-30 05:19:29 UTC (rev 10231)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/Application.java 2009-03-30 15:16:52 UTC (rev 10232)
@@ -23,9 +23,9 @@
public class Application extends javax.ws.rs.core.Application
{
- private Map<Class<?>, Component> providerClasses = new HashMap<Class<?>, Component>();
- private Map<Class<?>, Component> resourceClasses = new HashMap<Class<?>, Component>();
-
+ private Map<Class<?>, Set<Component>> providerClasses = new HashMap<Class<?>, Set<Component>>();
+ private Map<Class<?>, Set<Component>> resourceClasses = new HashMap<Class<?>, Set<Component>>();
+
private List<String> providerClassNames = new ArrayList<String>();
private List<String> resourceClassNames = new ArrayList<String>();
@@ -55,35 +55,57 @@
return resourceClasses.keySet();
}
- public void addProviderClass(Class<?> clazz, Component component)
- {
- providerClasses.put(clazz, component);
- }
+ public void addProviderClass(Class<?> clazz)
+ {
+ providerClasses.put(clazz, null);
+ }
+ public void addProviderClass(Class<?> clazz, Component component)
+ {
+ Set<Component> components = providerClasses.get(clazz);
+ if (components == null)
+ {
+ components = new HashSet<Component>();
+ providerClasses.put(clazz, components);
+ }
+ components.add(component);
+ }
+
public void removeProviderClass(Class<?> clazz)
{
providerClasses.remove(clazz);
}
- public void addResourceClass(Class<?> clazz, Component component)
- {
- resourceClasses.put(clazz, component);
- }
+ public void addResourceClass(Class<?> clazz)
+ {
+ resourceClasses.put(clazz, null);
+ }
+ public void addResourceClass(Class<?> clazz, Set<Component> newComponents)
+ {
+ Set<Component> components = resourceClasses.get(clazz);
+ if (components == null)
+ {
+ components = new HashSet<Component>();
+ resourceClasses.put(clazz, components);
+ }
+ components.addAll(newComponents);
+ }
+
public void removeResourceClass(Class<?> clazz)
{
resourceClasses.remove(clazz);
}
- public Component getProviderClassComponent(Class clazz)
- {
- return providerClasses.get(clazz) != null ? providerClasses.get(clazz) : null;
- }
+ public Set<Component> getProviderClassComponent(Class clazz)
+ {
+ return providerClasses.get(clazz) != null ? providerClasses.get(clazz) : null;
+ }
- public Component getResourceClassComponent(Class clazz)
- {
- return resourceClasses.get(clazz) != null ? resourceClasses.get(clazz) : null;
- }
+ public Set<Component> getResourceClassComponent(Class clazz)
+ {
+ return resourceClasses.get(clazz) != null ? resourceClasses.get(clazz) : null;
+ }
public Map<String, MediaType> getMediaTypeMappings()
{
Added: trunk/src/resteasy/org/jboss/seam/resteasy/EntityHomeWrapper.java
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/EntityHomeWrapper.java (rev 0)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/EntityHomeWrapper.java 2009-03-30 15:16:52 UTC (rev 10232)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.resteasy;
+
+import org.jboss.seam.framework.EntityHome;
+import org.jboss.seam.framework.HibernateEntityHome;
+import org.jboss.seam.framework.Home;
+
+/**
+ * This class provides an unified interface for accessing EntityHome and
+ * HibernateEntityHome instances.
+ *
+ * @author Jozef Hartinger
+ *
+ * @see org.jboss.seam.framework.EntityHome
+ * @see org.jboss.seam.framework.HibernateEntityHome
+ *
+ */
+public class EntityHomeWrapper<T>
+{
+ private Home<?, T> home = null;
+ private boolean hibernate;
+
+ /**
+ * EntityHome or HibernateEntityHome instance is expected.
+ */
+ public EntityHomeWrapper(Home<?, T> entityHome)
+ {
+ if (entityHome instanceof EntityHome)
+ {
+ hibernate = false;
+ }
+ else if (entityHome instanceof HibernateEntityHome)
+ {
+ hibernate = true;
+ }
+ else
+ {
+ throw new IllegalArgumentException("You must use either EntityHome or HibernateEntityHome instance.");
+ }
+ this.home = entityHome;
+ }
+
+ public Object getId()
+ {
+ return home.getId();
+ }
+
+ public void setId(Object id)
+ {
+ home.setId(id);
+ }
+
+ public T getInstance()
+ {
+ return home.getInstance();
+ }
+
+ public void setInstance(T instance)
+ {
+ home.setInstance(instance);
+ }
+
+ public T find()
+ {
+ if (hibernate)
+ {
+ return getHibernateEntityHome().find();
+ }
+ else
+ {
+ return getEntityHome().find();
+ }
+ }
+
+ public void persist()
+ {
+ if (hibernate)
+ {
+ getHibernateEntityHome().persist();
+ }
+ else
+ {
+ getEntityHome().persist();
+ }
+ }
+
+ public void remove()
+ {
+ if (hibernate)
+ {
+ getHibernateEntityHome().remove();
+ }
+ else
+ {
+ getEntityHome().remove();
+ }
+ }
+
+ /**
+ * Merge the state of the given entity with the current persistence context.
+ */
+ public void merge(T object)
+ {
+ if (hibernate)
+ {
+ getHibernateEntityHome().getSession().merge(object);
+ getHibernateEntityHome().update();
+ }
+ else
+ {
+ getEntityHome().getEntityManager().merge(object);
+ getEntityHome().update();
+ }
+ }
+
+ public Class<T> getEntityClass()
+ {
+ return home.getEntityClass();
+ }
+
+ private EntityHome<T> getEntityHome()
+ {
+ return (EntityHome<T>) home;
+ }
+
+ private HibernateEntityHome<T> getHibernateEntityHome()
+ {
+ return (HibernateEntityHome<T>) home;
+ }
+
+ /**
+ * Return the underlying EntityHome or HibernateEntityHome instance.
+ */
+ public Home<?, T> unwrap()
+ {
+ if (hibernate)
+ {
+ return getHibernateEntityHome();
+ }
+ else
+ {
+ return getEntityHome();
+ }
+ }
+
+}
Property changes on: trunk/src/resteasy/org/jboss/seam/resteasy/EntityHomeWrapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java (rev 0)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java 2009-03-30 15:16:52 UTC (rev 10232)
@@ -0,0 +1,371 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.resteasy;
+
+import java.io.InputStream;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.net.URI;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.ext.MessageBodyReader;
+
+import org.jboss.resteasy.core.Headers;
+import org.jboss.resteasy.core.StringParameterInjector;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+import org.jboss.seam.Entity;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.framework.Home;
+
+import static javax.ws.rs.core.Response.Status.UNSUPPORTED_MEDIA_TYPE;
+import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
+
+/**
+ * This component exposes EntityHome and HibernateEntityHome components as a
+ * REST resource.
+ *
+ * @author Jozef Hartinger
+ *
+ * @param <T> Entity class
+ * @param <T2> Entity id class
+ */
+@Path("")
+public class ResourceHome<T, T2> extends AbstractResource<T>
+{
+ private EntityHomeWrapper<T> entityHome = null;
+
+ @Context
+ private UriInfo uriInfo;
+ @Context
+ private Headers headers;
+ @HeaderParam("Content-Type")
+ private MediaType requestContentType;
+
+ private Class entityIdClass = null;
+ private boolean readonly;
+
+ /**
+ * Called at component instantiation. EntityHome component must be set in
+ * order for component to be created.
+ */
+ @Create
+ public void create()
+ {
+ setEntityHome(getEntityHome());
+ if (entityHome == null)
+ {
+ throw new IllegalStateException("entityHome is not set");
+ }
+ }
+
+ /**
+ * Called by RESTEasy when HTTP GET request is received. String form of
+ * entity identifier is passed as a parameter. Returns a response containing
+ * database entity.
+ *
+ * @see #getEntity
+ * @param rawId String form of entity identifier
+ * @return response
+ */
+ @Path("/{id}")
+ @GET
+ public Response getResource(@PathParam("id") String rawId)
+ {
+ MediaType selectedMediaType = selectResponseMediaType();
+ if (selectedMediaType == null)
+ {
+ return Response.status(UNSUPPORTED_MEDIA_TYPE).build();
+ }
+
+ T2 id = unmarshallId(rawId);
+ T entity = getEntity(id);
+
+ return Response.ok(new GenericEntity(entity, getEntityClass())
+ {
+ }, selectedMediaType).build();
+ }
+
+ /**
+ * Retrieve an entity identified by id parameter.
+ *
+ * @param id entity identifier
+ * @return entity database entity
+ */
+ public T getEntity(T2 id)
+ {
+ entityHome.setId(id);
+ return entityHome.find();
+
+ }
+
+ /**
+ * Called by RESTEasy when HTTP POST request is received. Persists received
+ * entity and returns 201 HTTP status code with location header set to new
+ * URI if operation succeeds.
+ *
+ * @see #createEntity
+ * @param messageBody HTTP request body
+ * @return response
+ */
+ @POST
+ public Response createResource(InputStream messageBody)
+ {
+ if (readonly)
+ {
+ return Response.status(405).build();
+ }
+
+ // check if we accept this content type
+ if (!isMediaTypeCompatible(requestContentType))
+ {
+ return Response.status(UNSUPPORTED_MEDIA_TYPE).build();
+ }
+
+ T entity = unmarshallEntity(messageBody);
+
+ T2 id = createEntity(entity);
+
+ URI uri = uriInfo.getAbsolutePathBuilder().path(id.toString()).build();
+ return Response.created(uri).build();
+ }
+
+ /**
+ * Store entity passed as a parameter in the database.
+ *
+ * @param entity Object to be persisted
+ * @return id identifier assigned to the entity
+ */
+ public T2 createEntity(T entity)
+ {
+ entityHome.setInstance(entity);
+ entityHome.persist();
+ return (T2) entityHome.getId();
+ }
+
+ /**
+ * Called by RESTEasy when HTTP PUT request is received. Merges the state of
+ * the database entity with the received representation.
+ *
+ * @see #updateEntity
+ * @param rawId String form of entity identifier
+ * @param messageBody HTTP request body
+ * @return response
+ */
+ @Path("/{id}")
+ @PUT
+ public Response updateResource(@PathParam("id") String rawId, InputStream messageBody)
+ {
+ if (readonly)
+ {
+ return Response.status(405).build();
+ }
+
+ // check if we accept this content type
+ if (!isMediaTypeCompatible(requestContentType))
+ {
+ return Response.status(UNSUPPORTED_MEDIA_TYPE).build();
+ }
+
+ T entity = unmarshallEntity(messageBody);
+ T2 id = unmarshallId(rawId);
+
+ // check representation id - we don't allow renaming
+ Object storedId = Entity.forBean(entity).getIdentifier(entity);
+ if (!id.equals(storedId))
+ {
+ return Response.status(BAD_REQUEST).build();
+ }
+
+ updateEntity(entity);
+ return Response.noContent().build();
+ }
+
+ /**
+ * Merge the state of the database entity with the entity passed as a
+ * parameter.
+ *
+ * @param entity
+ */
+ public void updateEntity(T entity)
+ {
+ entityHome.merge(entity);
+ }
+
+ /**
+ * Called by RESTEasy when HTTP DELETE request is received. Deletes a
+ * database entity.
+ *
+ * @see #deleteEntity
+ * @param rawId String form of entity identifier
+ * @return response
+ */
+ @Path("/{id}")
+ @DELETE
+ public Response deleteResource(@PathParam("id") String rawId)
+ {
+ if (readonly)
+ {
+ return Response.status(405).build();
+ }
+
+ T2 id = unmarshallId(rawId);
+ deleteEntity(id);
+ return Response.noContent().build();
+ }
+
+ /**
+ * Delete database entity.
+ *
+ * @param id entity identifier
+ */
+ public void deleteEntity(T2 id)
+ {
+ getEntity(id);
+ entityHome.remove();
+ }
+
+ /**
+ * Convert HTTP request body into entity class instance.
+ *
+ * @param is HTTP request body
+ * @return entity
+ */
+ private T unmarshallEntity(InputStream is)
+ {
+ Class<T> entityClass = getEntityClass();
+ MessageBodyReader<T> reader = ResteasyProviderFactory.getInstance().getMessageBodyReader(entityClass, entityClass, entityClass.getAnnotations(), requestContentType);
+ if (reader == null)
+ {
+ throw new RuntimeException("Unable to find MessageBodyReader for content type " + requestContentType);
+ }
+ T entity;
+ try
+ {
+ entity = reader.readFrom(entityClass, entityClass, entityClass.getAnnotations(), requestContentType, headers, is);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to unmarshall request body");
+ }
+ return entity;
+ }
+
+ /**
+ * Converts String form of entity identifier to it's natural type.
+ *
+ * @param id String form of entity identifier
+ * @return entity identifier
+ */
+ private T2 unmarshallId(String id)
+ {
+ StringParameterInjector injector = new StringParameterInjector(getEntityIdClass(), getEntityIdClass(), "id", PathParam.class, null, null, ResteasyProviderFactory.getInstance());
+ return (T2) injector.extractValue(id);
+ }
+
+ /**
+ * EntityHome component getter. Override this method to set the EntityHome
+ * this resource will operate on. You can use either EntityHome or
+ * HibernateEntityHome instance.
+ *
+ * @return entity home
+ */
+ public Home<?, T> getEntityHome()
+ {
+ return (entityHome == null) ? null : entityHome.unwrap();
+ }
+
+ /**
+ * EntityHome component setter
+ *
+ * @param entityHome
+ */
+ public void setEntityHome(Home<?, T> entityHome)
+ {
+ this.entityHome = new EntityHomeWrapper<T>(entityHome);
+ }
+
+ @Override
+ public Class<T> getEntityClass()
+ {
+ return entityHome.getEntityClass();
+ }
+
+ public boolean isReadonly()
+ {
+ return readonly;
+ }
+
+ /**
+ * If set to read-only mode, this resource will only response to GET
+ * requests. HTTP 415 status code (method not allowed) will returned in all
+ * other cases.
+ *
+ * @param readonly
+ */
+ public void setReadonly(boolean readonly)
+ {
+ this.readonly = readonly;
+ }
+
+ /**
+ * Retrieve entity identifier's class. If not set, type parameters of a
+ * superclass are examined.
+ *
+ * @return class of entity identifier
+ */
+ public Class getEntityIdClass()
+ {
+ if (entityIdClass == null)
+ {
+ Type superclass = this.getClass().getGenericSuperclass();
+ if (superclass instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedSuperclass = (ParameterizedType) superclass;
+ if (parameterizedSuperclass.getActualTypeArguments().length == 2)
+ {
+ return (Class) parameterizedSuperclass.getActualTypeArguments()[1];
+ }
+ }
+ throw new RuntimeException("Unable to determine entity id class.");
+ }
+ else
+ {
+ return entityIdClass;
+ }
+ }
+
+ public void setEntityIdClass(Class entityIdClass)
+ {
+ this.entityIdClass = entityIdClass;
+ }
+}
Property changes on: trunk/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/resteasy/org/jboss/seam/resteasy/ResourceQuery.java
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/ResourceQuery.java (rev 0)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/ResourceQuery.java 2009-03-30 15:16:52 UTC (rev 10232)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.resteasy;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.jboss.resteasy.annotations.providers.jaxb.Wrapped;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.framework.EntityQuery;
+import org.jboss.seam.framework.Query;
+import static javax.ws.rs.core.Response.Status.UNSUPPORTED_MEDIA_TYPE;
+import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
+
+/**
+ * This component exposes EntityQuery component as a REST resource responding to
+ * HTTP GET request.
+ *
+ * @author Jozef Hartinger
+ *
+ * @param <T> entity type
+ */
+@Path("")
+public class ResourceQuery<T> extends AbstractResource<T>
+{
+
+ private Query<?, T> entityQuery = null;
+
+ /**
+ * Called at component instantiation.
+ */
+ @Create
+ public void create()
+ {
+ this.entityQuery = getEntityQuery();
+ if (entityQuery == null)
+ {
+ this.entityQuery = createEntityQuery();
+ }
+ }
+
+ /**
+ * Called by RESTEasy to respond for an HTTP GET request. Retrieves a list of
+ * entities matching criteria set by query parameters from database and
+ * returns it wrapped in Response instance.
+ *
+ * @see #getEntityList
+ * @param start first entity in the list
+ * @param show maximum size of the list
+ * @return representation of a list of database entries
+ */
+ @GET
+ @Wrapped
+ public Response getResourceList(@QueryParam("start") @DefaultValue("0") int start, @QueryParam("show") @DefaultValue("25") int show)
+ {
+ MediaType selectedMediaType = selectResponseMediaType();
+ if (selectedMediaType == null)
+ {
+ return Response.status(UNSUPPORTED_MEDIA_TYPE).build();
+ }
+
+ if ((start < 0) || (show < 0))
+ {
+ return Response.status(BAD_REQUEST).build();
+ }
+
+ final List<T> result = getEntityList(start, show);
+ // create a proper response type
+ Type responseType = new ParameterizedType()
+ {
+
+ public Type getRawType()
+ {
+ return result.getClass();
+ }
+
+ public Type getOwnerType()
+ {
+ return null;
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ Type[] types = { getEntityClass() };
+ return types;
+ }
+ };
+ return Response.ok(new GenericEntity(result, responseType)
+ {
+ }, selectedMediaType).build();
+ }
+
+ /**
+ * Retrieve a list of database entities.
+ *
+ * @param start first entity in the list
+ * @param show maximum size of the list, 0 for unlimited
+ * @return list of database entries
+ */
+ public List<T> getEntityList(int start, int show)
+ {
+ entityQuery.setFirstResult(start);
+ if (show > 0) // set 0 for unlimited
+ {
+ entityQuery.setMaxResults(show);
+ }
+ return entityQuery.getResultList();
+ }
+
+ /**
+ * EntityQuery getter
+ *
+ * @return EntityQuery instance
+ */
+ public Query<?, T> getEntityQuery()
+ {
+ return entityQuery;
+ }
+
+ public void setEntityQuery(Query<?, T> query)
+ {
+ this.entityQuery = query;
+ }
+
+ public Query<?, T> createEntityQuery()
+ {
+ Query<?, T> entityQuery = new EntityQuery<T>();
+ entityQuery.setEjbql("select entity from " + getEntityClass().getName() + " entity");
+ return entityQuery;
+ }
+}
Property changes on: trunk/src/resteasy/org/jboss/seam/resteasy/ResourceQuery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java 2009-03-30 05:19:29 UTC (rev 10231)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java 2009-03-30 15:16:52 UTC (rev 10232)
@@ -13,6 +13,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
/**
* Scans annoated JAX-RS resources and providers, optionally registers them as Seam components.
@@ -53,7 +54,7 @@
}
log.debug("finding all Seam component classes");
- Map<Class, Component> seamComponents = new HashMap<Class, Component>();
+ Map<Class, Set<Component>> seamComponents = new HashMap<Class, Set<Component>>();
String[] applicationContextNames = Contexts.getApplicationContext().getNames();
for (String applicationContextName : applicationContextNames)
{
@@ -62,7 +63,12 @@
Component seamComponent =
(Component) Component.getInstance(applicationContextName, ScopeType.APPLICATION);
// TODO: This should consider EJB components/annotations on interfaces somehow?
- seamComponents.put(seamComponent.getBeanClass(), seamComponent);
+ Class beanClass = seamComponent.getBeanClass();
+ if (!seamComponents.containsKey(beanClass))
+ {
+ seamComponents.put(beanClass, new HashSet<Component>());
+ }
+ seamComponents.get(beanClass).add(seamComponent);
}
}
@@ -71,7 +77,7 @@
}
// Load all provider classes, either scanned or through explicit configuration
- protected void registerProviders(Map<Class, Component> seamComponents, Collection annotatedProviderClasses)
+ protected void registerProviders(Map<Class, Set<Component>> seamComponents, Collection annotatedProviderClasses)
{
Collection<Class> providerClasses = new HashSet<Class>();
try
@@ -92,30 +98,37 @@
// Ignore built-in providers, we register them manually later
if (providerClass.getName().startsWith("org.jboss.resteasy.plugins.providers")) continue;
- Component seamComponent = null;
// Check if this is also a Seam component bean class
if (seamComponents.containsKey(providerClass))
{
- seamComponent = seamComponents.get(providerClass);
- // Needs to be APPLICATION or STATELESS
- if (!seamComponent.getScope().equals(ScopeType.APPLICATION) &&
+ for (Component seamComponent : seamComponents.get(providerClass))
+ {
+ // Needs to be APPLICATION or STATELESS
+ if (!seamComponent.getScope().equals(ScopeType.APPLICATION) &&
!seamComponent.getScope().equals(ScopeType.STATELESS))
- {
- log.warn("can't add provider Seam component, not APPLICATION or STATELESS scope: " + seamComponent.getName());
- log.warn("this provider class will be registered without Seam injection or lifecycle!");
- seamComponent = null;
- }
+ {
+ log.warn("can't add provider Seam component, not APPLICATION or STATELESS scope: " + seamComponent.getName());
+ log.warn("this provider class will be registered without Seam injection or lifecycle!");
+ seamComponent = null;
+ }
+ if (seamComponent != null)
+ {
+ log.debug("adding provider Seam component: " + seamComponent.getName());
+ application.addProviderClass(providerClass, seamComponent);
+ }
+ else
+ {
+ log.debug("adding provider class: " + providerClass.getName());
+ application.addProviderClass(providerClass);
+ }
+ }
}
- if (seamComponent != null)
- {
- log.debug("adding provider Seam component: " + seamComponent.getName());
- }
else
{
- log.debug("adding provider class: " + providerClass.getName());
+ log.debug("adding provider class: " + providerClass.getName());
+ application.addProviderClass(providerClass);
}
- application.addProviderClass(providerClass, seamComponent);
- }
+ }
if (application.getProviderClasses().size() == 0 &&
!application.isUseBuiltinProviders())
{
@@ -124,7 +137,7 @@
}
// Load all resource classes, either scanned or through explicit configuration
- protected void registerResources(Map<Class, Component> seamComponents, Collection annotatedResourceClasses)
+ protected void registerResources(Map<Class, Set<Component>> seamComponents, Collection annotatedResourceClasses)
{
Collection<Class> resourceClasses = new HashSet<Class>();
try
@@ -142,19 +155,18 @@
}
for (Class<Object> resourceClass : resourceClasses)
{
-
- Component seamComponent = null;
// Check if this is also a Seam component bean class
if (seamComponents.containsKey(resourceClass))
{
- seamComponent = seamComponents.get(resourceClass);
- log.debug("adding resource Seam component: " + seamComponent.getName());
+ Set<Component> components = seamComponents.get(resourceClass);
+ log.debug("adding resource Seam components {0} for class {1}", components, resourceClass);
+ application.addResourceClass(resourceClass, components);
}
else
{
log.debug("adding resource class with JAX-RS default lifecycle: " + resourceClass.getName());
+ application.addResourceClass(resourceClass);
}
- application.addResourceClass(resourceClass, seamComponent);
}
if (application.getClasses().size() == 0)
log.info("no JAX-RS resource classes registered");
Modified: trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyDispatcher.java
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyDispatcher.java 2009-03-30 05:19:29 UTC (rev 10231)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/ResteasyDispatcher.java 2009-03-30 15:16:52 UTC (rev 10232)
@@ -1,5 +1,7 @@
package org.jboss.seam.resteasy;
+import java.util.Set;
+
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.contexts.Contexts;
@@ -60,38 +62,40 @@
}
for (Class providerClass : application.getProviderClasses())
{
- log.debug("registering JAX RS provider class: " + providerClass.getName());
- Component seamComponent = application.getProviderClassComponent(providerClass);
- if (seamComponent != null)
+ Set<Component> seamComponents = application.getProviderClassComponent(providerClass);
+ if (seamComponents != null)
{
- if (ScopeType.STATELESS.equals(seamComponent.getScope()))
+ for (Component seamComponent : seamComponents)
{
- throw new RuntimeException(
- "Registration of STATELESS Seam components as RESTEasy providers not implemented!"
- );
- }
- else if (ScopeType.APPLICATION.equals(seamComponent.getScope()))
- {
- Object providerInstance = Component.getInstance(seamComponent.getName());
- boolean isStringConverter = false;
- for (Class componentIface : seamComponent.getBusinessInterfaces())
- {
- if (StringConverter.class.isAssignableFrom(componentIface))
- {
+ if (ScopeType.STATELESS.equals(seamComponent.getScope()))
+ {
+ throw new RuntimeException(
+ "Registration of STATELESS Seam components as RESTEasy providers not implemented!"
+ );
+ }
+ else if (ScopeType.APPLICATION.equals(seamComponent.getScope()))
+ {
+ Object providerInstance = Component.getInstance(seamComponent.getName());
+ boolean isStringConverter = false;
+ for (Class componentIface : seamComponent.getBusinessInterfaces())
+ {
+ if (StringConverter.class.isAssignableFrom(componentIface))
+ {
isStringConverter = true;
break;
- }
- }
- if (isStringConverter)
- {
- log.error("can't register Seam component as RESTEasy StringConverter, see: https://jira.jboss.org/jira/browse/JBSEAM-4020");
- //log.debug("registering Seam component as custom RESTEasy string converter provider: " + seamComponent.getName());
- //providerFactory.addStringConverter((StringConverter)providerInstance);
- }
- else
- {
- providerFactory.registerProviderInstance(providerInstance);
- }
+ }
+ }
+ if (isStringConverter)
+ {
+ log.error("can't register Seam component as RESTEasy StringConverter, see: https://jira.jboss.org/jira/browse/JBSEAM-4020");
+ //log.debug("registering Seam component as custom RESTEasy string converter provider: " + seamComponent.getName());
+ //providerFactory.addStringConverter((StringConverter)providerInstance);
+ }
+ else
+ {
+ providerFactory.registerProviderInstance(providerInstance);
+ }
+ }
}
}
else
@@ -114,13 +118,15 @@
for (final Class resourceClass : application.getClasses())
{
log.debug("registering JAX RS resource class: " + resourceClass);
- final Component seamComponent = application.getResourceClassComponent(resourceClass);
- if (seamComponent != null)
+ Set<Component> components = application.getResourceClassComponent(resourceClass);
+ if (components != null)
{
- // Seam component lookup when call is dispatched to resource
- log.debug("registering as Seam component resource factory: " + resourceClass);
- registry.addResourceFactory(
- new ResourceFactory()
+ log.debug("registering all {0} components of {1}", components.size(), resourceClass);
+ // Register every component
+ for (final Component seamComponent : components)
+ {
+ // Seam component lookup when call is dispatched to resource
+ ResourceFactory factory = new ResourceFactory()
{
public Class<?> getScannableClass()
@@ -159,12 +165,39 @@
public void unregistered()
{
}
- }
- );
+ };
+ // Register on specific path if component has it's path property set to not-null value
+ if (AbstractResource.class.isAssignableFrom(seamComponent.getBeanClass()))
+ {
+ // TODO get the path some other way - it may not be possible to create a instance at this time
+ AbstractResource instance = (AbstractResource) seamComponent.newInstance();
+ String path = instance.getPath();
+ if (instance.getPath() != null)
+ {
+ log.debug("registering resource {0} on path {1}", seamComponent.getName(), path);
+ registry.addResourceFactory(factory, path);
+ }
+ else
+ {
+ log.debug("registering resource {0}", seamComponent.getName());
+ registry.addResourceFactory(factory);
+ }
+ }
+ else
+ {
+ log.debug("registering resource {0}", seamComponent.getName());
+ registry.addResourceFactory(factory);
+ }
+ }
}
else
{
+ // ResourceHome and ResourceQuery won't be registered if not declared as a component
+ if (ResourceHome.class.equals(resourceClass) || ResourceQuery.class.equals(resourceClass))
+ continue;
+
// JAX-RS default lifecycle
+ log.info("registering resource {0} with default JAX-RS lifecycle", resourceClass);
registry.addResourceFactory(new POJOResourceFactory(resourceClass));
}
}
Modified: trunk/src/resteasy/org/jboss/seam/resteasy/resteasy-2.1.xsd
===================================================================
--- trunk/src/resteasy/org/jboss/seam/resteasy/resteasy-2.1.xsd 2009-03-30 05:19:29 UTC (rev 10231)
+++ trunk/src/resteasy/org/jboss/seam/resteasy/resteasy-2.1.xsd 2009-03-30 15:16:52 UTC (rev 10232)
@@ -51,6 +51,34 @@
</xs:complexType>
</xs:element>
+ <xs:element name="resource-home">
+ <xs:annotation>
+ <xs:documentation>
+ Allows you to expose an entity home component as a
+ REST resource.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attributeGroup ref="resteasy:attlist.resourceHome" />
+ <xs:attributeGroup ref="resteasy:attlist.abstractResource" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="resource-query">
+ <xs:annotation>
+ <xs:documentation>
+ Allows you to expose an entity query component as a
+ REST resource.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attributeGroup ref="resteasy:attlist.resourceQuery" />
+ <xs:attributeGroup ref="resteasy:attlist.abstractResource" />
+ </xs:complexType>
+ </xs:element>
+
<xs:attributeGroup name="attlist.application">
<xs:attribute name="scan-providers" type="components:boolean">
<xs:annotation>
@@ -92,5 +120,67 @@
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
+
+ <xs:attributeGroup name="attlist.abstractResource">
+ <xs:attribute name="path" type="xs:string" use="required" >
+ <xs:annotation>
+ <xs:documentation>
+ Location of the resource. For example /user
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="media-types" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ Media type this resource will operate on. Defaults to application/xml.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:attributeGroup name="attlist.resourceHome">
+ <xs:attribute name="entity-id-class" type="xs:string"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>
+ Entity identifier class.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="entity-home" type="components:elType"
+ use="required">
+ <xs:annotation>
+ <xs:documentation>
+ EntityHome component that will be used for operating database.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="readonly" type="xs:boolean" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Disable "write" operations on this resource. Resource will only allow GET
+ method.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="attlist.resourceQuery">
+ <xs:attribute name="entity-class" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ Entity class.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="entity-query" type="components:elType">
+ <xs:annotation>
+ <xs:documentation>
+ EntityQuery component that will be used for
+ listing operation (GET on path). If not set, it will be created
+ automatically.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:attributeGroup>
</xs:schema>
15 years, 8 months
Seam SVN: r10231 - in trunk/seam-gen: icefaces/view/layout and 1 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 01:19:29 -0400 (Mon, 30 Mar 2009)
New Revision: 10231
Modified:
trunk/seam-gen/icefaces/view/layout/loginout.xhtml
trunk/seam-gen/icefaces/view/layout/menu.xhtml
trunk/seam-gen/icefaces/view/layout/menu.xhtml.ftl
trunk/seam-gen/icefaces/view/layout/template.xhtml
trunk/seam-gen/icefaces/view/login.xhtml
trunk/seam-gen/view/layout/menu.xhtml
trunk/seam-gen/view/layout/menu.xhtml.ftl
Log:
JBSEAM-3391
Modified: trunk/seam-gen/icefaces/view/layout/loginout.xhtml
===================================================================
--- trunk/seam-gen/icefaces/view/layout/loginout.xhtml 2009-03-30 05:12:25 UTC (rev 10230)
+++ trunk/seam-gen/icefaces/view/layout/loginout.xhtml 2009-03-30 05:19:29 UTC (rev 10231)
@@ -4,7 +4,7 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib">
- <h:outputText id="logoutWelcomeId" value="Welcome, #{identity.username}" rendered="#{identity.loggedIn}"/>
+ <h:outputText id="logoutWelcomeId" value="Welcome, #{credentials.username}" rendered="#{identity.loggedIn}"/>
 | 
<s:link view="/login.xhtml" id="logoutLoginId" value="Login" rendered="#{not identity.loggedIn}"/>
<s:link view="/home.xhtml" id="logoutLogoutId" action="#{identity.logout}" value="Logout" rendered="#{identity.loggedIn}"/>
Modified: trunk/seam-gen/icefaces/view/layout/menu.xhtml
===================================================================
--- trunk/seam-gen/icefaces/view/layout/menu.xhtml 2009-03-30 05:12:25 UTC (rev 10230)
+++ trunk/seam-gen/icefaces/view/layout/menu.xhtml 2009-03-30 05:19:29 UTC (rev 10231)
@@ -17,7 +17,7 @@
</ice:panelGroup>
<ice:panelGroup id="menuPanelGroupRight" >
- <h:outputText id="menuWelcomeId" value="signed in as: #{identity.username}" rendered="#{identity.loggedIn}"/>
+ <h:outputText id="menuWelcomeId" value="signed in as: #{credentials.username}" rendered="#{identity.loggedIn}"/>
<s:link id="menuLoginId" view="/login.xhtml" value="Login" rendered="#{not identity.loggedIn}" propagation="none"/>
<s:link id="menuLogoutId" view="/home.xhtml" action="#{identity.logout}" value="Logout" rendered="#{identity.loggedIn}" propagation="none"/>
</ice:panelGroup>
Modified: trunk/seam-gen/icefaces/view/layout/menu.xhtml.ftl
===================================================================
--- trunk/seam-gen/icefaces/view/layout/menu.xhtml.ftl 2009-03-30 05:12:25 UTC (rev 10230)
+++ trunk/seam-gen/icefaces/view/layout/menu.xhtml.ftl 2009-03-30 05:19:29 UTC (rev 10231)
@@ -24,7 +24,7 @@
<!-- @newMenuItem@ -->
</ice:panelGroup>
<ice:panelGroup id="rightMenuId">
- <h:outputText id="menuWelcomeId" value="signed in as: ${'#'}{identity.username}" rendered="${'#'}{identity.loggedIn}"/>
+ <h:outputText id="menuWelcomeId" value="signed in as: ${'#'}{credentials.username}" rendered="${'#'}{identity.loggedIn}"/>
<s:link view="/login.xhtml" id="menuLoginId" value="Login" rendered="${'#'}{not identity.loggedIn}" propagation="none"/>
<s:link view="/home.xhtml" id="menulogoutId" action="${'#'}{identity.logout}" value="Logout" rendered="${'#'}{identity.loggedIn}" propagation="none"/>
</ice:panelGroup>
Modified: trunk/seam-gen/icefaces/view/layout/template.xhtml
===================================================================
--- trunk/seam-gen/icefaces/view/layout/template.xhtml 2009-03-30 05:12:25 UTC (rev 10230)
+++ trunk/seam-gen/icefaces/view/layout/template.xhtml 2009-03-30 05:19:29 UTC (rev 10231)
@@ -38,7 +38,7 @@
- Generated by icefaces-seam-gen
<ice:panelGroup rendered="#{identity.loggedIn}">
#{_}
- [#{identity.username}]
+ [#{credentials.username}]
</ice:panelGroup>
<ice:panelGroup rendered="#{init.debug}">
<br />
Modified: trunk/seam-gen/icefaces/view/login.xhtml
===================================================================
--- trunk/seam-gen/icefaces/view/login.xhtml 2009-03-30 05:12:25 UTC (rev 10230)
+++ trunk/seam-gen/icefaces/view/login.xhtml 2009-03-30 05:19:29 UTC (rev 10231)
@@ -27,10 +27,10 @@
<ice:panelGrid id="loginPanelGridId" columns="2" rowClasses="prop" columnClasses="name,value">
<h:outputLabel for="username">Username</h:outputLabel>
<ice:inputText id="username"
- value="#{identity.username}"/>
+ value="#{credentials.username}"/>
<h:outputLabel for="password">Password</h:outputLabel>
<ice:inputSecret id="password"
- value="#{identity.password}"/>
+ value="#{credentials.password}"/>
<h:outputLabel for="rememberMe">Remember me</h:outputLabel>
<ice:selectBooleanCheckbox id="rememberMe"
value="#{rememberMe.enabled}"/>
Modified: trunk/seam-gen/view/layout/menu.xhtml
===================================================================
--- trunk/seam-gen/view/layout/menu.xhtml 2009-03-30 05:12:25 UTC (rev 10230)
+++ trunk/seam-gen/view/layout/menu.xhtml 2009-03-30 05:19:29 UTC (rev 10231)
@@ -11,7 +11,7 @@
</rich:toolBarGroup>
<!-- @newMenuItem@ -->
<rich:toolBarGroup location="right">
- <h:outputText value="signed in as: #{identity.username}" rendered="#{identity.loggedIn}"/>
+ <h:outputText value="signed in as: #{credentials.username}" rendered="#{identity.loggedIn}"/>
<s:link view="/login.xhtml" value="Login" rendered="#{not identity.loggedIn}" propagation="none"/>
<s:link view="/home.xhtml" action="#{identity.logout}" value="Logout" rendered="#{identity.loggedIn}" propagation="none"/>
</rich:toolBarGroup>
Modified: trunk/seam-gen/view/layout/menu.xhtml.ftl
===================================================================
--- trunk/seam-gen/view/layout/menu.xhtml.ftl 2009-03-30 05:12:25 UTC (rev 10230)
+++ trunk/seam-gen/view/layout/menu.xhtml.ftl 2009-03-30 05:19:29 UTC (rev 10231)
@@ -17,7 +17,7 @@
</#foreach>
<!-- @newMenuItem@ -->
<rich:toolBarGroup location="right">
- <h:outputText value="signed in as: ${'#'}{identity.username}" rendered="${'#'}{identity.loggedIn}"/>
+ <h:outputText value="signed in as: ${'#'}{credentials.username}" rendered="${'#'}{identity.loggedIn}"/>
<s:link view="/login.xhtml" value="Login" rendered="${'#'}{not identity.loggedIn}" propagation="none"/>
<s:link view="/home.xhtml" action="${'#'}{identity.logout}" value="Logout" rendered="${'#'}{identity.loggedIn}" propagation="none"/>
</rich:toolBarGroup>
15 years, 8 months
Seam SVN: r10230 - in trunk/seam-gen: pojo and 1 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 01:12:25 -0400 (Mon, 30 Mar 2009)
New Revision: 10230
Modified:
trunk/seam-gen/build.xml
trunk/seam-gen/pojo/GetPropertyAnnotation.ftl
trunk/seam-gen/src/EntityList.java.ftl
Log:
JBSEAM-3298
JBSEAM-3297
Add support for a license JAR file for DB2 in setup
Allow the schema and catalog to be blanked out during setup by entering -
Modified: trunk/seam-gen/build.xml
===================================================================
--- trunk/seam-gen/build.xml 2009-03-29 21:13:59 UTC (rev 10229)
+++ trunk/seam-gen/build.xml 2009-03-30 05:12:25 UTC (rev 10230)
@@ -205,7 +205,7 @@
description="Prompt for settings" depends="init">
<property file="${seam-gen.properties}" prefix="old"/>
- <echo message="Welcome to seam-gen :-)"/>
+ <echo message="Welcome to seam-gen ${complete.version} :-)"/>
<echo message="Answer each question or hit ENTER to accept the default (in brackets)"/>
<echo message=""/>
<property name="old.workspace.home" value="C:/Projects"/>
@@ -263,17 +263,24 @@
validargs="ear,war"
defaultvalue="${old.project.type}"/>
- <property name="old.action.package" value="com.mydomain.${project.name.new}"/>
+ <property name="old.project.package" value="com.mydomain.${project.name.new}"/>
+ <input addproperty="project.package.new"
+ message="Enter the base package name for your Java classes [${old.project.package}]"
+ defaultvalue="${old.project.package}"/>
+
+ <!-- Should we just skip the fine-grained questions about the packages? -->
+
+ <property name="old.action.package" value="${project.package.new}.action"/>
<input addproperty="action.package.new"
message="Enter the Java package name for your session beans [${old.action.package}]"
defaultvalue="${old.action.package}"/>
- <property name="old.model.package" value="${action.package.new}"/>
+ <property name="old.model.package" value="${project.package.new}.model"/>
<input addproperty="model.package.new"
message="Enter the Java package name for your entity beans [${old.model.package}]"
defaultvalue="${old.model.package}"/>
- <property name="old.test.package" value="${action.package.new}.test"/>
+ <property name="old.test.package" value="${project.package.new}.test"/>
<input addproperty="test.package.new"
message="Enter the Java package name for your test cases [${old.test.package}]"
defaultvalue="${old.test.package}"/>
@@ -298,6 +305,9 @@
<condition property="hibernate.connection.driver_class.default" value="${old.hibernate.connection.driver_class}">
<equals arg1="${old.database.type}" arg2="${database.type.new}"/>
</condition>
+ <condition property="driver.jar.default" value="${old.driver.jar}">
+ <equals arg1="${old.database.type}" arg2="${database.type.new}"/>
+ </condition>
<!-- otherwise default to the defaults for the database type -->
@@ -352,7 +362,7 @@
<condition property="hibernate.connection.driver_class.default" value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<equals arg1="${database.type.new}" arg2="mssql"/>
</condition>
- <condition property="hibernate.connection.driver_class.default" value="COM.ibm.db2.jdbc.app.DB2Driver">
+ <condition property="hibernate.connection.driver_class.default" value="com.ibm.db2.jcc.DB2Driver">
<equals arg1="${database.type.new}" arg2="db2"/>
</condition>
<condition property="hibernate.connection.driver_class.default" value="com.sybase.jdbc2.jdbc.SybDriver">
@@ -395,6 +405,9 @@
<condition property="hibernate.connection.url.default" value="jdbc:h2:.">
<equals arg1="${database.type.new}" arg2="h2"/>
</condition>
+ <condition property="driver.jar.default" value="${seam.dir}/lib/hsqldb.jar">
+ <equals arg1="${database.type.new}" arg2="hsql"/>
+ </condition>
<condition property="hibernate.connection.url.default" value="jdbc:hsqldb:.">
<equals arg1="${database.type.new}" arg2="hsql"/>
</condition>
@@ -430,15 +443,29 @@
<property name="hibernate.connection.dataSource_class.default" value="org.hsqldb.jdbc.jdbcDataSource"/>
<property name="hibernate.connection.url.default" value="jdbc:hsqldb:."/>
+ <property name="driver.jar.default" value=""/>
+ <input addproperty="driver.jar.new"
+ message="Enter the filesystem path to the JDBC driver jar [${driver.jar.default}]"
+ defaultvalue="${driver.jar.default}"/>
+
+ <!-- clear extra driver jar name if database isn't DB2
+ ask for license jar if it is -->
+
+ <condition property="driver.license.jar.new" value="">
+ <not>
+ <equals arg1="${database.type.new}" arg2="db2"/>
+ </not>
+ </condition>
+
+ <property name="old.driver.license.jar" value=""/>
+ <input addproperty="driver.license.jar.new"
+ message="Enter the filesystem path to the license jar [${old.driver.license.jar}]"
+ defaultvalue="${old.driver.license.jar}"/>
+
<input addproperty="hibernate.dialect.new"
message="Enter the Hibernate dialect for your database [${hibernate.dialect.default}]"
defaultvalue="${hibernate.dialect.default}"/>
- <property name="old.driver.jar" value="${seam.dir}/lib/hsqldb.jar"/>
- <input addproperty="driver.jar.new"
- message="Enter the filesystem path to the JDBC driver jar [${old.driver.jar}]"
- defaultvalue="${old.driver.jar}"/>
-
<input addproperty="hibernate.connection.driver_class.new"
message="Enter the JDBC driver class for your database [${hibernate.connection.driver_class.default}]"
defaultvalue="${hibernate.connection.driver_class.default}"/>
@@ -466,7 +493,7 @@
<equals arg1="${database.type.new}" arg2="mysql"/>
</condition>
<input addproperty="hibernate.default_schema.entered"
- message="Enter the database schema name (it is OK to leave this blank) [${old.hibernate.default_schema}]"
+ message="Enter the database schema name (Enter - to clear value) [${old.hibernate.default_schema}]"
defaultvalue="${old.hibernate.default_schema}"/>
<uppercaseProperty name="hibernate.default_schema.uppercase" value="${hibernate.default_schema.entered}"/>
<condition property="hibernate.default_schema.new" value="${hibernate.default_schema.uppercase}" else="${hibernate.default_schema.entered}">
@@ -474,11 +501,11 @@
</condition>
<property name="old.hibernate.default_catalog" value=""/>
- <condition property="hibernate.default_catalog.new" value="">
+ <condition property="hibernate.default_catalog.entered" value="">
<equals arg1="${database.type.new}" arg2="oracle"/>
</condition>
- <input addproperty="hibernate.default_catalog.new"
- message="Enter the database catalog name (it is OK to leave this blank) [${old.hibernate.default_catalog}]"
+ <input addproperty="hibernate.default_catalog.entered"
+ message="Enter the database catalog name (Enter - to clear value) [${old.hibernate.default_catalog}]"
defaultvalue="${old.hibernate.default_catalog}"/>
<property name="old.database.exists" value="n"/>
@@ -493,6 +520,10 @@
validargs="y,n"
defaultvalue="${old.database.drop}"/>
+ <condition property="hibernate.default_schema.new" value="">
+ <equals arg1="${hibernate.default_schema.entered}" arg2="-"/>
+ </condition>
+ <property name="hibernate.default_schema.new" value="${hibernate.default_schema.test}"/>
<condition property="hibernate.default_schema.key" value="hibernate.default_schema">
<not><equals arg1="${hibernate.default_schema.new}" arg2=""/></not>
</condition>
@@ -500,6 +531,10 @@
<equals arg1="${hibernate.default_schema.new}" arg2=""/>
</condition>
+ <condition property="hibernate.default_catalog.new" value="">
+ <equals arg1="${hibernate.default_catalog.entered}" arg2="-"/>
+ </condition>
+ <property name="hibernate.default_catalog.new" value="${hibernate.default_catalog.entered}"/>
<condition property="hibernate.default_catalog.key" value="hibernate.default_catalog">
<not><equals arg1="${hibernate.default_catalog.new}" arg2=""/></not>
</condition>
@@ -524,6 +559,7 @@
<entry key="database.exists" value="${database.exists.new}"/>
<entry key="database.drop" value="${database.drop.new}"/>
<entry key="driver.jar" value="${driver.jar.new}"/>
+ <entry key="driver.license.jar" value="${driver.license.jar.new}"/>
<entry key="hibernate.dialect" value="${hibernate.dialect.new}"/>
<entry key="hibernate.connection.driver_class" value="${hibernate.connection.driver_class.new}"/>
<entry key="hibernate.connection.dataSource_class" value="${hibernate.connection.dataSource_class.new}"/>
@@ -537,7 +573,18 @@
</propertyfile>
<echo message="Installing JDBC driver jar to JBoss AS"/>
- <copy file="${driver.jar.new}" todir="${jboss.home.new}/server/${jboss.domain.new}/lib"/>
+ <condition property="has.license.jar">
+ <not><equals arg1="${driver.license.jar.new}" arg2=""/></not>
+ </condition>
+ <copy todir="${jboss.home.new}/server/${jboss.domain.new}/lib" overwrite="true">
+ <fileset file="${driver.jar.new}">
+ <include name="${driver.jar.new}"/>
+ </fileset>
+ <fileset file="${driver.license.jar.new}">
+ <include name="${driver.license.jar.new}" if="has.license.jar"/>
+ <exclude name="**/*" unless="has.license.jar"/>
+ </fileset>
+ </copy>
<echo message="Type '${seam.cmd} create-project' to create the new project"/>
</target>
@@ -1412,6 +1459,7 @@
<pathelement path="${seam.dir}/lib/jboss-common-core.jar"/>
<pathelement path="${seam.dir}/lib/concurrent.jar"/>
<pathelement path="${driver.jar}"/>
+ <pathelement path="${driver.license.jar}"/>
<pathelement path="${seam.dir}/lib/gen/jboss-seam-gen.jar"/>
</path>
<taskdef name="hibernate" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="htools.classpath"/>
Modified: trunk/seam-gen/pojo/GetPropertyAnnotation.ftl
===================================================================
--- trunk/seam-gen/pojo/GetPropertyAnnotation.ftl 2009-03-29 21:13:59 UTC (rev 10229)
+++ trunk/seam-gen/pojo/GetPropertyAnnotation.ftl 2009-03-30 05:12:25 UTC (rev 10230)
@@ -1,10 +1,13 @@
<#include "Ejb3PropertyGetAnnotation.ftl"/>
-<#if !property.optional && ( !property.equals(pojo.identifierProperty) || property.value.identifierGeneratorStrategy == "assigned" )>
+<#if !property.equals(pojo.identifierProperty) && property.type.name=='yes_no'><#-- Set column type to yes_no in seam-gen.reveng.xml to activate this annotation (or tune this condition) -->
+ @${pojo.importType("org.hibernate.annotations.Type")}(type = "yes_no")
+</#if>
+<#if !property.optional && !c2j.isPrimitive(pojo.getJavaTypeName(property, jdk5)) && (!property.equals(pojo.identifierProperty) || property.value.identifierGeneratorStrategy == "assigned")>
@${pojo.importType("org.hibernate.validator.NotNull")}
</#if>
<#if property.columnSpan==1>
<#assign column = property.getColumnIterator().next()/>
-<#if !c2h.isManyToOne(property) && !c2h.isTemporalValue(property) && column.length!=255 && property.type.name!="character">
+<#if !c2h.isManyToOne(property) && !c2h.isTemporalValue(property) && column.length!=255 && property.type.name!="character" && pojo.getJavaTypeName(property, jdk5)?lower_case!="boolean">
@${pojo.importType("org.hibernate.validator.Length")}(max=${column.length?c})
</#if>
</#if>
Modified: trunk/seam-gen/src/EntityList.java.ftl
===================================================================
--- trunk/seam-gen/src/EntityList.java.ftl 2009-03-29 21:13:59 UTC (rev 10229)
+++ trunk/seam-gen/src/EntityList.java.ftl 2009-03-30 05:12:25 UTC (rev 10230)
@@ -23,12 +23,12 @@
<#if c2j.isComponent(property)>
<#foreach componentProperty in property.value.propertyIterator>
<#if isString(componentProperty)>
- "lower(${componentName}.${property.name}.${componentProperty.name}) like concat(lower(${'#'}{${listName}.${componentName}.${property.name}.${componentProperty.name}}),'%')",
+ "lower(${componentName}.${property.name}.${componentProperty.name}) like lower(concat(${'#'}{${listName}.${componentName}.${property.name}.${componentProperty.name}},'%'))",
</#if>
</#foreach>
<#else>
<#if isString(property)>
- "lower(${componentName}.${property.name}) like concat(lower(${'#'}{${listName}.${componentName}.${property.name}}),'%')",
+ "lower(${componentName}.${property.name}) like lower(concat(${'#'}{${listName}.${componentName}.${property.name}},'%'))",
</#if>
</#if>
</#if>
15 years, 8 months
Seam SVN: r10229 - in trunk/examples: metawidget and 3 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-29 17:13:59 -0400 (Sun, 29 Mar 2009)
New Revision: 10229
Removed:
trunk/examples/metawidget/metawidget-backend.jar
trunk/examples/metawidget/metawidget-frontend.jar
trunk/examples/metawidget/metawidget.jar
Modified:
trunk/examples/build.xml
trunk/examples/metawidget/booking/build.xml
trunk/examples/metawidget/booking/readme.txt
trunk/examples/metawidget/dvdstore/build.xml
trunk/examples/metawidget/dvdstore/readme.txt
trunk/examples/metawidget/groovybooking/build.xml
trunk/examples/metawidget/groovybooking/readme.txt
Log:
fetch metawidget JAR files from JBoss Maven 2 repository
automatically call the stage target on each build (merges overrides with original source)
Modified: trunk/examples/build.xml
===================================================================
--- trunk/examples/build.xml 2009-03-29 19:33:08 UTC (rev 10228)
+++ trunk/examples/build.xml 2009-03-29 21:13:59 UTC (rev 10229)
@@ -377,7 +377,21 @@
<fileset id="trinidad-impl.jar" dir="${lib.dir}">
<include name="trinidad-impl.jar" if="trinidad.lib" />
</fileset>
+
+ <!-- Dependencies for Metawidget -->
+ <fileset id="metawidget.jar" dir="${lib.dir}">
+ <include name="metawidget.jar" if="metawidget-war.lib" />
+ </fileset>
+
+ <fileset id="metawidget-frontend.jar" dir="${lib.dir}">
+ <include name="metawidget-frontend.jar" if="metawidget-ear.lib" />
+ </fileset>
+
+ <fileset id="metawidget-backend.jar" dir="${lib.dir}">
+ <include name="metawidget-backend.jar" if="metawidget-ear.lib" />
+ </fileset>
+
<!-- Dependencies if el-ri is needed -->
<fileset id="el-ri.jar" dir="${lib.dir}">
@@ -560,7 +574,22 @@
<mkdir dir="${dist.dir}" />
</target>
- <target name="copyextradependencies" depends="gettrinidad, getelri"/>
+ <target name="copyextradependencies" depends="gettrinidad, getmetawidget, getelri"/>
+
+ <target name="getmetawidget" depends="getmetawidget-war,getmetawidget-ear"/>
+
+ <target name="getmetawidget-war" if="metawidget-war.lib">
+ <copyInlineDependencies id="metawidget" scope="runtime" todir="${lib.dir}">
+ <dependency groupId="org.metawidget" artifactId="metawidget" version="0.7"/>
+ </copyInlineDependencies>
+ </target>
+
+ <target name="getmetawidget-ear" if="metawidget-ear.lib">
+ <copyInlineDependencies id="metawidget" scope="runtime" todir="${lib.dir}">
+ <dependency groupId="org.metawidget" artifactId="metawidget-frontend" version="0.7"/>
+ <dependency groupId="org.metawidget" artifactId="metawidget-backend" version="0.7"/>
+ </copyInlineDependencies>
+ </target>
<target name="gettrinidad" if="trinidad.lib">
<copyInlineDependencies id="trinidad" scope="runtime" todir="${lib.dir}">
@@ -640,6 +669,7 @@
<fileset refid="urlrewrite.jar" />
<fileset refid="richfaces-impl.jar" />
<fileset refid="trinidad-impl.jar" />
+ <fileset refid="metawidget-frontend.jar" />
<fileset refid="jboss-common-core.jar" />
<fileset refid="war.lib.extras" />
<fileset refid="tomcat-standard-tag.jar" />
@@ -721,6 +751,7 @@
<fileset refid="seam.remoting.jar" />
<fileset refid="el-ri.jar" />
<fileset refid="trinidad-api.jar" />
+ <fileset refid="metawidget-backend.jar" />
<fileset refid="jboss-common-core.jar" />
<fileset refid="openid.jar" />
<mapper type="flatten" />
@@ -972,6 +1003,7 @@
<fileset refid="seam.wicket.jar" />
<fileset refid="seam.resteasy.jar" />
<fileset refid="trinidad-api.jar" />
+ <fileset refid="metawidget.jar" />
<fileset refid="el-ri.jar"/>
<mapper type="flatten" />
</copy>
Modified: trunk/examples/metawidget/booking/build.xml
===================================================================
--- trunk/examples/metawidget/booking/build.xml 2009-03-29 19:33:08 UTC (rev 10228)
+++ trunk/examples/metawidget/booking/build.xml 2009-03-29 21:13:59 UTC (rev 10229)
@@ -20,13 +20,17 @@
<property name="seam.debug.lib" value="yes"/>
<property name="facelets.lib" value="yes"/>
<property name="richfaces.lib" value="yes"/>
- <!--<property name="metawidget-ear.lib" value="yes"/>-->
+ <property name="metawidget-ear.lib" value="yes"/>
<!-- Datasource -->
<property name="example.ds" value="jboss-seam-metawidget-booking-ds.xml"/>
- <target name="build">
+ <target name="init" depends="stage">
+ <antcall target="SeamExample.init"/>
+ </target>
+ <target name="stage">
+
<!-- Copy the original Seam booking example -->
<copy todir="${staging.dir}">
<fileset dir="${seam.dir}/examples/booking">
@@ -50,6 +54,9 @@
<import file="${basedir}/../../build.xml"/>
+ <!-- Enable the following overrides if you want to use your own JAR metawidget JAR files -->
+ <!-- Don't forget to set <property name="metawidget-ear.lib" value="no" above -->
+ <!--
<path id="build.classpath.extras">
<fileset dir="${basedir}/..">
<include name="metawidget.jar"/>
@@ -63,5 +70,6 @@
<fileset id="war.lib.extras" dir="${basedir}/..">
<include name="metawidget-frontend.jar"/>
</fileset>
+ -->
</project>
Modified: trunk/examples/metawidget/booking/readme.txt
===================================================================
--- trunk/examples/metawidget/booking/readme.txt 2009-03-29 19:33:08 UTC (rev 10228)
+++ trunk/examples/metawidget/booking/readme.txt 2009-03-29 21:13:59 UTC (rev 10229)
@@ -6,11 +6,11 @@
Forms are layed out using Metawidget.
The source files in this example are just the overrides needed to utilize
-metawidget. Before you can deploy the example, you have to merge these
-overrides with the original groovybooking source code in a staging directory.
-That is done using the following command:
+metawidget. Before the example is built, these overrides are merged with the
+original booking source code in a staging directory. This step is performed
+by following command, which is automatically called on any Ant build:
- ant build
+ ant stage
This example runs on JBoss AS as an EAR or Tomcat with JBoss Embedded as a WAR.
Modified: trunk/examples/metawidget/dvdstore/build.xml
===================================================================
--- trunk/examples/metawidget/dvdstore/build.xml 2009-03-29 19:33:08 UTC (rev 10228)
+++ trunk/examples/metawidget/dvdstore/build.xml 2009-03-29 21:13:59 UTC (rev 10229)
@@ -22,13 +22,17 @@
<property name="jbpm.lib" value="yes"/>
<property name="search.lib" value="yes"/>
<property name="urlrewrite.lib" value="yes"/>
- <!--<property name="metawidget-ear.lib" value="yes"/>-->
+ <property name="metawidget-ear.lib" value="yes"/>
<!-- Datasource -->
<property name="example.ds" value="jboss-seam-metawidget-dvdstore-ds.xml"/>
- <target name="build">
+ <target name="init" depends="stage">
+ <antcall target="SeamExample.init"/>
+ </target>
+ <target name="stage">
+
<!-- Copy the original Seam booking example -->
<copy todir="${staging.dir}">
<fileset dir="${seam.dir}/examples/dvdstore">
@@ -52,6 +56,9 @@
<import file="${basedir}/../../build.xml"/>
+ <!-- Enable the following overrides if you want to use your own JAR metawidget JAR files -->
+ <!-- Don't forget to set <property name="metawidget-ear.lib" value="no" above -->
+ <!--
<path id="build.classpath.extras">
<fileset dir="${basedir}/..">
<include name="metawidget.jar"/>
@@ -65,5 +72,6 @@
<fileset id="war.lib.extras" dir="${basedir}/..">
<include name="metawidget-frontend.jar"/>
</fileset>
+ -->
</project>
Modified: trunk/examples/metawidget/dvdstore/readme.txt
===================================================================
--- trunk/examples/metawidget/dvdstore/readme.txt 2009-03-29 19:33:08 UTC (rev 10228)
+++ trunk/examples/metawidget/dvdstore/readme.txt 2009-03-29 21:13:59 UTC (rev 10229)
@@ -8,8 +8,8 @@
example.name=dvdstore
The source files in this example are just the overrides needed to utilize
-metawidget. Before you can deploy the example, you have to merge these
-overrides with the original groovybooking source code in a staging directory.
-That is done using the following command:
+metawidget. Before the example is built, these overrides are merged with the
+original dvdstore source code in a staging directory. This step is performed
+by following command, which is automatically called on any Ant build:
- ant build
+ ant stage
Modified: trunk/examples/metawidget/groovybooking/build.xml
===================================================================
--- trunk/examples/metawidget/groovybooking/build.xml 2009-03-29 19:33:08 UTC (rev 10228)
+++ trunk/examples/metawidget/groovybooking/build.xml 2009-03-29 21:13:59 UTC (rev 10229)
@@ -22,16 +22,20 @@
<property name="seam.debug.lib" value="yes"/>
<property name="facelets.lib" value="yes"/>
<property name="richfaces.lib" value="yes"/>
- <property name="groovy.lib" value="yes" />
- <!--<property name="metawidget-war.lib" value="yes" />-->
+ <property name="groovy.lib" value="yes"/>
+ <property name="metawidget-war.lib" value="yes"/>
<property name="profile" value="dev" />
<!-- Datasource -->
<property name="example.ds" value="metawidget-groovybooking-${profile}-ds.xml"/>
- <target name="build">
+ <target name="init" depends="stage">
+ <antcall target="SeamExample.init"/>
+ </target>
+ <target name="stage">
+
<!-- Copy the original Seam booking example -->
<copy todir="${staging.dir}">
<fileset dir="${seam.dir}/examples/groovybooking">
@@ -56,6 +60,9 @@
<import file="${basedir}/../../build.xml"/>
+ <!-- Enable the following overrides if you want to use your own JAR metawidget JAR files -->
+ <!-- Don't forget to set <property name="metawidget-war.lib" value="no" above -->
+ <!--
<path id="build.classpath.extras">
<fileset dir="${basedir}/..">
<include name="metawidget.jar"/>
@@ -65,6 +72,7 @@
<fileset id="war.lib.extras" dir="${basedir}/..">
<include name="metawidget.jar"/>
</fileset>
+ -->
<!-- remaining configuration copied from ../../groovybooking/build.xml -->
<target name="explode">
Modified: trunk/examples/metawidget/groovybooking/readme.txt
===================================================================
--- trunk/examples/metawidget/groovybooking/readme.txt 2009-03-29 19:33:08 UTC (rev 10228)
+++ trunk/examples/metawidget/groovybooking/readme.txt 2009-03-29 21:13:59 UTC (rev 10229)
@@ -11,11 +11,11 @@
in build.properties when deploying to JBoss AS 5.
The source files in this example are just the overrides needed to utilize
-metawidget. Before you can deploy the example, you have to merge these
-overrides with the original groovybooking source code in a staging directory.
-That is done using the following command:
+metawidget. Before the example is built, these overrides are merged with the
+original groovybooking source code in a staging directory. This step is performed
+by following command, which is automatically called on any Ant build:
- ant build
+ ant stage
When editing Groovy files from the src/action directory, you can run "ant
build jbosswar.explode" to see your changes take effect. When editing Groovy files
Deleted: trunk/examples/metawidget/metawidget-backend.jar
===================================================================
(Binary files differ)
Deleted: trunk/examples/metawidget/metawidget-frontend.jar
===================================================================
(Binary files differ)
Deleted: trunk/examples/metawidget/metawidget.jar
===================================================================
(Binary files differ)
15 years, 8 months