GraniteDS is a free and open-sourced (LGPL) alternative to Adobe® LiveCycle® Data Services. Among other things, it allows you to do Flash Remoting from your Flex code using the AMF binary protocol. GraniteDS is also the first remoting solution to natively support Google’s Appengine for Java.

GraniteDS uses the Gas3 code generator to create AS3 objects that represent your Java data objects on the appengine side. Appengine supports a number of special field types that can be stored in their datastore. Unfortunately, GraniteDS currently only supports the Key type.

I’ve taken it upon myself to create a JAR file you can include in your GraniteDS project that will allow you to use some of these special appengine types on the java side. I’ve also created a new generator factory that will allow Gas3 to convert those fields into types that Actionscript can understand.

You first need to put the granite-gae-converters.jar into your war/WEB-INF/lib folder inside your GraniteDS eclipse project. Make sure to add it to the Java build path in product properties as well.
graniteds1

Next modify the As3TypeFactory class in your project properties. This will allow the As3 code generation to work properly and generate equivalent data types that work from Actionscript code.
graniteds2

Finally, modify your granite-config.xml file so that it adds in the new GAE converter classes.

<converters>
    <converter type="org.granite.messaging.amf.io.convert.impl.GAEKeyConverter"/>
    <converter type="org.granite.messaging.amf.io.convert.impl.GAEBlobConverter"/>
    <converter type="org.granite.messaging.amf.io.convert.impl.GAEShortBlobConverter"/>
    <converter type="org.granite.messaging.amf.io.convert.impl.GAETextConverter"/>
    <converter type="org.granite.messaging.amf.io.convert.impl.GAELinkConverter"/>
</converters>

Source Code and JAR file Binaries

The following additional appengine types are supported with this GraniteDS enhancement:
com.google.appengine.api.datastore.ShortBlob - ByteArray in As3
com.google.appengine.api.datastore.Blob - ByteArray in As3
com.google.appengine.api.datastore.Text - String in As3
com.google.appengine.api.datastore.Link - String in As3

Post to Twitter

Posted by Andrew, filed under Data, Java. Date: July 16, 2009, 1:35 pm | No Comments »

Leave a Comment

 
Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.