Second Annual Enterprise Flex Symposium
August 7, 2009, New York City
Occasionally connected applica7ons with Adobe AIR and BlazeDS and PDF Genera7on on the Client
Adobe Integrated Run7me (AIR)
AIR 1.5 is a step toward providing a full plaBorm for desktop applicaEon development.
AIR offers development and predictable run7me environment for AJAX and Flex developers.
To run AIR applicaEons, the user’s computer must have AIR runEme installed (about 15MB): hTp://get.adobe.com/air .
AIR is cool because 1. AIR supports I/O operaEons with user’s file system
2. AIR allows you to sign and version applicaEons
3. Updater controls proper upgrades of the apps
4. AIR comes with a local database SQLite to keep the data (in clear or encrypted mode) on the user’s PC
5. AIR applicaEons can monitor network connecEons
6. You can run AIR applicaEons when disconnected
7. AIR has beTer than Flex support of HTML
AIR is so cool because
1. AIR can’t make calls to user’s OS
2. AIR can’t launch non‐AIR applicaEons
3. AIR can’t instanEate DLLs
4. AIR can’t call an AcEveX controls
5. AIR can’t directly access ports on user’s PC
6. Adobe doesn’t offer data synchronizaEon support for apps that use BlazeDS
7. AIR doesn’t allow PDF GeneraEon on the client
not
Farata Systems has fixed items 6 and 7
PharmaSales Applica7on
Every day a dispatcher of Acme Pharma Inc. schedules visits for salesman stored in the corporate database.
PharmaSales Applica7on
Every morning a salesman starts PharmaSales AIR applicaEon, which connects to the corporate database (MySQL) and automaEcally into a local database (SQLite) that exists on salesman’s laptop.
Architecture of Pharma Sales
Client Server
Corporate DBMS
SQLite DBMS
Adobe Air ApplicaEon
Java Servlet Container
Adobe BlazeDS
Clear.swc
Uses of local SQLite cache
• Create an independent desktop applicaEon with its own local database.
• Allow the AIR applicaEon to remain operaEonal even when there is no network connecEon. Sync the data with the central database when connecEon is available.
• Offload large chunks of intermediate applicaEon data to lower memory uElizaEon.
Liz can see her visits for today
Liz doesn’t know that her visits were saved in the local database SQLite.
Liz doesn’t give a damn! She just knows it’s safe to disconnect and hit the road.
SQLite Manager’s data view
Local DB is not a copy of the central DB. Only the query results (DTOs) are stored in the local cache.
Liz came home late… She inserted the network cable in her notebook and started the PharmaSales applicaEon
Liz is a liTle drunk .She can barely see the buTon Sync. Liz clicks on it and falls asleep…
Clear Toolkit is cool because
It supports data sync between the local SQLite database with BlazeDS. The local data are sent to the Acme Pharm central DBMS.
This is done by the class OfflineDataCollec7on that comes with clear.swc, a library of Flex components from open source Clear Toolkit hTps://sourceforge.net/projects/cleartoolkit/.
PDF Genera7on
1. Use LiveCycle Designer and create PDFs
2. Use Flex for UI integrated with LiveCycle forms on the server
3. Send bitmaps from Flex to LCDS
4. Perform PDF generaEon on the client with Clear Toolkit components or ClearBI
PDF Genera7on from bitmaps 1. A client may send a Bytearray (a bitmap) object to the server private funcEon generatePDF():void { var snapshot:ImageSnapshot = ImageSnapshot.captureImage(balanceSheet); balanceSheetImage = ImageSnapshot.encodeImageAsBase64(snapshot);
snapshot = ImageSnapshot.captureImage(earnings); earningsImage = ImageSnapshot.encodeImageAsBase64(snapshot); }
2. On the server, you create a Java class that merges the bitmap with an XFA form
// define a string with a link to the XFA template String source = FlexContext.getServletContext().getRealPath(”/pdfgen/company.xfa”); XFAHelper helper = new XFAHelper(); helper.open(source);
// Import XFA dataset : dataset is the XML constructed in your Flex applicaEon. // dataset is a org.w3c.dom.Document helper.importDataset(dataset);
// Save new PDF as a byte array in the current session byte[] bytes = helper.saveToByteArray();
PDF Genera7on on the client
1. Open source library AlivePDF (hTp://alivepdf.org/)
2. Flex UI components from Clear Toolkit library (hTp://sourceforge.net/projects/cleartoolkit ), which can expose their state in an XDP format to be used for generaEon PDF.
ClearBI Toolkit will include a Web Reporter ClearBI
End User
Reference Applications
Eclipse Plugins for Developers
(ClearBI, ClearDataBuilder)
Reporting
Metadata
Local
Report
Files Report Player
Control Report Designer
Control
SuperGrid
Control
Two Faces of ClearBI
For Developers – Eclipse Plugin : • Visual ediEng of the report
metadata (AIR applicaEon) • Persistence to a local drive • Repot publishing to a database
(End‐User EdiEon only)
For Business Users ‐ Web ApplicaEons: • Visual ediEng of the report metadata • Persistence to a database • Support of reports’ and users’
hierarchies • Users need Flash Player, nothing else
Contact info and useful links Email: [email protected]
Web site: hTp://www.faratasystems.com
Flex Blog: hTp://flexblog.faratasystems.com
Clear Toolkit Framework: hTp://sourceforge.net/projects/cleartoolkit/
O’Reilly Book “Enterprise Development with Flex” (rough cuts): hTp://my.safaribooksonline.com/9780596801465
(c) Farata Systems