Thursday, December 20, 2007

Hudson Continuous Integration

We recently switched to Hudson on a large project I am working on. Hudson is a continuous integration server with excellent maven, ant, and shell script support. It also has a wide variety of support for source control providers (i.e. svn, cvs, etc), Hudson has a nice plugin extension framework which is evident by the volume of plugins available for it. Previously, we were using continuum, which we had been using for about a year, but it eventually left a bad taste in our mouths. Hudson seems a lot cleaner, simpler, and more extensible. We now have a pretty sweet setup of SCM tools. We are using subversion for source control. Sventon as a web-based subversion browser. Maven for software builds. JIRA for issue tracking, and Hudson for continuous integration. In addition we have integrated: JIRA with subversion, so that JIRA periodically parses svn commit comments for issue numbers. JIRA will then display a link through sventon to the files associated with an issue. Hudson and sventon, so the changeset list in Hudson links to the source through sventon. Hudson with JIRA, so the changeset comments link to relevant issues in JIRA.

Wednesday, December 12, 2007

Progammatically Compile Java Code

I had planned on writing a summary of how to compile Java code programmatically using the package in Java 6, but this article pretty much sums up everything I would have said. In short this would allow you to store source or "source strings" in a database or file system and compile them without "shelling out" and utilizing a specific javac. I had been thinking about using javax.script packages to accomplish a dynamic code goal on one of my projects, but I think I'll also use this approach and let the "end user" decide which extension point they would like to utilize. The approach would allow significant performance gains due to having compiled code which would take advantage of all the JRE optimizations (i.e. JIT). I need to look into the javax.script implementations to see if a similar compilation is possible or if scripted code remains interpreted forever.

Wednesday, December 05, 2007

Java and the Google Earth COM API

Using com4J, I managed to utilize the Google Earth COM API from a Java application. Here's how: 1) Using com4J, generate java source from googleearth.exe:
java -jar tlbimp.jar -o ge_code -p "c:\program files\google\google earth\googleearth.exe"
This command will cause com4j to generate java source in the ge_code directory inside the package. 2)Now use the generated code in your own code:

public class GETest {

    public static void main(String[] args) {

        //Launch Google earth unless it's already open
        IApplicationGE ge = ClassFactory.createApplicationGE();
        //Load kml from the network
        ge.openKmlFile("http://localhost:8080/ff.kml", 1);

        //Load kml from the local filesystem
        ge.openKmlFile("c:\\dir\\ff.kml", 1);

The Google Earth COM API allows you to load kml data from a file or network location as shown above or as a string with the loadKmlData method. You can also get handles to Features and set the visibility. So far I have not found a way to programmatically refresh network links which is what I was really after, so I'm open to suggestions there. The COM API seems a bit limited in what you can accomplish, but maybe we'll see more in future releases. From the experience I've garnered that com4j is a very easy to use tool, and made interacting with Google Earth a breeze.

Saturday, December 01, 2007

SCJP for Java 6

It appears Sun has quietly released a Sun Certified Java Programmer (SCJP) Exam for Java 6. The exam objectives look strikingly similar to the Java 5 test. Someone at JavaRanch points out the only differences in the 5 and 6 exam are the Console, NavigableMap, and NavigableSet classes. My theory is Sun is simply trying to get tests relabeled to remove the Java "2" insaneness. Not to mention this is likely not a trivial revenue source for them as it is their most popular test. I'll likely not take this exam unless I get excess free time. I don't feel the benefit is there over my current SCJP 5 cert. I'll likely be holding out for the Java 7 exam.