Monday, April 13, 2009

Programming: Using the Google Java App Engine to Build my Time Warner Cable Petition Site

Google recently announced the Java version of its Google App Engine. Interesting timing because I just so happened to have a need for an app server to host a small application I was looking to build. Despite criticism that it only includes a subset of the Java standard, it turned out to do everything I needed it to do.

The project I was looking to build was an online petition against Time Warner Cables recent announcement of Tiered Pricing based on consumption. Despite their attempts to justify such an action, I wasn’t buying it and saw through the BS. I wont get into the details, its covered much more in depth elsewhere on the net, as well on the petition site.

What made the Google App Engine so attractive is that it supported GWT natively right out of the box, and it supported its own data store, so that I can let visitors sign up, and write reports on the number of sign ups and type of sign ups.

So the first thing I did was download the SDK and install it into Eclipse. The thing I noticed immediately with the Eclipse plugin is that it has the option for two SDK’s, the GWT SDK and the App Engine SDK. These plugins are real nice because they let create these kinds of projects and deploy directly to the App Engine from within Eclipse. This is nice. The GWT project creation is on par with the Instantiations GWT Designer minus one glaring detail, the UI Designer. And I have found, the two don’t exactly play nicely with each other. No big deal, however. I created a separate project to design the layout of my forms in GWT Designer, and copy and pasted into my GWT/App Engine project. While this was a bit of a pain, it allowed me to keep my GUI designer.

The rest was simple. A few static page content, and by setting my RootPanel using the RootPanel.get(elementId) call, I was able to integrate my GWT components right into my static HTML pages. What I did here was something like this. I had a DIV tag in my HTML page called “content”. Instead of using a call like:

RootPanel rootPanel = RootPanel.get();

I did something like:

RootPanel rootPanel = RootPanel.get(“content”);

And my GWT based form is integrated into my static HTML page. And by commenting out the inherits line in the project.gwt.xml file, I was able to not have GWT force its styles onto my form, using the styles available in the static HTML files instead, keeping the form consistent with the rest of the site.

One other difference between the GWT Designers handling and the GWT Plugin of projects is that in the Google plugin, all static content is stored in the project/war directory. With GWT Designer, you get a public folder under the module directory. Threw me for a loop for a second, but I digress.

Next experiment will include a BIRT ODA to report off the data store using the Google Remote_API and trying to integrate the BIRT engine directly into an App Engine based project


Eric Clayberg - Google said...

The Google App Engine stuff is brand new, so it will take a bit of time for various add-ons and 3rd party libraries to catch up. We plan to fully integrate GWT Designer with it in the near future once we get basic GWT 1.6 support in place.

cstraynor said...

I saw something about this last week and was very happy to come across it. I have been working in Java for a little while now and love to use Google's free services on the web. I can't wait to dive into this stuff.

Check out my new website for news from the tech industry. I would love to here your feedback on the site (bare in mind it's just getting started).

John Ward said...

No worries Eric, wasn't complaining about the lack of App Engine support in Designer. Still the best product on the market :)

cstraynor: App Engine isn't free, just free to start. But with the amount of bandwidth your alloted, its practically free.

Outsides of a few outages on the static pages (500 errors when the pages were available a few minutes prior), it hasn't been too bad. Keep in mind, it is still a "beta", even by Googles standards.