Roo Flex Addon Tutorial

I ran a workshop today at Tikal exploring the new Roo Flex Addon, during this workshop My colleagues Haim Raman, Shay Gabay prepared a short tutorial for using Roo Flex Addon. If you are interested in the full post including our thoughts and conclusion on Roo goto the post page on Tikal’s website. Below I’ve listed the basic steps you need to go through in order to run a simple Roo Flex Application
<p style="margin-bottom: 0in;">Getting Required Software</p> <p>Spring Roo addon is still in early development so using it is tricky, it’s not entirely compatible with different Roo versions. In order to run this tutorial you need to get the following artifacts and versions:
</p><p>spring-roo-1.1.1.RELEASE
Latest running Roo Flex Addon
</p><p style="margin-bottom: 0in;">Installing the software</p> <ul><li>Unzip spring-roo-1.1.1.RELEASE.zip to a desired folder (this will be declared later as your ROO_HOME)</li><li>Copy the addon jar to ROO_HOME\bundle directory</li></ul> Make the following changes to your environment variables <ul><li>ROO_HOME = installed roo dir</li><li>Add ROO_HOME\bin to your path variable</li></ul> <p style="margin-bottom: 0in;">Now open a command shell and create a new directory</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;">mkdir voteFlex
cd voteFle
</pre> <p style="margin-bottom: 0in;">Open roo shell by typing “roo”</p> <p style="margin-bottom: 0in;">Once the shell is open, you can copy\paste the entire following script, sit back relax and let Roo do it’s magic and work for you.</p><pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;">project --topLevelPackage com.tikalk.fuseday.roo --projectName voteFlex
persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
flex setup
entity --class ~.domain.Choice --testAutomatically
field string namingChoice --notNull --sizeMin 1 --sizeMax 30
field string description --sizeMax 80
entity --class Vote --testAutomatically
field reference choice --type Choice
field string ip --notNull
field date registered --type java.util.Date --notNull --past
flex remoting all --package ~.service
</pre><p style="margin-bottom: 0in;">Exit from roo using the exit command and run your new application by calling</p><pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;">mvn tomcat:run
</pre>Chances are that you will get some missing dependencies, in order to solve this go edit the /voteFlex/pom.xml and add the following repository to it
<p></p><pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;">
spring-snapshot
Spring Portfolio Snapshot Repository
http://maven.springframework.org/snapshot

false


true


</pre>Thanks to Ken Rimple for solving the above issue.
<p style="margin-bottom: 0in;">Now, let go through the script rows and try to understand what Roo is doing</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;">project --topLevelPackage com.tikalk.fuseday.roo --projectName voteFlex
</pre><p style="margin-bottom: 0in;">Creates a new Spring Roo project for a given name and top level package name, this line will add the basic files that are required for the project.</p> <p style="margin-bottom: 0in;"> </p><pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;">persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
</pre><p style="margin-bottom: 0in;">Sets up your persistence layer, use Hibernate as ORM, use Hypersonic as a DB.</p><pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;">flex setup
</pre><p style="margin-bottom: 0in;">Setup the project to use Flex as GUI, this line will add Flex dependencies to the project’s pom and add a number of Flex features to the build.</p> <p style="margin-bottom: 0in;"> </p><pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%">entity --class ~.domain.Choice --testAutomatically
field string namingChoice --notNull --sizeMin 1 --sizeMax 30
field string description --sizeMax 80
entity --class Vote --testAutomatically
field reference choice --type Choice
field string ip --notNull
field date registered --type java.util.Date --notNull –past
</pre><p style="margin-bottom: 0in;"> </p> <p style="margin-bottom: 0in;">The above lines create entities and add fields to these entities. These lines will create Hibernate entities, relevant AspectJ scripts and so on.</p> <p style="margin-bottom: 0in;"> </p><pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%">flex remoting all --package ~.service
</pre><p style="margin-bottom: 0in;"> </p> <p style="margin-bottom: 0in;">The above does the real work, it scafolds the entities and creates Flex GUI that will represent them, it also creates services in the specified “.service” package. It also adds BlazeDS and configures it.</p> <p style="margin-bottom: 0in;">once your tomcat is up and running to go to http://localhost:8080/voteFlex/voteFlex_scaffold.html And see your running application, you can edit and modify both vote and choice entities from your auto created Flex screen.</p>

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com