368
Nombre total de vues
368
Voir sur TechyLib
0
Vues depuis Embeds
0
Favoris
0
Téléchargements
Après avoir fait votre sélection, copiez/collez le code ci-dessous.
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex for Java Architects
•
Blaze DS, Maven, Spring & Hibernate
François Le Droff
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What does François Le Droff do?
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Who is François Le Droff?
Just another Java guy
Adobe Consulting (Paris, France)
ledroff@adobe.com
9 years of experience in IT (mainly in web 1+n.0 JEE app)
OSS geek :
committer (qsos
, xradar
, fna
),
Member of ossgtp
, ParisJUG
, ParisJBUG
speaker at ossgtp
, Solution Linux
blogger :
http://www.droff.com
http://blogs.adobe.com/francoisledroff/
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What about you ?
Good Java/JEE knowledge
Ant and/or Maven
ORM (JPA, EJB, iBatis, Hibernate)
Spring
Test (Selenium, JUnit, Cactus)
Notion of Flex
ActionScript MXML
Flex Remoting, AMF
And may be
BlazeDS, LCDS
FlexUnit
Cairngorm
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
In the next 90 minutes…
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
In the next 90 minutes…
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
In the next 90 minutes… we’ll review
Flex framework and tools from a Java perspective
BlazeDS and LCDS ES
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
In the next 90 minutes… you’ll learn how we integrated
Spring (Hibernate JPA) with Flex through BlazeDS
BlazeDS remoting SpringFactory
Auto-wired spring service bean into BlazeDS remoting
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
In the next 90 minutes… you’ll learn how we build
Spring BlazeDS Flex application
With Maven
Code generation through flex-annotation
FlexUnit
ASDoc, Dependency management, Quality control
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and Tools
From a Java perspective
Developing
Frameworks
Testing
Building
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and Tools: Developing
Flex IDEs
Eclipse
FlexBuilder
Code completion, refactoring, graphical UI editing, profiling
Enterprise Factory IDE
Peter Martin’s Cairngorm plug-in (soon)
IDEA IntelliJ
Netbeans Plugin
vi, emacs
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and libraries
MVC frameworks:
PureMVC
Cairngorm micro-architecture
There are two libraries you can use to create your Cairngorm projects
Cairngorm –This is the main Cairngorm library that must always be imported
Cairngorm Enterprise -This is an optional library that must be used if you are
using LCDS
Cairngorm Enterprise was created to remove Cairngorm’s Dependency on LCDS
EnterpriseServiceLocatorprovides support for LCDS Producer and Consumer
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and libraries
Inversion of Control (IoC) Container :
flicc: http://flicc.sourceforge.net
parsley: http://www.spicefactory.org/parsley
smarty pants: http://code.google.com/p/smartypants-ioc
LowRA: http://osflash.org/projects/lowra
prana: http://www.pranaframework.org
swiz: http://code.google.com/p/swizframework
vegas: http://code.google.com/p/vegas
fling: http://fling.riaforge.org
flex-ioc: http://code.google.com/p/flex-ioc
mate: http://mate.asfusion.com
…
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and libraries
Lots of AS3 and Flex OS components
Lots of commercial Flex components
Flex Ecosystem is expanding very quickly
following a similar path to Enterprise Java
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Logging and Debugging
Similar to LOG4J,
Flex 3 includes a logging
framework
to define custom Log targets.
ThunderBoltAS3 :
custom Flex log target
log to Firebug in Firefox or to a
stand alone AIR console.
Many tools to inspect the component at runtime
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex code generation and quality tools
Code Generation
XDoclet : ActionScript Plugin
@actionscript.class
flex-annotations.aixcept.net annotations:
@ActionScript
@Cairngorm
Flex-mojos
JAXB
MDA (acceleo plugin made by AC)
…
Code Quality control
FlexPMD (work in progress engaged by AC)
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and Tools: UnitTesting
FlexUnit : http://opensource.adobe.com/wiki/display/flexunit/FlexUnit
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and Tools: Unit Testing
FlexUnit
Very similar to JUnit
Event test enabled
Unit Test Code coverage report: FlexCover
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and Tools: Testing
Functional Testing
Selenium for Flash
Fluint, FlexMonkey, FunFX, …
Other commercial products based on Adobe’s Flex Automation API :
Mercury QTP
IBM Rational Functional Tester
RIATest
Load and Stress Testing
JMeter, OpenSTA, Grinder
Adobe’s Data Services Stress Testing Framework
Other commercial (Flex/AMF specific) products :
NeoLoad
WebLoad
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Mock Frameworks
mock-as3: http://code.google.com/p/mock-as3
Mock4AS: http://code.google.com/p/mock4as
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and Tools: Building
Ant :
FlexAntTasks
Ant : Antennae
•
Maven :
•
Flex-mojos
•
Alternatives :
•
ServeBox
•
and Israfil
•
Archetypes
•
Continuous Integration :
•
Build server : all those who support Ant and/or Maven :
•
Hudson, CruiseControl, Continuum …
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Flex Frameworks and Tools: Building
FlexUnit
within your build
Maven
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
LiveCycle Data
Services and BlazeDS
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Blaze DS Overview : Client
Blaze DS Client
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Blaze DS Overview : Server
Blaze DS Server
The Blaze DS server runs in a web application on a J2EE application server.
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
BlazeDS versus LCDS
BlazeDS
Data Management
RPC Services
Messaging
Service
Adapters
Data Synchronization
Off-line Applications
Data Paging
Web Service
HTTP Service
Remote Object Service
Publish & Subscribe
Collaboration
Real Time Data Push
Proxy Service
Web-tier Compiler Portal Deployment
RIA-PDF Generation
LiveCycle
ColdFusion
Hibernate
SQL
JMS
Java
Custom…
LiveCycle Data Services ES
Data Management
RPC Services
Messaging
Data Synchronization
Off-line Applications
Data Paging
Web Service
HTTP Service
Remote Object Service
Publish & Subscribe
Collaboration
Real Time Data Push
Proxy Service
Web-tier Compiler Portal Deployment
RIA-PDF Generation
LiveCycle
ColdFusion
Hibernate
SQL
JMS
Java
Custom…
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
LiveCycle Data Services ES Overview
Highly scalable LiveCycle Data Services ES endpoints.
Assembler architecture: Data Management Services.
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Feature Comparison
Feature
BlazeDS
LiveCycle Data Services ES –
“Corfu”
Java Remoting
√√
Web Proxy
√√
JMS Adapter
√√
AJAX Client Libraries
√√
Administrative Console
√√
Clustered Messaging
√√
Pub/Sub Messaging
√√
Web container-based messaging service (100’s of
clients/CPU)
√√
Dedicated messaging service (1000’s of clients/CPU)
√
Per-client Quality of Service
√
Data Management Service
√
Data Paging
√
Flex-LiveCycle Integration
√
RIA-to-PDF Generation
√
Offline Data Synchronization (AIR)
√
WSRP/Portal Integration
√
SiteMinder Integration
√
28
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Review of Flex, BlazeDS,
Spring Integration
Techniques
…
built with
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
By the way …
What is Maven ?
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What is Maven anyway ? (very short definition)
A build tool
A dependency management tool
•
•
A documentation and quality
reporting tool
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What is Maven anyway ? (its architecture)
Plugin
jar
Plugin
flex-mojos
Plugin
war
Projects
to build
Maven Core
Local machineRemote repository or local install
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What is Maven anyway ? (its plug-ins, a few of them…)
•Antlr
•Ant
•AntRun
•AspectJ
•Assembly
•Assembly-report
•Cargo
•Castor
•Changelog
•Changes
•Commons-attributes
•Checkstyle
•Clean
•Clover
•Csharp
•Cobertura
•Compiler
•Deploy
•Ear
•Eclipse
•Ejb
•Ejb3
•Exec
•Flex-mojos
•Flex-annotations
•Groovy
•Help
•Hibernate2
•Idea
•Install
•Issue
•It
•Jalopy
•Jar
•Javacc
•Javadoc
•Javancss
•Jboss
•Jcoverage Jdepend
•Jdiff
•Jelly
•Jetty
•Jpox
•Jspc
•Jxr
•MAnt
•Native
•One
•Par
•Plugin
•Pmd
•Project-info-reports
•Rar
•Release
•Repository
•Resources
•Repository
•Sablecc
•Site
•Slimdog
•Source
•Surefire
•Surefire-re
port
•Taglist
•Tomcat
•Verifier
•Xslt
•War
•Wsdl2java
•Xdoclet
•Xmlbeans
•XRadar
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What is Maven anyway ? (a common project format and organization)
Maven is really a process of applying patternsto a build infrastructure
in order to provide a coherent view of software projects.
A Common project metadata format
POM = Project Object Model = pom.xml
Contains metadata about the project
Location of directories, Developers/Contributors, Issue tracking system, Dependencies,
Repositories to use, etc
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What is Maven anyway ? (a common project format and organization)
A common directory organization
Our sample of 6 nested projects :
•src/
–main/
•java/
•flex/
•resources/
•webapp/
–test/
•java/
•flex/
•resources/
–site/
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What is Maven anyway ? (a common way to build application)
plug-ins
user
e.g. mvn install
generate-
sources
compile
test
install
deploy
package
integration-
test
Well-known phases
mojo
mojo
mojo
mojo
mojo
bindings
The lifecycle depends on the project type (packaging)
Defined in pom.xml (pom, jar, ear, war, etc)
Ex: <packaging>swc</packaging>
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
What is Maven anyway ? (it’s even much more)
Artifact repository :
Used to store all kind of artifacts
SWCs, SWFs, JARs, EARs, WARs, EJBs, ZIPs, plugins, …
All project interactions go through the repository
No more relative paths!
Easy to share between teams
Dependency management
Transitive dependency management
Snapshot handling
Multi-module built
Environment dependent builds based on profile
Project documentation site and report
Project templating through archetype
A
B
C
D
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Maven : Archetypes
Archetype is a Maven project templating toolkit.
an original pattern or model from which all other things of the same kind are made.
provides a great way to enable developers quickly in a way consistent with best practices
employed by your project or organization
http://maven.apache.org/plugins/maven-archetype-plugin/index.html
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
How do I integrate Flex,
BlazeDS, and Spring ?
(with Maven)
How do I write less code
through maven archetype
flex annotation code generation
and auto-wiring techniques?
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Objectives
Generate a project
through a maven
archetype
Build, deploy and test
(on jetty and hsqldb)
Exercise 4 –Project Generation and Build
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Generate and Build your project (2mn)
•
The archetype is already installed on your machine, just type :
•
mvn archetype:generate -DartifactId=maxLab -DarchetypeCatalog=local
•
Choose the autowired BlazeDS Spring archetype
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
A Maven multi-module project approach
Discover your «mavenized» Flex BlazeDS Spring project, its modules :
java_* are plain old maven java projects
flex_* are flex-mojos project
blazeds _service_config is a shared resource handled through maven assembly
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Deploy and test your project (2mn)
•
Go to the newly created project root
•
Launch the build :
•
mvn install
•
Go the java web application module root to deploy your web application on
a jetty instance :
•
mvn jetty:run
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Deploy and test your project (2mn)
•
http://localhost:8080/fna_java_webapp/
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Import your
Flex N Spring
subprojects into Eclipse
Exercise 5 (Optional)
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Import your projects into Eclipse
•
Note that once your project
imported , you may still
•
Use your favorite servers and
eclipse plugins wtp facilities
•
Debug your application
•
On the server side
•
On the client side
•
Manage your dependencies and
maven build through m2eclipse
plugin.
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Review the
Flex-N-Spring project
Architecture
Exercise 6 :
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Domain
Layer
Cairngorm applied to Flex N Spring
Integration Tier
View Layer
Presentation
Layer
Arthur
arthur@dent.com
Ford-ford@perfect.com
Zaphod –zaphod@email.com
Arthur –arthur@dent.com
Tricia–tricia@mcmillan.com
Marvin = marvin@email.com
Add a ContactContact list
Add a Contact
CMD
CMD
Business
Delegate
TodoList
Spring Auto Wiring
model.getTodoList
Cairngorm
Event
Service
Service
Service
Service
Service
ToDoList
FrontController
ToDoList
CMD
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
new RemoteObject("todoService");
A Flex application auto-wired to a BlazeDS/Spring back-end
Flex Application
Cairngorm
Delegate
•RemoteObject(“TodoService”’)
BlazeDSwar
Message
Broker
Spring
Auto
Wiring
Service
Spring container
Spring
Factory
TodoService
DAO JPA
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
A few magic details : Spring AutoWiring
With a simple SpringFactory (and/or JavaAdapter) approach, you need to
configure each new Java remote object service in remoting-config.xml.
@RemotingDestination (JDK5 annotation) allows you to autowire Spring
beans directly into BlazeDS.
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
A few magic details : Spring AutoWiring
The SpringAutowiringBootstrapService checks all @RemotingDestination
annotated classes
registers them within BlazeDS at runtime.
dynamically creates the Spring Factory.
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Review the
Flex-N-Spring project
code generation
technique
Exercise 7 (optional) :
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
VO Code Generation
The flex remoted objects aregenerated through flex-annotations
Just add to your java remoted object @ActionScript and @ActionScriptProperty annotations
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
VO Code Generation
Add the flex-annotations factory to your maven build
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Objectives
Projects reports
Dependencies report
Unit test reports
Code metrics
Exercise 8 (Optional) –Build Maven Site
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
The Maven site
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
The Maven site
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
The Maven site
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
The Maven site
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
The Maven site
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Maven and Spring for Flex :
Summary
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Maven and Spring for Flex : Summary
This maven and spring integration approach allows you to
capitalize on your in-house Java/JEE/Maven/Spring expertise, techniques and tools
write less code (Most of the integration plumbing is generated)
rely on a efficient build (continuous integration, test, dependencies and quality checks,
documentation, release)
The price to enter :
Time consumingtasks to initiate the project :
set up the project (modules) structure organization
Write your build file, your somehowcomplex pom.xml files :
configure/identify the classpath , project dependencies, maven plugins
configure the code generation and autowiring tools
The Solution: eliminate the ramp-up time by using maven archetype
You still have to configure Eclipse (and FB) the «maven» way
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Resources
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Resources: Learning
Flex
ActionScript Developer Site-http://www.adobe.com/devnet/actionscript/
Flex Developer Site -http://www.adobe.com/devnet/flex/
Flex Development Guide -http://learn.adobe.com/wiki/display/Flex/Getting+Started
Flex 3 Language Reference –http://livedocs.adobe.com/flex/3/langref/
LiveCycle Data Services ES -http://www.adobe.com/products/livecycle/dataservices/
BlazeDS
Blaze DS -http://www.adobe.com/go/opensource_blazeds
Blaze DS Developer Guide -http://livedocs.adobe.com/blazeds/1/blazeds_devguide
Blaze DS Javadoc -http://livedocs.adobe.com/blazeds/1/javadoc/
Adobe Labs -http://labs.adobe.com/
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Resources: Learning
LiveCycle Data Services ES
LiveCycle Data Services ES -
http://www.adobe.com/products/livecycle/dataservices/
LCDS ES Developer Guide -http://www.adobe.com/go/lcds26_devguide
LCDS ES Javadoc -
http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/javadoc/index.
html
LiveCycle Data Services ES Language Reference -
http://livedocs.adobe.com/livecycle/8.2/programLC/common/langref/index.html
LCDS ES Stress Testing Framework -
http://labs.adobe.com/wiki/index.php/Flex_Stress_Testing_Framework
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Resources: Frameworks and Tools
Frameworks
Cairngorm -http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm
PureMVC –http://puremvc.org
Prana -http://www.pranaframework.org
Code Generation:
Flex-annotations http://flex-annotations.aixcept.net/
XDoclet ActionScript plugin http://xdoclet.codehaus.org/Actionscript+plugin
Acceleo http://www.acceleo.org/pages/accueil/en
Spring flex integration projects
@RemotingDestination annotation :
http://marceloverdijk.blogspot.com/2008/01/code-by-convention-with-flex-and-
spring.html
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Resources: Frameworks and Tools
Building Maven
Maven archetype: http://maven.apache.org/plugins/maven-archetype-plugin/index.html
Maven presentations : http://blogs.codehaus.org/people/vmassol/
Maven Flex plugins:
Flex-mojos http://docs.flex-mojos.info/
ServeBox http://www.servebox.com/foundry/doku.php?id=m2f2plugin
Israfil http://www.israfil.net/projects/mojo/maven-flex2-plugin
Maven Flex (flex-mojos) archetypes:
http://code.google.com/p/fna/
http://blogs.adobe.com/francoisledroff/
http://code.google.com/p/maven-blazeds-spring-archetype/
Flex-Mojo tutorial
The Flex, Spring and BlazeDS full stack
http://www.adobe.com/devnet/flex/articles/fullstack_pt3_print.html
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Resources: Frameworks and Tools
Building Ant
Antennae -http://code.google.com/p/antennae/
Testing
FlexUnit -http://opensource.adobe.com/wiki/display/flexunit/FlexUnit
Flexcover -http://code.google.com/p/flexcover/
ThunderBolt AS3 Console -http://code.google.com/p/flash-
thunderbolt/wiki/ThunderBoltAS3Console
Libraries
Google Code –Lots of Flex libraries and frameworks
Flex.org -http://flex.org/software/components
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
References : Graphics and Photos
Media
http://commons.wikimedia.org/wiki/Image:Netbeans-Duke.png
https://duke.dev.java.net/images/misc/SantaDuke.png
https://duke.dev.java.net/images/comfyChair/index.html
http://onflash.org/ted/2007/07/flex-directory-150-consulting-firms.php
http://flickr.com/photos/nicozz/1107511223/
http://flickr.com/photos/flattop341/1085739925/
®
Copyright 2008 Adobe Systems Incorporated. All rights reserved.
Commentaires 0
Connectez-vous pour poster un commentaire