- Granite data services
Infobox Software
name = Granite data services
caption =
collapsible =
author =
developer =
released =
latest release version =
latest release date =
latest preview version =
latest preview date =
frequently updated =
programming language =
operating system =
platform =
size =
language =
status =
genre =
license = LGPL
website = http://www.graniteds.org/Granite Data Services (also known as GraniteDS or GDS) is an open source (LGPL) alternative to
Adobe LiveCycle Data Services with a special emphasis on integrating withJ2EE technologies, including well known Java EE persistence systems (such as Ejb3/Hibernate , with full lazy-loading support). GDS lets you use standard Flex 2+ RemoteObjects, providing full benefits from the AMF3 serialization. In addition, GDS provides interoperability with popular framework services such as:* Call server side Ejb3 session beans (with or without
JBoss Seam extensions),
* Spring beans with Acegi security,
* GoogleGuice services (with Warp persistence),
* POJO services.Data Push support is a new feature in GDS 1.0.
GDS also comes with an ActionScript3 code generator (Gas3), which greatly accelerates Flex application development. GDS, together with the Flex Builder IDE, or the free Flex SDK, provides developers with a complete and powerful framework for Flex application development and deployment.
Status
The historical part of GDS (Ejb3, Spring, Pojo and Gas3) has been widely used and is production ready. The new features recently introduced in GDS 1.0 (Seam, Guice services, and Data Push) should be considered beta software.
EJB3 Entity Beans with full lazy-loading support
GDS is designed in order to provide a full integration with an EJB3 persistence layer and brings a very important and unique feature (which even LCDS doesn't seem to provide): when using object/relational persistence tools like Hibernate, you may face the risk of loading your entire database if you don't use any lazy fetching strategy. GDS supports both proxy (single-valued association) and lazy fetching for collections.
This feature is based on another important serialization feature: [http://www.graniteds.org/confluence/display/DOC/2.4.1.+Externalizers Externalizers] . With standard Flex AMF3 serialization (BlazeDS or LCDS), only non transient, non static public properties may be serialized. You may not serialize and keep private in your ActionScript3 beans what should be kept private (such as a versioning number, etc.). The only way to achieve this with BlazeDS or LCDS is to write your Entity Beans as Externalizable (but you must implement consistent readExternal/writeExternal methods on both Java and AS3 sides, see here). This is very tedious work, and the source of many potential and hard to find errors (and it is not even possible if you don't own the entity beans source code). With GDS Externalizers, you don't have to write your Java beans as Externalizable, and you let Gas3 generate your AS3 beans (strongly typed, with private fields kept private and lazy loading support).
Data Push
Data Push in GDS (named Gravity) is implemented with AMF3 messages sent over HTTP (no RTMP, no specific internet port), and is freely based on the Bayeux protocol. This implementation is available for Tomcat 6.0.14+, JBoss 4.2.2+, and Jetty Continuations 6.1.15+. Gravity also provides JMS adapter support as described in Flex documentation here.
GDS uses a specific channel (org.granite.gravity.channels.GravityChannel) that must be used for data push destinations. In short, this channel encapsulates two flash.net.URLStream instances (command and tunnel) and supports long-polling transport.
Gas3 (ActionScript3 code generator)
The idea with Gas3 is to simplify and accelerate Flex/J2EE development:
# Design your database model by writing Ejb3 entity beans.
# Let Gas3 generate ActionsScript3 beans that replicate your entity beans properties (Flex client side model beans), and have Hibernate tools generate your database schema (tables and indexes creation).
# Write your business logic with session beans, Spring, Guice, or Pojo services.
# Write your Flex application (mxml).Additionally, you may write your own Gas3 code generation templates and fully customize generated ActionScript3 classes.
External links
* [http://www.graniteds.org/ Granite Data Services site]
* [http://sourceforge.net/projects/granite/ Sourceforge project (downloads)]
* [http://www.infoq.com/news/2008/02/granite-data-services InfoQ article]
Wikimedia Foundation. 2010.