Monthly Archives: June 2008

Editing Resources in Maven with GMaven and Groovy Templates

In this post, I will show how to build a simple yet robust resource modification engine for Maven using GMaven and Groovy Templates.

We sometimes need to generate files in our build cycle that are specific to each server and change per deployment cycle. For some projects, this might be Flash / Flex actionscript files that need to reference the build server. For others, it might be datasource locations that change per build project. While maven provides a built-in resource filtering mechanism, it is tied to parts of the maven lifecycle that might not work well for all projects, and mostly changes resources for War files.

Groovy provides a very robust Templating engine. With the introduction of the GMaven plugin, it becomes possible to filter and re-write resource files using this robust mechanism. Combined with the power of Maven’s built-in profiles mechanism, this solution provides a robust and powerful way to edit Flex / Grails and other resources. Continue reading

Passing Data from Flash to Flex and back

Our recent adventures in Flex/Flash land have required us to have our Flash and Flex components to talk to each other. Here are some ways in which you can get Flash and Flex to pass data from one to the other.

In Flex, we can embed other Flex files or Flash files ( pretty much everything SWF ) with the swfloader component. This component has complete and unload hooks to ActionScript functions that enable us to execute functions. This post will talk about ways in which data can be passed back and forth between the two types of components.

This post cover 3 different ways in which Flex/Flash files can interact with one another. Enjoy!

Continue reading

A simple ActionScript / Flex REST client

When I started my new job a few months ago, we inherited a Cairngorm-based Flex REST client that was ugly, clunky and hard to maintain. Worst of all, due to Cairngorm’s brutal MVC model, it didn’t allow us to call the service in the context of the Flex component.

Our architect Tim re-wrote it into a single class, stripping out all the Cairngorm madness so it can be
called within a single service. More recently, I refactored the class into a singleton and removed some legacy Spring Security authentication — now handled by the Jsecurity plugin in Grails.

Combined with the Content Negotiation features of Grails, this allows us to quickly communicate with a flex application without the need to the complex binding provided by the BlazeDS platform from Adobe ( which, by the way, is available to Grails through the Flex Plugin ).
Continue reading

MacPorts portFile for Groovy 1.5.6

As long as we’re building port files for MacPorts, here is the updated Groovy 1.5.6 portFile ( the one in macport has an old version 1.0 for some reason ).

You can download the file from the ticket. Hopefully it can be approved soon.

This will install the latest release of Groovy ( as of April 2008 ) when you call sudo port install groovy
Continue reading

MacPorts portFile for Grails

I just submitted a MacPorts Portfile for grails. If it gets approved, it would mean that you can install grails 1.0.3 by typing on your Mac:

sudo port install grails

( assuming you already installed Macports ).

Note: Before you can run grails, you need to add the GRAILS_HOME variable,

i.e. edit .profile and add

export GRAILS_HOME=/opt/local/share/java/grails

Continue reading

Grails, SEO, SWFObject and Flex : Progressive Enhancement – Layering SWF on top of GSPs

I’ve been busy figuring out how Grails can help search engine rankings of Flex / Flash applications. In this post, I will show how the SWFObject library can be used with Grails layouts to enable a SEO technique called Progressive Enhancement ( thanks Ted! ).

Progressive Enhancement is a technique that allows the same content to be shown to different users, regardless of the ways in which the content is viewed. The idea is that the same content should appear on a Flash player page and one that is plain HTML and indexed by the Google searchbots. Continue reading