<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Code as you surf</title>
	<atom:link href="http://codesurf.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codesurf.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 26 May 2008 05:31:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codesurf.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code as you surf</title>
		<link>http://codesurf.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codesurf.wordpress.com/osd.xml" title="Code as you surf" />
	<atom:link rel='hub' href='http://codesurf.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Maven, Flex, and LiveCycle DS (Part 2)</title>
		<link>http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds-part-2/</link>
		<comments>http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds-part-2/#comments</comments>
		<pubDate>Thu, 22 May 2008 04:17:00 +0000</pubDate>
		<dc:creator>ldee</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[lcds]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds-part-2/</guid>
		<description><![CDATA[Core module (with Hibernate) I created a new module called core and added it to my existing Java/Flex multi-module Maven project. It just has a regular JAR packaging type. I moved the following entity classes and DAOs to the new core module: flex.samples.crm.company.Company flex.samples.crm.company.CompanyDAO flex.samples.crm.employee.Employee flex.samples.crm.employee.EmployeeDAO   I modified the entity classes to use JPA [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesurf.wordpress.com&amp;blog=3818273&amp;post=5&amp;subd=codesurf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Core module (with Hibernate)</h3>
<p>I created a new module called <tt>core</tt> and added it to my existing Java/Flex multi-module Maven project. It just has a regular JAR packaging type. I moved the following entity classes and DAOs to the new <tt>core</tt> module:</p>
<ul>
<li>flex.samples.crm.company.Company</li>
<li>flex.samples.crm.company.CompanyDAO</li>
<li>flex.samples.crm.employee.Employee</li>
<li>flex.samples.crm.employee.EmployeeDAO</li>
<p> </ul>
<p>I modified the entity classes to use JPA annotations, like so:</p>
<pre>import javax.persistence.Entity;
. . .
@Entity
public class Company {. . .}
. . .
@Entity
public class Employee {. . .}</pre>
<p>I modified the DAO classes by extracting the interface and creating an implementation that uses Hibernate (via AppFuse&#8217;s GenericDaoHibernate). The resulting interface and implementation class looks like this:</p>
<pre>import org.appfuse.dao.GenericDao;
import flex.samples.crm.model.Company;

/**
 * Data access object interface for company entity.
 */
public interface CompanyDao extends GenericDao {
    List findCompanies(String name, String industry) throws DaoException;
    Company getCompany(int companyId) throws DaoException;
    Company create(Company company) throws DaoException;
    void update(Company newVersion, Company previousVersion, List changes)
        throws DaoException, ConcurrencyException;
    void delete(Company company) throws DaoException, ConcurrencyException;
}
. . .
import org.appfuse.dao.hibernate.GenericDaoHibernate;
import flex.samples.crm.dao.CompanyDao;
import flex.samples.crm.dao.ConcurrencyException;
import flex.samples.crm.dao.DaoException;
import flex.samples.crm.model.Company;
/**
 * Company DAO implementation using Hibernate.
 */
public class CompanyDaoHibernate extends GenericDaoHibernate
    implements CompanyDao {
    . . .
} </pre>
<p>After the above changes, I now have the following classes (note the slight modification in the location/package of the classes).</p>
<ul>
<li>flex.samples.crm.model.Company</li>
<li>flex.samples.crm.model.Employee</li>
<li>flex.samples.crm.dao.CompanyDao</li>
<li>flex.samples.crm.dao.EmployeeDao</li>
<li>flex.samples.crm.dao.hibernate.CompanyDaoHibernate</li>
<li>flex.samples.crm.dao.hibernate.EmployeeDaoHibernate</li>
<p> </ul>
<p>I added the following dependencies to my POM.</p>
<pre>
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.appfuse&lt;/groupId&gt;
            &lt;artifactId&gt;appfuse-hibernate&lt;/artifactId&gt;
            &lt;version&gt;2.0.1&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;

    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
        &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
        &lt;artifactId&gt;hibernate3-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.1&lt;/version&gt;
        &lt;configuration&gt;
            &lt;components&gt;
                &lt;component&gt;
                    &lt;name&gt;hbm2ddl&lt;/name&gt;
                    &lt;implementation&gt;
                         annotationconfiguration
                    &lt;/implementation&gt;
                &lt;/component&gt;
            &lt;/components&gt;
            &lt;componentProperties&gt;
                &lt;drop&gt;true&lt;/drop&gt;
                &lt;jdk5&gt;true&lt;/jdk5&gt;
                &lt;namingstrategy&gt;
                    ${hibernate.naming.strategy}
                &lt;/namingstrategy&gt;
                &lt;propertyfile&gt;
                    target/test-classes/jdbc.properties
                &lt;/propertyfile&gt;
            &lt;/componentProperties&gt;
        &lt;/configuration&gt;
        &lt;executions&gt;
            &lt;execution&gt;
                &lt;phase&gt;process-test-resources&lt;/phase&gt;
                &lt;goals&gt;
            &lt;goal&gt;hbm2ddl&lt;/goal&gt;
                &lt;/goals&gt;
            &lt;/execution&gt;
        &lt;/executions&gt;
        &lt;dependencies&gt;
            &lt;dependency&gt;
                &lt;groupId&gt;${jdbc.groupId}&lt;/groupId&gt;
                &lt;artifactId&gt;${jdbc.artifactId}&lt;/artifactId&gt;
                &lt;version&gt;${jdbc.version}&lt;/version&gt;
            &lt;/dependency&gt;
        &lt;/dependencies&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;

    &lt;properties&gt;
        &lt;hibernate.naming.strategy&gt;
            org.hibernate.cfg.ImprovedNamingStrategy
        &lt;/hibernate.naming.strategy&gt;
        &lt;hibernate.annotations.version&gt;
            3.3.0.ga
        &lt;/hibernate.annotations.version&gt;
        &lt;hibernate.version&gt;3.2.5.ga&lt;/hibernate.version&gt;

        &lt;hibernate.dialect&gt;
            org.hibernate.dialect.MySQLInnoDBDialect
        &lt;/hibernate.dialect&gt;
        &lt;jdbc.groupId&gt;mysql&lt;/jdbc.groupId&gt;
        &lt;jdbc.artifactId&gt;mysql-connector-java&lt;/jdbc.artifactId&gt;
        &lt;jdbc.version&gt;5.0.5&lt;/jdbc.version&gt;
        &lt;jdbc.driverClassName&gt;com.mysql.jdbc.Driver&lt;/jdbc.driverClassName&gt;
        &lt;jdbc.url&gt;
            &lt;![CDATA[jdbc:mysql://localhost/crm?
            createDatabaseIfNotExist=true&amp;
            useUnicode=true&amp;characterEncoding=utf-8]]&gt;
        &lt;/jdbc.url&gt;
        &lt;jdbc.username&gt;username&lt;/jdbc.username&gt;
        &lt;jdbc.password&gt;password&lt;/jdbc.password&gt;
        &lt;jdbc.databaseName&gt;MySQL&lt;/jdbc.databaseName&gt;
    &lt;/properties&gt;
</pre>
<p>Note that I&#8217;ve added a Hibernate3 Maven plugin, and using it to create the database schema via hbm2ddl goal.</p>
<p>After successfully building the <tt>core</tt> module, I&#8217;m now ready to move back to the <tt>web</tt> module and instantiate the DAOs and assemblers as Spring configured beans.</p>
<h3>Web module (with Spring)</h3>
<p>I added some new dependencies to my <tt>web</tt> module.</p>
<pre>
        &lt;dependency&gt;
            &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;crm-sample-config&lt;/artifactId&gt;
            &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
            &lt;classifier&gt;resources&lt;/classifier&gt;
            &lt;type&gt;zip&lt;/type&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;crm-sample-core&lt;/artifactId&gt;
            &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
            &lt;exclusions&gt;
                &lt;exclusion&gt;
                    &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                    &lt;artifactId&gt;jta&lt;/artifactId&gt;
                &lt;/exclusion&gt;
            &lt;/exclusions&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;artifactId&gt;spring&lt;/artifactId&gt;
            &lt;version&gt;2.5.4&lt;/version&gt;
            &lt;exclusions&gt;
                &lt;exclusion&gt;
                    &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                    &lt;artifactId&gt;jta&lt;/artifactId&gt;
                &lt;/exclusion&gt;
            &lt;/exclusions&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
            &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
            &lt;version&gt;1.2.2&lt;/version&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;${jdbc.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${jdbc.artifactId}&lt;/artifactId&gt;
            &lt;version&gt;${jdbc.version}&lt;/version&gt;
        &lt;/dependency&gt;
</pre>
<p>Note that we&#8217;ve added the new <tt>core</tt> module as a dependency. We also added Spring and Commons DBCP. Also note that we&#8217;ve excluded the JTA dependencies to avoid conflicts with the web container. Otherwise, we&#8217;ll end up with the same &#8220;unable to access a UserTransaction&#8221; problem.</p>
<p>To use Spring as the factory, I followed the instructions <a href="http://coenraets.org/blog/flex-spring/">at Christophe Coenraets&#8217; blog</a> and used the SpringFactory written by Jeff Vroom (LiveCycle Data Services architect). Note that this changes the <tt>services-config.xml</tt> and <tt>data-management-config.xml</tt> files in the <tt>config</tt> module.</p>
<p>My Spring configuration looks something like this.</p>
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"&gt;

    &lt;!-- For JDBC settings and future properties files --&gt;
    &lt;bean id="propertyConfigurer"
        class="org.springframework...PropertyPlaceholderConfigurer"&gt;
        &lt;property name="locations"&gt;
            &lt;list&gt;
                &lt;value&gt;classpath:jdbc.properties&lt;/value&gt;
            &lt;/list&gt;
        &lt;/property&gt;
    &lt;/bean&gt;

    &lt;!-- JNDI DataSource for J2EE environments --&gt;
    &lt;!--&lt;jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/xxx"/&gt;--&gt;

    &lt;bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
        &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt;
        &lt;property name="url" value="${jdbc.url}"/&gt;
        &lt;property name="username" value="${jdbc.username}"/&gt;
        &lt;property name="password" value="${jdbc.password}"/&gt;
        &lt;property name="maxActive" value="100"/&gt;
        &lt;property name="maxIdle" value="30"/&gt;
        &lt;property name="maxWait" value="1000"/&gt;
        &lt;property name="defaultAutoCommit" value="true"/&gt;
        &lt;property name="removeAbandoned" value="true"/&gt;
        &lt;property name="removeAbandonedTimeout" value="60"/&gt;
    &lt;/bean&gt;

    &lt;!-- Hibernate SessionFactory --&gt;
    &lt;bean id="sessionFactory"
        class="org.springframework...AnnotationSessionFactoryBean"&gt;
        &lt;property name="dataSource" ref="dataSource"/&gt;
        &lt;property name="configLocation" value="classpath:hibernate.cfg.xml"/&gt;
        &lt;property name="hibernateProperties"&gt;
            &lt;value&gt;
                hibernate.dialect=${hibernate.dialect}
                hibernate.query.substitutions=true 'Y', false 'N'
                hibernate.cache.use_second_level_cache=true
                hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
            &lt;/value&gt;
        &lt;/property&gt;
        &lt;property name="namingStrategy"&gt;
            &lt;bean class="${hibernate.naming.strategy}" /&gt;
        &lt;/property&gt;
    &lt;/bean&gt;

    &lt;bean id="companyDao"
        class="flex.samples.crm.dao.hibernate.CompanyDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
    &lt;/bean&gt;

    &lt;bean id="companyAssembler"
        class="flex.samples.crm.company.CompanyAssembler"&gt;
        &lt;property name="companyDao" ref="companyDao"/&gt;
    &lt;/bean&gt;

    &lt;bean id="employeeDao"
        class="flex.samples.crm.dao.hibernate.EmployeeDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
    &lt;/bean&gt;

    &lt;bean id="employeeAssembler"
        class="flex.samples.crm.employee.EmployeeAssembler"&gt;
        &lt;property name="employeeDao" ref="employeeDao"/&gt;
    &lt;/bean&gt;

&lt;/beans&gt;
</pre>
<p>Note that I&#8217;ve modified the assembler classes (CompanyAssembler and EmployeeAssembler) slightly to use the CompanyDao and EmployeeDao interfaces.</p>
<p>And that&#8217;s it! I now have a Maven-based build of the CRM app (from LCDS samples) that uses Flex, Hibernate (annotations), Spring, and LCDS. Next, I&#8217;ll try to use Cairngorm in the <tt>ria</tt> module, and some AS3 code generation via Granite DS AS3 code generator.</p>
<p>If you would like to get a copy of the entire source, just let me know (by posting a comment).</p>
<p>This is my first try in using Maven to build a Flex app. Comments and suggestions are very welcome.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesurf.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesurf.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesurf.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesurf.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesurf.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesurf.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesurf.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesurf.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesurf.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesurf.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesurf.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesurf.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesurf.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesurf.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesurf.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesurf.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesurf.wordpress.com&amp;blog=3818273&amp;post=5&amp;subd=codesurf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/93796f59fa0e480e47f9950b8f7c1809?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ldee</media:title>
		</media:content>
	</item>
		<item>
		<title>Maven, Flex, and LiveCycle DS</title>
		<link>http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds/</link>
		<comments>http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds/#comments</comments>
		<pubDate>Thu, 22 May 2008 01:12:00 +0000</pubDate>
		<dc:creator>ldee</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[jotm]]></category>
		<category><![CDATA[lcds]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds/</guid>
		<description><![CDATA[I finally got back to continuing my experiments with Java and Flex. I wish Adobe would bundle some build files (like ant build.xml, maven pom.xml) with their LiveCycle DS (LCDS) examples. So here&#8217;s what I&#8217;ve done so far. After following the steps in Flex, Spring and BlazeDS: the full stack blog, I made some modifications [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesurf.wordpress.com&amp;blog=3818273&amp;post=4&amp;subd=codesurf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I finally got back to continuing my experiments with Java and Flex. I wish Adobe would bundle some build files (like ant build.xml, maven pom.xml) with their LiveCycle DS (LCDS) examples.</p>
<p>So here&#8217;s what I&#8217;ve done so far. After following the steps in <a href="http://sebastien-arbogast.com/2008/04/15/flex-spring-and-blazeds-the-full-stack-part-4/">Flex, Spring and BlazeDS: the full stack</a> blog, I made some modifications to make it use LCDS (instead of BlazeDS).</p>
<pre>
    &lt;properties&gt;
        &lt;flex.dataservices.groupId&gt;com.adobe.flex&lt;/flex.dataservices.groupId&gt;
        &lt;flex.dataservices.artifactId&gt;flex-messaging&lt;/flex.dataservices.artifactId&gt;
        &lt;flex.dataservices.version&gt;2.6-beta2&lt;/flex.dataservices.version&gt;
    &lt;/properties&gt;

    &lt;dependencies&gt;
        &lt;!-- LiveCycle Data Services compile dependencies --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${flex.dataservices.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${flex.dataservices.artifactId}-data&lt;/artifactId&gt;
            &lt;version&gt;${flex.dataservices.version}&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${flex.dataservices.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${flex.dataservices.artifactId}-core&lt;/artifactId&gt;
            &lt;version&gt;${flex.dataservices.version}&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${flex.dataservices.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${flex.dataservices.artifactId}-common&lt;/artifactId&gt;
            &lt;version&gt;${flex.dataservices.version}&lt;/version&gt;
        &lt;/dependency&gt;

        &lt;!-- LiveCycle Data Services runtime dependencies --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${flex.dataservices.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${flex.dataservices.artifactId}-data-req&lt;/artifactId&gt;
            &lt;version&gt;${flex.dataservices.version}&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${flex.dataservices.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${flex.dataservices.artifactId}-opt&lt;/artifactId&gt;
            &lt;version&gt;${flex.dataservices.version}&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${flex.dataservices.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${flex.dataservices.artifactId}-proxy&lt;/artifactId&gt;
            &lt;version&gt;${flex.dataservices.version}&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;${flex.dataservices.groupId}&lt;/groupId&gt;
            &lt;artifactId&gt;${flex.dataservices.artifactId}-remoting&lt;/artifactId&gt;
            &lt;version&gt;${flex.dataservices.version}&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;backport-util-concurrent&lt;/groupId&gt;
            &lt;artifactId&gt;backport-util-concurrent&lt;/artifactId&gt;
            &lt;version&gt;3.1&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;concurrent&lt;/groupId&gt;
            &lt;artifactId&gt;concurrent&lt;/artifactId&gt;
            &lt;version&gt;1.3.4&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;commons-httpclient&lt;/groupId&gt;
            &lt;artifactId&gt;commons-httpclient&lt;/artifactId&gt;
            &lt;version&gt;3.0.1&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
            &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
            &lt;version&gt;2.5&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;

        &lt;!--
        &lt;dependency&gt;
            &lt;groupId&gt;com.adobe.blazeds&lt;/groupId&gt;
            &lt;artifactId&gt;blazeds-core&lt;/artifactId&gt;
            &lt;version&gt;${blazeds.version}&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;com.adobe.blazeds&lt;/groupId&gt;
            &lt;artifactId&gt;blazeds-remoting&lt;/artifactId&gt;
            &lt;version&gt;${blazeds.version}&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;backport-util-concurrent&lt;/groupId&gt;
            &lt;artifactId&gt;backport-util-concurrent&lt;/artifactId&gt;
            &lt;version&gt;3.1&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
        --&gt;
    &lt;/dependencies&gt;
</pre>
<p>Since the LCDS JARs are not available in the remote Maven repository, I had to load them into my local repository manually (via <tt>mvn&nbsp;install:install-file</tt>). The LCDS JARs are found under the <tt>resources/libs</tt> folder of the LCDS installation.</p>
<p>Note that I&#8217;m using LCDS version 2.6 beta 2. It&#8217;s a bit different from version 2.5.x (called Flex Data Services).</p>
<p>After a successful build, I moved on to adding Hibernate and Spring. I looked at the samples that come with LCDS. I was sad to see that there was no sample that uses the Spring Framework. I remember seeing it when it was still called Flex Data Services.</p>
<p>I decided to use the CRM sample as a starting point. I copied the corresponding Java source files into my <tt>web</tt> module, and the Flex source files into my ria module. I also copied the necessary elements (i.e. <tt>&lt;destination id="crm-company"&gt;</tt> and <tt>&lt;destination id="crm-employee"&gt;</tt>) into my <tt>config</tt> module&#8217;s <tt>data-management-config.xml</tt> file.</p>
<p>I tried to run the CRM sample using Maven via jetty plugin (<tt>mvn clean package jetty:run</tt>). The Flex client keeps on saying &#8220;unable to access UserTransaction&#8221;. So, I did some research and came up with a change in my web module&#8217;s POM to have Jetty create a UserTransaction for me.</p>
<pre>
    &lt;build&gt;
        &lt;plugins&gt;
            . . .
            &lt;plugin&gt;
                &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
                &lt;artifactId&gt;maven-jetty-plugin&lt;/artifactId&gt;
                &lt;version&gt;6.1.9&lt;/version&gt;
                &lt;configuration&gt;
                    &lt;scanIntervalSeconds&gt;30&lt;/scanIntervalSeconds&gt;
                    &lt;webAppSourceDirectory&gt;
                        ${project.build.directory}/${project.build.finalName}
                    &lt;/webAppSourceDirectory&gt;
                    &lt;!-- jettyEnvXml only works with jetty:run,
                          but not jetty:run-war --&gt;
                    &lt;jettyEnvXml&gt;
                        src/test/resources/jetty-env.xml
                    &lt;/jettyEnvXml&gt;
                &lt;/configuration&gt;
                &lt;dependencies&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                        &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                        &lt;version&gt;1.1&lt;/version&gt;
                    &lt;/dependency&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;log4j&lt;/groupId&gt;
                        &lt;artifactId&gt;log4j&lt;/artifactId&gt;
                        &lt;version&gt;1.2.13&lt;/version&gt;
                    &lt;/dependency&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;jotm&lt;/groupId&gt;
                        &lt;artifactId&gt;jotm&lt;/artifactId&gt;
                        &lt;version&gt;2.0.10&lt;/version&gt;
                    &lt;/dependency&gt;
                    &lt;dependency&gt;
                        &lt;groupId&gt;javax.resource&lt;/groupId&gt;
                        &lt;artifactId&gt;connector&lt;/artifactId&gt;
                        &lt;version&gt;1.5&lt;/version&gt;
                    &lt;/dependency&gt;
                &lt;/dependencies&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
</pre>
<p>And here&#8217;s how my <tt>src/test/resources/jetty-env.xml</tt> looks like.</p>
<pre>
&lt;?xml version="1.0"  encoding="ISO-8859-1"?&gt;
&lt;!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
  "http://jetty.mortbay.org/configure.dtd"&gt;

&lt;Configure class="org.mortbay.jetty.webapp.WebAppContext"&gt;

  &lt;!-- Ensure Jetty Plus features are enabled for this webapp --&gt;
  &lt;Set name="configurationClasses"&gt;
    &lt;Array type="java.lang.String"&gt;
      &lt;Item&gt;org.mortbay.jetty.webapp.WebInfConfiguration&lt;/Item&gt;
      &lt;Item&gt;org.mortbay.jetty.plus.webapp.EnvConfiguration&lt;/Item&gt;
      &lt;Item&gt;org.mortbay.jetty.plus.webapp.Configuration&lt;/Item&gt;
      &lt;Item&gt;org.mortbay.jetty.webapp.JettyWebXmlConfiguration&lt;/Item&gt;
      &lt;Item&gt;org.mortbay.jetty.webapp.TagLibConfiguration&lt;/Item&gt;
    &lt;/Array&gt;
  &lt;/Set&gt;

  &lt;New id="jotm" class="org.objectweb.jotm.Jotm"&gt;
    &lt;Arg type="boolean"&gt;True&lt;/Arg&gt;
    &lt;Arg type="boolean"&gt;False&lt;/Arg&gt;
    &lt;Call id="ut" name="getUserTransaction"/&gt;
    &lt;Call id="tm" name="getTransactionManager"/&gt;
  &lt;/New&gt;
  &lt;Call name="setAttribute"&gt;
    &lt;Arg&gt;txmgr&lt;/Arg&gt;
    &lt;Arg&gt;&lt;Ref id="tm"/&gt;&lt;/Arg&gt;
  &lt;/Call&gt;
  &lt;New class="org.mortbay.jetty.plus.naming.Resource"&gt;
    &lt;Arg&gt;javax.transaction.TransactionManager&lt;/Arg&gt;
    &lt;Arg&gt;&lt;Ref id="ut"/&gt;&lt;/Arg&gt;
  &lt;/New&gt;
  &lt;New id="tx" class="org.mortbay.jetty.plus.naming.Transaction"&gt;
    &lt;Arg&gt;&lt;Ref id="ut"/&gt;&lt;/Arg&gt;
  &lt;/New&gt;

&lt;/Configure&gt;
</pre>
<p>Boy, the above took me about two (2) days to get it working. I&#8217;m not even sure if it&#8217;s the best of way of doing it! All I know is that LCDS Assemblers need to access a UserTransaction (JTA) via JNDI (just like the tomcat that comes bundled with the LCDS 2.6 beta 2 download). If you have an easier way to make it work with the Maven Jetty plugin, please let me know.</p>
<p>I also found out that I can set <tt>&lt;use-transactions&gt;</tt> to false in the data-management-config.xml file in the <tt>config</tt> module. But remember to re-build the <tt>ria</tt> module to pick up the new <tt>config</tt> settings. With <tt>&lt;use-transactions&gt;</tt> set to false, a UserTransaction is no longer required. It expects that the DAOs will do its own transaction handling.</p>
<p>Note that I had to package the web app first (to get all the xml and swf files into a folder under <tt>target</tt>) before using Jetty plugin. So I&#8217;m doing a <tt>mvn&nbsp;clean&nbsp;package&nbsp;jetty:run</tt> to test if the web app works. So far, it&#8217;s working fine.</p>
<p>In my next post, I&#8217;ll move the DAOs and entity classes into a separate module. I&#8217;ll use Hibernate annotations (instead of JDBC) to re-write the DAOs and entity classes. I want to use <tt>hbm2ddl</tt> in my Maven build to create the database schema.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesurf.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesurf.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesurf.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesurf.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesurf.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesurf.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesurf.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesurf.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesurf.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesurf.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesurf.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesurf.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesurf.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesurf.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesurf.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesurf.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesurf.wordpress.com&amp;blog=3818273&amp;post=4&amp;subd=codesurf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesurf.wordpress.com/2008/05/22/maven-flex-and-livecycle-ds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/93796f59fa0e480e47f9950b8f7c1809?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ldee</media:title>
		</media:content>
	</item>
		<item>
		<title>Java and Flex</title>
		<link>http://codesurf.wordpress.com/2008/04/30/java-and-flex/</link>
		<comments>http://codesurf.wordpress.com/2008/04/30/java-and-flex/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 13:21:00 +0000</pubDate>
		<dc:creator>ldee</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[lcds]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://codesurf.wordpress.com/2008/04/30/java-and-flex/</guid>
		<description><![CDATA[I&#8217;ve been developing software using Java for several years now. I&#8217;ve always wanted to try something in the RIA world. This entry is part of my journey in learning Adobe&#8217;s Flex. After reading a book on Flex Programming, I wanted to see if I could use Maven to build a Flex application with a Java [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesurf.wordpress.com&amp;blog=3818273&amp;post=3&amp;subd=codesurf&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been developing software using Java for several years now. I&#8217;ve always wanted to try something in the RIA world. This entry is part of my journey in learning Adobe&#8217;s Flex.</p>
<p>After reading a book on <a href="http://www.oreilly.com/catalog/9780596526894/">Flex Programming</a>, I wanted to see if I could use Maven to build a Flex application with a Java backend. I simply love to use Maven in building my Java programs. So, I set out to see if there are Maven archetypes for Flex. Luckily, I found <a href="http://flex-mojos.blogspot.com/">this</a> and <a href="http://sebastien-arbogast.com/index.php/2008/04/20/flex-spring-and-blazeds-the-full-stack-epilogue">this</a>.</p>
<p>I&#8217;m still playing around with it. So far, I have four modules (in a multi-module build):</p>
<ul>
<li>config (pom/zip)</li>
<li>core (jar)</li>
<li>ria (swf)</li>
<li>web (war)</li>
</ul>
<p>My goal is to create Maven-based build that uses LiveCycle DS (LCDS), Flex, Hibernate/EJB3/JPA, and Cairngorm. If someone else has done this before, please let me know.</p>
<p>For the build, I&#8217;ve used <a href="http://www.graniteds.org/confluence/display/DOC/2.5.+Gas3+Code+Generator">GraniteDS AS3 code generator</a> to generate AS3 value objects from Java entities/value-objects.</p>
<p>I&#8217;ll blog more about this as I proceed.</p>
<p>That&#8217;s all for now.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesurf.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesurf.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesurf.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesurf.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesurf.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesurf.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesurf.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesurf.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesurf.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesurf.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesurf.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesurf.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesurf.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesurf.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesurf.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesurf.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesurf.wordpress.com&amp;blog=3818273&amp;post=3&amp;subd=codesurf&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesurf.wordpress.com/2008/04/30/java-and-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/93796f59fa0e480e47f9950b8f7c1809?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ldee</media:title>
		</media:content>
	</item>
	</channel>
</rss>
