[seam-commits] Seam SVN: r13912 - in branches/community/Seam_2_2/examples: blog and 3 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Nov 16 05:47:20 EST 2010
Author: manaRH
Date: 2010-11-16 05:47:20 -0500 (Tue, 16 Nov 2010)
New Revision: 13912
Added:
branches/community/Seam_2_2/examples/blog/build-jboss6.xml
branches/community/Seam_2_2/examples/blog/jboss6/
branches/community/Seam_2_2/examples/blog/jboss6/src/
branches/community/Seam_2_2/examples/blog/jboss6/src/actions/
branches/community/Seam_2_2/examples/blog/jboss6/src/actions/SearchService.java
Modified:
branches/community/Seam_2_2/examples/blog/build.xml
branches/community/Seam_2_2/examples/blog/readme.txt
branches/community/Seam_2_2/examples/build.xml
Log:
added jboss as6 build script for blog example
Added: branches/community/Seam_2_2/examples/blog/build-jboss6.xml
===================================================================
--- branches/community/Seam_2_2/examples/blog/build-jboss6.xml (rev 0)
+++ branches/community/Seam_2_2/examples/blog/build-jboss6.xml 2010-11-16 10:47:20 UTC (rev 13912)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<project name="Blog" default="deploy" basedir=".">
+
+ <!-- Naming -->
+ <property name="Name" value="Seam Blog Example"/>
+ <property name="example.name" value="jboss-seam-blog"/>
+ <property name="jboss6" value="yes"/>
+
+
+ <target name="init" depends="preparesrc">
+ <antcall target="SeamExample.init"/>
+ <path id="build.classpath.extras">
+ <fileset dir="${lib.search.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ </target>
+
+ <target name="preparesrc">
+ <mkdir dir="${src.java.dir}"/>
+
+ <copy todir="${src.java.dir}">
+ <fileset includes="**" dir="jboss6/src" />
+ </copy>
+ <copy todir="${src.java.dir}">
+ <fileset includes="**" excludes="src/actions/SearchService.java" dir="src"/>
+ </copy>
+
+ </target>
+
+ <import file="../build.xml"/>
+
+</project>
Property changes on: branches/community/Seam_2_2/examples/blog/build-jboss6.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/community/Seam_2_2/examples/blog/build.xml
===================================================================
--- branches/community/Seam_2_2/examples/blog/build.xml 2010-11-16 10:36:44 UTC (rev 13911)
+++ branches/community/Seam_2_2/examples/blog/build.xml 2010-11-16 10:47:20 UTC (rev 13912)
@@ -18,9 +18,13 @@
<property name="clean.extra" value="${basedir}/blogindexes" />
- <target name="jboss42" description="Build the Blog example artifacts, and deploy to JBoss 4.2.x.GA">
+ <target name="jboss42" description="Build the Blog example artifacts, and deploy to JBoss AS 4.2.x.GA">
<ant antfile="build-jboss42.xml"/>
</target>
+ <target name="jboss6" description="Build the Blog example artifacts, and deploy to JBoss AS 6">
+ <ant antfile="build-jboss6.xml"/>
+ </target>
+
<import file="../build.xml"/>
</project>
Added: branches/community/Seam_2_2/examples/blog/jboss6/src/actions/SearchService.java
===================================================================
--- branches/community/Seam_2_2/examples/blog/jboss6/src/actions/SearchService.java (rev 0)
+++ branches/community/Seam_2_2/examples/blog/jboss6/src/actions/SearchService.java 2010-11-16 10:47:20 UTC (rev 13912)
@@ -0,0 +1,74 @@
+package actions;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.queryParser.MultiFieldQueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.util.Version;
+import org.hibernate.search.jpa.FullTextEntityManager;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+
+import domain.BlogEntry;
+
+/**
+ * Pulls the search results
+ *
+ * @author Gavin King
+ */
+ at Name("searchService")
+public class SearchService
+{
+
+ @In
+ private FullTextEntityManager entityManager;
+
+ private String searchPattern;
+
+ @Factory("searchResults")
+ public List<BlogEntry> getSearchResults()
+ {
+ if (searchPattern==null || "".equals(searchPattern) ) {
+ searchPattern = null;
+ return entityManager.createQuery("select be from BlogEntry be order by date desc").getResultList();
+ }
+ else
+ {
+ Map<String,Float> boostPerField = new HashMap<String,Float>();
+ boostPerField.put( "title", 4f );
+ boostPerField.put( "body", 1f );
+ String[] productFields = {"title", "body"};
+ QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_30, productFields, new StandardAnalyzer(Version.LUCENE_30), boostPerField);
+ parser.setAllowLeadingWildcard(true);
+ org.apache.lucene.search.Query luceneQuery;
+ try
+ {
+ luceneQuery = parser.parse(searchPattern);
+ }
+ catch (ParseException e)
+ {
+ return null;
+ }
+
+ return entityManager.createFullTextQuery(luceneQuery, BlogEntry.class)
+ .setMaxResults(100)
+ .getResultList();
+ }
+ }
+
+ public String getSearchPattern()
+ {
+ return searchPattern;
+ }
+
+ public void setSearchPattern(String searchPattern)
+ {
+ this.searchPattern = searchPattern;
+ }
+
+}
Modified: branches/community/Seam_2_2/examples/blog/readme.txt
===================================================================
--- branches/community/Seam_2_2/examples/blog/readme.txt 2010-11-16 10:36:44 UTC (rev 13911)
+++ branches/community/Seam_2_2/examples/blog/readme.txt 2010-11-16 10:47:20 UTC (rev 13912)
@@ -8,4 +8,8 @@
JBoss AS 4.2 needs additional hibernate libraries, use ant target jboss42 for deploying to it.
+JBoss AS 6 needs new hibernate search and hibernate-commons-annotations, and more source code enhancement due Hibernate Search and Lucene-Core
+API changes. Therefore use ant target jboss6 for deploying to JBoss AS 6 M5 and later. For instance:
+$ant jboss6 -Djboss6=yes
+
example.name=blog
Modified: branches/community/Seam_2_2/examples/build.xml
===================================================================
--- branches/community/Seam_2_2/examples/build.xml 2010-11-16 10:36:44 UTC (rev 13911)
+++ branches/community/Seam_2_2/examples/build.xml 2010-11-16 10:47:20 UTC (rev 13912)
@@ -24,8 +24,28 @@
<!-- Settings -->
<property name="loadPersistenceUnits" value="true"/>
- <!-- Source directories -->
- <property name="src.java.dir" value="src" />
+ <!-- different setup for jboss6 enviroment -->
+ <condition property="exploded-archives.dir" value="exploded-archives-jbossas6" else="exploded-archives">
+ <isset property="jboss6"/>
+ </condition>
+ <condition property="src.java.dir" value="staging-jbossas6/src" else="src">
+ <isset property="jboss6"/>
+ </condition>
+ <condition property="dist.dir" value="dist-jbossas6" else="dist">
+ <isset property="jboss6"/>
+ </condition>
+ <condition property="staging.dir" value="staging-jbossas6">
+ <isset property="jboss6"/>
+ </condition>
+ <condition property="example.lib.dir" value="lib">
+ <isset property="jboss6"/>
+ </condition>
+ <condition property="lib.search.dir" value="${example.lib.dir}" else="${seam.dir}/lib">
+ <isset property="jboss6"/>
+ </condition>
+
+ <!-- Source directories -->
+ <property name="src.java.dir" value="src" />
<property name="src.test.dir" value="src" />
<property name="view.dir" value="view" />
<property name="resources.dir" value="resources" />
@@ -45,7 +65,7 @@
<property name="meldware.dir" value="${lib.dir}/meldware.deployable" />
<!-- Target directories -->
- <property name="dist.dir" value="dist" />
+ <property name="dist.dir" value="dist" />
<property name="exploded-archives.dir" value="exploded-archives" />
<property name="ear.dir" value="${exploded-archives.dir}/${example.name}.ear" />
<property name="jar.dir" value="${exploded-archives.dir}/${example.name}.jar" />
@@ -338,10 +358,13 @@
</fileset>
<!-- Dependencies for using Seam with Hibernate Search -->
- <fileset id="search.jar" dir="${lib.dir}">
+ <fileset id="search.jar" dir="${lib.search.dir}">
<include name="lucene-core.jar" if="search.lib" />
+ <include name="lucene-analyzers.jar" if="jboss6"/>
<include name="hibernate-search.jar" if="search.lib" />
+ <include name="hibernate-search-analyzers.jar" if="jboss6"/>
<include name="hibernate-commons-annotations.jar" if="search.lib" />
+ <!-- <include name="hibernate-core.jar" if="search.lib" /> remove or add condition for jboss42 only -->
</fileset>
<!-- Dependencies for using Seam with Drools -->
@@ -583,7 +606,9 @@
<exclude name="jboss-seam-pdf.jar" />
<!-- <exclude name="jboss-seam-flex.jar" /> -->
<exclude name="jboss-seam-excel.jar" />
- <exclude name="jboss-seam-rss.jar" />
+ <exclude name="jboss-seam-rss.jar" />
+ <exclude name="hibernate-search.jar" if="jboss6"/>
+ <exclude name="lucene-core.jar" if="jboss6"/>
</fileset>
<path refid="build.classpath.extras" />
</path>
@@ -622,9 +647,17 @@
<mkdir dir="${dist.dir}" />
</target>
- <target name="copyextradependencies" depends="gettrinidad, getmetawidget, getelri"/>
+ <target name="copyextradependencies" depends="gettrinidad, getmetawidget, getelri, gethsearch3.3"/>
<target name="getmetawidget" depends="getmetawidget-war,getmetawidget-ear"/>
+
+ <target name="gethsearch3.3" if="jboss6">
+ <copyInlineDependencies id="org.hibernate.search" scope="runtime" todir="${example.lib.dir}">
+ <dependency groupId="org.hibernate" artifactId="hibernate-search" version="3.3.0.CR1">
+ <exclusion groupId="org.hibernate" artifactId="hibernate-core"/>
+ </dependency>
+ </copyInlineDependencies>
+ </target>
<target name="getmetawidget-war" if="metawidget-war.lib">
<copyInlineDependencies id="metawidget" scope="runtime" todir="${lib.dir}">
@@ -743,6 +776,8 @@
<delete dir="${jar.dir}" />
<delete dir="${test.dir}" />
<delete dir="${clean.extra}" />
+ <delete dir="${staging.dir}" />
+ <delete dir="${example.lib.dir}" />
</target>
More information about the seam-commits
mailing list