Sunday, April 19, 2009

Interesting article about Google App Engine

Here is a very nice article by Dion Hinchcliffe. In this post, Dion summarizes the offerings and the missing pieces of GAE. If you are interested in cloud computing, specially GAE it is worth reading.

Wednesday, April 15, 2009

Chaining Properties file

In Java, one way of instantiating a Properties object is with Properties(Properties defaults) constructor. The "defaults" parameter allows property files to be stacked together and it is searched only when a particular property is not found. This feature is quite useful during development and testing when we often have conflicting settings. In such cases, editing a single properties file proves to be error-prone and inefficient. Having more than 1 properties file with only properties that need to be different and chaining them together proves to be more safe and easy. Here is an example:

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class LayeringProperties {

public static final String appPropFile = "Props";
public static final String userPropFile = "UserProperties";

public static void main(String[] args) throws IOException{

try {
//Load application's properties from a file
Properties myProps = new Properties();
myProps.load(new FileInputStream(appPropFile));

//Load the user's properties from a file
Properties userProps = new Properties(myProps);
userProps.load(new FileInputStream(userPropFile));

//List the user properties as key=value pairs
System.out.println("User properties");
userProps.list(System.out);

//List the application's properties
System.out.println("Application properties");
myProps.list(System.out);

} catch (FileNotFoundException fe) {
fe.printStackTrace();
} catch (IOException ie) {
ie.printStackTrace();
}
}
}


Here is the output. Notice how the property value for property "admin.name" is different in the 2 Properties object.
User properties
-- listing properties --
admin.contact=phone email
application.name=My Properties
application.version=1.0
admin.name=akku
Application properties
-- listing properties --
application.name=My Properties
application.version=1.0
admin.name=Kutty

Friday, April 10, 2009

Java support for Google App Engine

On the morning of april 7, 2009, Google announced Java support for App Engine. There is a catch, only a list of core Java classes are supported so there is bound to be a debate about it.

I was very excited to hear this news. Google restricted access to the first 10,000 developers who sign up. I wanted to test drive it so I signed up for an account on 7th evening. I was actually surprised to get my account approved the next day. I thought I was late in signing up but looks like I was not.

I downloaded the AppEngine Java SDK and the Google plugin for Eclipse on my Windows laptop. I am a heavy Eclipse user, so was very happy to see the plugin. I followed the directions for installation and setup. It was pretty straightforward unlike some problems I ran into with the Python App Engine installation and setup on Mac last time. I wanted to do it on my mac but it was indisposed at that time. I went ahead and created a project with a simple servlet as per the instructions, uploaded it to my account and everything worked like a charm.

Google also has a running list of frameworks, lanaguages and libraries which will run on the App Engine. Lot of JVM based languages like Jython, Groovy etc are supported. So now a wider community will embrace Google App Engine.

Friday, April 3, 2009

Tim Bray on what's next in Java Web development

I recently listened to a very interesting podcast on the future of Java Web development by Tim Bray who is the Director of Web Technologies at Sun. Tim Bray talks about cloud computing, concurrency challenges, running dynamic languages like Jython on JVM, REST and other emerging Web technologies.

I think it is a nice podcast and if you are interested in these technologies, you might find the talk interesting too.