Xebia

Blog Xebia France

J2EE, Agility and SOA

September 26th, 2008

Exadel Flamingo Flex applications, AMF, Spring

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:
Please choose the portrays of application to generate (flamingo-spring, flamingo-seam): [flamingo-spring]
  flamingo-spring

  • Characteristics of plan:

  • 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

  • Shape of database:
What kind of database are you using? (hsql, mysql, oracle, postgres, mssql, db2, sybase, none): [Hsql]
  hsql
  Graft the JDBC URL for your database (e.g. jdbc:hsqldb:.): [Jdbc:hsqldb:].
  jdbc:hsqldb:.
  To graft database username: [her]
  her
  To graft database password: []
  Do you want to update the database schema each time you deploy? (there, n): [there]
  there

  • 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}):

  • 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.

Key words :, , , ,

You can follow answers accepted by this article thanks to the thread of comments.

5 answers to Exadel Flamingo Flex applications, AMF, Spring

  • On November 3rd, 2008 in 18:56 (), Blog Xebia France - Review of the papers Xebia said :

    [] Exadel Flamingo, here is a framework new making for us easier the development of applications Flex: X2O. In [...]

  • On April 1st, 2009 in 15:35 (), kwame said :

    Interesting!!! I wanted to try my problemes and here is:
    1) I installed 2 Maven then d zip famingo then made flamingoinstall and here is what goes out:
    Unable to download the artefact from any repository com.exadel.flamingo.maven.plugin:flamingoapp:pom:1.7.1
    from the specified remote repositories: exchange
    that is necessary make me to remedy it? I am really blocked.
    2) My idee it is: once generated initial plan, to import him under myeclipse under whom I have the plugin FlexBuilder 3; and work from there.
    Are possible to you say to me concretement how I must make?
    Thank you for a quick answer.
    kwame.

  • April 3rd, 2009 in 9:24 (), said :

    1/It a problem Maven is.
    The artefact com.exadel.flamingo.maven.plugin:flamingoapp Cf really does not exist in version 1.7.1 in the central repository (. http://repo1.maven.org/maven2/com/exadel/flamingo/maven/plugin/flamingoapp/).
    On the other hand, script flamingoinstall no reason to try to recover this artefact in the central repository has. I have just made test on a "clean" post, execution of flamigoinstall does not pose problem.
    Difficult to go more without more information...

    2/to import a Maven plan in eclipse, it is enough to carry order out mvn eclipse:eclipse (she generates files Eclipse plans) in the root of plan then to import plans generated in Eclipse.

  • On April 6th, 2009 in 12:15 (), kwame said :

    Thanks a lot christophe.
    I am going to try it and I will give an account to you of result.
    Good day,
    kwame.

  • On April 6th, 2009 in 19:00 (), kwame said :

    Excuse me: Maven, me not the connait not a lot.
    But how I must use the link
    that you sent me to make work the thing.
    Please etre you more explicit please?
    or say to me supplementaires information that you want to have to help me better?
    Thank you.
    kwame.

Leave a comment


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