September 26th, 2008
The article of Touilleur Express (aka Nicolas Martignole) called Exadel Flamingo: JBOSS SEAM and Adobe FLEX groups gave me desire to test capacity of flamingo of Exadel.
Exadel Flamingo gives group of scripts, based on Maven, aiming at simplifying the starting of plans RIA. These scripts allow to generate the initial and verbose code of a plan.
Promise is therefore to give the capacity to create a CRUD application endowed with an interface rich very fast and without effort in development.
(We will not discuss interest here or not to endow an application of type CRUD of a rich interface...)
Technologies covered today are:
- FLEX and JAVAFX partly customer,
- AMF and Hessian for communication,
- JBOSS SEAM and Spring for the part server.
Question of context and of taste, I for my part turned my attention to the triplet FLEX / AMF / Spring.
Even if some aspects deserve improvements, promise is kept. Although having never practiced FLEX (or almost), it did not need me for a long time to take up my CRUD FLEX / Spring / Hibernate.
This ticket introduces the unwinding of my first trials.
Installation of Flamingo and pre-requested
Use of Flamingo requests a workstation on which are installed and configur s:
- Maven 2
- JDK 1.5 or superior
- A SDK FLEX
The installation of Flamingo they are cannot any more simple:
- Decompression of archive
flamingo-1.x.x.zip.
- Execution of script
flamingoinstall (this script instal bookshops Flamingo in the local repository Maven of the workstation).
- Addition of the directory
bin of Flamingo in the {{PATH}}
Creation of plan
The creation of a plan from Flamingo in mode line of order is simply made by execution of flamingo create project :
X:\XFR_Code\trunk\flex> Flamingo create project
[INFORMATION] Scanning for projects...
[INFORMATION]----------------------------------------------------------------------------
[INFORMATION] Building Maven Default Project
[INFORMATION] task-segment: [com.exadel.flamingo.maven.plugin:flamingoapp:1.6.0:create-project] (aggregator-style):create-project] (aggregator-style)
[INFORMATION]----------------------------------------------------------------------------
[INFORMATION] [FLAMINGOAPP:CREATE-PROJECT]
discovered andromdapp portrays-> ' Flamingo-spring'
discovered andromdapp portrays-> ' Flamingo-seam'
It is then enough to answer a dozen of questions to define plan:
- Choice of technology server:
- Choice of technology customer:
Will this project have FLEX and JAVAFX to employ interface? (FLEX, javafx): [Flex]
FLEX
- Choice of the protocol of communication:
Will this project employs Hessian and AMF PROTOCOL? (AMF, Hessian): [amf]
AMF
- Name of the first entity of plan:
To graft the entity class name (source FLEX queues to view and modify entities will be generated well ace): [Product]
Product
Plan is then generated in format Maven:
-------------------------------------------------------------------------------------
G e n e r has t i n G A n d r o M D HAVE P o w e r e d A P P l i c has t i o n
-------------------------------------------------------------------------------------
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/flamingoproject.properties'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/flex/pom.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/flex/src/main/flex/fr/xebia/demo/flamingo/view/ProductManager.mxml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/flex/src/main/flex/fr/xebia/demo/flamingo/vo/Product.as'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/flex/src/main/flex/main.mxml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/flex/src/main/resources/services-config.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/pom.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/readme.txt'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/pom.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/java/fr/xebia/demo/flamingo/Product.java'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/java/fr/xebia/demo/flamingo/ProductDAO.java'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/java/fr/xebia/demo/flamingo/ProductDAOImpl.java'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/java/fr/xebia/demo/flamingo/service/ProductService.java'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/java/fr/xebia/demo/flamingo/service/ILoginService.java'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/java/fr/xebia/demo/flamingo/service/LoginService.java'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/resources/applicationContext-test.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/resources/applicationContext.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/resources/hibernate.cfg.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/webapp/index.html'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/main/webapp/WEB-INF/web.xml'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/test/java/fr/xebia/demo/flamingo/dao/ProductDAOTest.java'
Output: 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/web/src/test/java/fr/xebia/demo/flamingo/DataSourceTestCase.java'
-------------------------------------------------------------------------------------
new application generated to-> 'file:/X:/XFR_Code/trunk/flex/flamingo-demo/'
-------------------------------------------------------------------------------------
[INFORMATION]------------------------------------------------------------------------
[INFORMATION] BUILD SUCCESSFUL
[INFORMATION]------------------------------------------------------------------------
[INFORMATION] Complete time: 42 seconds
[INFORMATION] Finished at: Fri Aug 01 11:17:54 AM CEST 2008
[INFORMATION] Final Memory: 9M / 19M
[INFORMATION]------------------------------------------------------------------------
Compilation, Unit Tests and Packaging
The plan being generated in format Maven, a simple mvn clean package -Denv.FLEX_HOME=C:toolsflex_sdk_3 a war allows to compile, to throw the unit tests and the packager:
X:\XFR_Code\trunk\flex\flamingo-demo> mvn klin package-Denv. FLEX_HOME=C:\TOOLS\FLEX_SDK_3
First execution
Wanting to carry my trials out under jetty since Maven, it was needed me:
- Add the plugin jetty to plan web ({{flamingo-demo/web/pom.xml}):
<plugin>
<groupId> org.mortbay.jetty </groupId>
<artifactId> maven-jetty-plugin </artifactId>
<dependencies>
<dependency>
<groupId> commons-logging </groupId>
<artifactId> commons-logging </artifactId>
<version 1.1.1> </version>
</dependency>
<dependency>
<groupId> org.slf4j </groupId>
<artifactId> slf4j-jcl </artifactId>
<version 1.4.3> </version>
</dependency>
<dependency>
<groupId> log4j </groupId>
<artifactId> log4j </artifactId>
<version 1.2.15> </version>
</dependency>
</dependencies>
<shape>
<stopPort> 9181> </stopPort>
<stopKey> STOP </stopKey>
<systemProperties>
<systemProperty>
<name> log4j.configuration </name>
(worth) file:. / target / class / log4j.xml </worth>
</systemProperty>
</systemProperties>
</shape>
</plugin>
- Add a file log4j in flamingo-demowebsrcmainresources
- Abolish the scope test on dependency in hsqldb ({{flamingo-demo/web/pom.xml}):
<dependency>
<groupId> hsqldb </groupId>
<artifactId> hsqldb </artifactId>
<version 1.8.0.7> </version>
</dependency>
I also changed the file flamingo-demo/flex/src/main/resources/services-config.xml so that the channel AMF clocks in in the good place (as part of a plan, they will watch to templatiser).
<channels>
<channel-definition idem = " Spring-amf " class = "mx.messaging.channels. AMFCHANNEL">
<endpoint
uri = "http://localhost:9081/flamingo-demo-web/flamingo/amf"
class = "flex.messaging.endpoints. AMFENDPOINT"/>
</channel-definition>
</channels>
After installation of plan with order mvn clean install -Denv.FLEX_HOME=C:toolsflex_sdk_3 (in the root of plan parent), order mvn jetty:run-war -Djetty.port=9081 (in plan web) throws the execution of the war packag under jetty:
X:\XFR_Code\trunk\flex\flamingo-demo\web> mvn-Dmaven.test.skip=true jetty:run-war-Djetty.port=9081
Application is then accessible to the URL http://localhost:9081/flamingo-demo-web/. It starts on a screen of login rather unexpected with the password clearly:
Once "authenticated", they achieve a screen introducing the list of entities in form of triable picture and in functions of creation modification abolition:
Modification of entity and reg n ration of screens
Let us change our entity now Product to add to it following attributes (with their accesseurs):
private G-string description;
private Float price;
private avaibility Date;
The reg n ration of beans and of screens passes by order flamingo create screen :
X:\XFR_Code\trunk\flex\flamingo-demo> Flamingo create screen
X:\XFR_Code\trunk\flex\flamingo-demo> jeu MAVEN_OPTS =-Xmx1024m
[INFORMATION] Scanning for projects...
[INFORMATION] Reactor build order:
flamingo-demo [INFORMATION]
flamingo-demo FLEX [INFORMATION]
flamingo-demo [INFORMATION] Web
[INFORMATION]----------------------------------------------------------------------------
[INFORMATION] flamingo-demo Building
[INFORMATION] task-segment: [com.exadel.flamingo.maven.plugin:flamingoapp:1.6.0:create-screen] (aggregator-style):create-screen] (aggregator-style)
[INFORMATION]----------------------------------------------------------------------------
[INFORMATION] [FLAMINGOAPP:CREATE-SCREEN]
Queue Product.as already exists. Do you want replaces it? (yes, no, all): [all]
all
[INFORMATION] all
[INFORMATION] Product simple percentage has root entity
Queue ProductScreens.mxml already exists. Do you want replaces it? (yes, no, all): [all]
all
[INFORMATION] all
Check yew tree the services-config.xml goes off contains the following destinations:
<destination idem = "Product"/>
[INFORMATION]------------------------------------------------------------------------
[INFORMATION] BUILD SUCCESSFUL
[INFORMATION]------------------------------------------------------------------------
[INFORMATION] Complete time: 22 seconds
[INFORMATION] Finished at: Kill Aug 05 9:16:42 AM CEST 2008
[INFORMATION] Final Memory: 8M / 15M
[INFORMATION]------------------------------------------------------------------------
After reinstatement of application in our local repository and upturn of jetty, we get the following screens:
The addition of new entities is also simply made. Different entities are then introduced through thumb-indexes.
To conclude
Exadel Flamingo answers therefore well the need of generation of the initial and verbose code of CRUD RIA. The creation of CRUD FLEX / Spring / Hibernate is made without conflict and without their having too much to look under the bonnet.
Some points remain however to improve (let us suppose that they will be him fast), notably the validation of grabbed data: obviously, no validation is made on the type of data. If erroneous data for attributes of numerical type are captured or they date, the submission of the form is "accepted" and its attributes are seen affecting a value null.
The result of these first trials is available on SVN of Xebia France: http://code.google.com/p/xebia-france/source/browse/#svn/trunk/flex/flamingo-demo.
Defence Colis e - 10/12, avenue of The Ark
92419 Courbevoie Cedex
T l : +33 (0) 1 46 91 76 16
Fax : +33 (0) 1 46 91 88 00
E-mail : info@xebia.fr