Summary of August's Manchester Spring User Group Meeting

The August Spring meeting was held on Tuesday 11th August at the same venue as June's meeting. The location was the the excellent University of Manchester Core Technology Facility which has free parking immediately outside the building, just press the buzzer and mention the Spring User Group and they let you in. The evening was introduced by Guy Remond of Cake Solutions who laid out the agenda.

The first talk was by Cornel Foltea of Cake Solutions entitled:

Hello World! (OSGi debugging in IDEA)

Cornel started out by giving a little overview of OSGi including a walk-through of the layered approach that the Open Service Gateway Initiative takes. He pointed out that it's key objectives were:

  • modularization
  • versioning
  • services
  • access control
The key component of any OSGi system is a 'bundle' which get deployed into an OSGi container. A bundle can then be dynamically installed, started, stopped, updated and uninstalled. They are modular in nature 'assuming nothing' - they are a JAR file, with it's contents protected from access unless it explicitly exports it's services and declares that it needs to import services offered by other bundles. Multiple versions of the same bundle can exist in the application server without conflicting with each other. OSGi also provides a Service Registry so that bundles can register (export) their services for use by other bundles.

Then Cornel went on to talk about what OSGi features IntelliJ's IDEA currently offers (a MANIFEST.MF editor and OSGi facet detection) and how to create a "Hello World!" application OSGi-style. The heart of this is the BundleActivator interface that you need implement to provide start and stop methods called by the OSGi application server (make sure you have downloaded the OSGi framework jar and add it to your classpath first):
package com.cake.dmsd.primer;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class HelloWorldActivator implements BundleActivator {

public void start(BundleContext context) throws Exception {
System.out.println("Hello, World.");

public void stop(BundleContext context) throws Exception {
System.out.println("Goodbye World.");
Then you need to create the jar's MANIFEST.MF file to look like the following:
Manifest-Version: 1.0
Bundle-Name: Helloworld Bundle
Bundle-Activator: com.cake.dmsd.primer.HelloWorldActivator
Import-Package: org.osgi.framework;version="1.4.0"
Bundle-ManifestVersion: 2
Bundle-SymbolicName: helloworld
Bundle-Version: 1.0.0
Next he talked a little about setting up a remote server 'Debug Configuration' to allow IDEA to connect to the debug port of the dmServer (think this picture paints a thousand words!) - note the port number of 5005 and the fact that one of the parameters is -Xdebug:

Then he showed screenshots of shelled out to a console to start up the dmServer in debug mode by running:
./ -debug 5005
Once that was running the next step was to telnet to the dmServer running on the local machine and install the previously created bundle:
telnet localhost 2401
This step gives us a bundle ID (111 in Cornel's example) which refers to the specific instance of the bundle that we have just installed. This ID means that we can start and stop the bundle in the future using start 111 and stop 111 from the dmServer telnet console.

After Cornel's talk there was a little break which contained a mention of the Manchester Spring User Group sponsors: UMIC, Hays IT, Skills Matter, SpringSource & Cake Solutions and the new sponsor of the event: Keith Dauris of FDM Group (and it's associated FDM Academy).

The next talk was by Dave Syer and his talk was:

Spring 3.0 and Spring Batch Quick Tour

The first half of Dave's presentation was on the new features of Spring 3.0 and it was an excellent way to quickly get an idea of the type of stuff that's coming very soon. Spring 3.0 is the first version of Spring to only work on Java 5 and above, meaning that even more annotation support can be included. It's also introducing the Spring Expression Language (influenced by Unified EL++), full REST support and declarative scheduling & background task execution.

The Object <-> XML Mapping (OXM) has been revised to offer better support for REST stateless mappers and SQL XML access. The JDK PropertyEditors are being superceded by a revised binding & type conversion infrastructure. If you don't like writing your Spring bean configuration in XML then you are in luck with Spring 3.0 - you can now write it in Java (although I thought the idea of the config _not_ in Java was that you could change it without recompile? Maybe it would have been better to offer non-XML config via something like Groovy?)

Full REST support is now available (with a custom filter to help support PUT & DELETE) which includes annotations to be able to extract values from within the URL:
@RequestMapping(value="/rewards/{id}", method="GET")
public Reward reward(@PathVariable("id") long id) {
By using multiple @PathVariable annotations you will be able to offer some pretty 'deep' URLs, meaning that you won't be held back by the normal servlet mappings. Dave mentioned that someone was using some shell scripts consisting of wget/curl and pipes to create some pretty complex business logic. Non-HTML representations are also offered 'out of the box' so it's very easy to offer JSON, XML, ATOM, etc. without using complex URLs or query strings.

Scheduling has been given a complete overhaul in Spring 3.0, with enhanced java.util.concurrent support and a new TaskScheduler with triggers (a little like a simplified Quartz). There is a new @Async annotation (indicating that this method should be run in the background) along with an @Scheduled annotation for CRON-triggered methods.

Commons Attributes has now been removed along with traditional TopLink and Struts 1.x (subclass-style). Traditional MVC controllers are now marked as deprecated along with JUnit 3.8 support (as why would you not want to use JUnit the annotated way?) and several other outdated helper classes.

Expect a GA release of Spring 3.0 sometime after August, and a 3.1 release in Q4 2009.

Dave's second presentation was on Spring Batch, which he has been the project leader on for the past three years (version 2.0 was released back in April). He started with an overview of the architecture, saying that the Batch Infrastructure layer contains reusable low level stuff: flat files, XML, database configuration. The Batch Core layer contains the quality of service (QoS), audibility and management information and the Application is your business logic.

He said that in it's most basic form it was a "glorified state management system" and then proceeded to describe some of the key objects that make up the heart of Spring Batch (item oriented processing, the Step, Job & JobLauncher classes). The Quality of Service features are interesting as they allow you to detect job and item failures and then deal with them in one of three ways: try it again (transient), ignore it and maybe retry it later (Skippable), or mark it as needing manual intervention (Fatal).

Dave then gave a brief overview of a number of different strategies in which you can introduce multi-threaded behaviour to get your jobs done faster, these included:
  • Sequential Execution
  • Multi-threaded Step
  • Parallel Execution
  • Remote Chunking
  • Partitioning
Note: Please refer to Dave's slides for details regarding any of the above points...

Dave then gave us a little teaser with a run through of a rather useful-looking Spring Batch Administration interface, allowing you to view and manage your 'jobs' and the 'executions' of those jobs providing full details all the way down to stacktraces if the execution failed. This really did look like an extremely useful tool and one that will make Spring Batch much easier to 'sell' to management. Here are a few screenshots (kindly provided by Dave himself):

That was the official end to the evening, but SpringSource were buying the first round in the Bowling Green pub afterwards, so the majority of attendees carried on the discussions there (thanks for the beer SpringSource!).

Note: Both Cornel's and Dave's presentations can be found over on the Cake Solutions Blog.

Technorati Tags: , , , , , , , ,

Don't forget the next Manchester Spring User Group meeting!

Just to reiterate my blog post from a few weeks ago:

The next Manchester Spring User Group meetup is 11th August

I'll be there, come over and say "Hi" if you see a skinhead with glasses... ;)

Technorati Tags: , , ,

Installing Ubuntu inside Windows XP using VirtualBox

Since moving companies over a year ago I've missed my Ubuntu desktop having moved back to development on Windows. I've had a few comments that some of my old Ubuntu blog posts are now out of date and I've wanted a way to ensure that they remain 'correct'.

After discussing virtualisation with a friend I opted to install VirtualBox - an open source virtualization tool which is free and easy to get going. This blog post contains my installation notes from installing VirtualBox and then creating an Ubuntu9 virtual machine...

First I downloaded the latest version of VirtualBox (version 3.0.0) and selected the "VirtualBox 3.0.0 for Windows hosts". Then I downloaded the latest version of the Ubuntu Desktop edition.

After both of these were fully downloaded I double-clicked the VirtualBox installer and choose to install everything.

  • When the "not passed Windows Logo testing" alerts pop-up choose to "Continue anyway" then register if you wish.

  • Once it's all installed run VirtualBox and click "New" to create a new virtual machine.

  • On the "VM Name and OS Type" page I entered "Ubuntu9" as the name, and for the operating System I chose "Linux" and "Ubuntu" as the version. On the "Memory" page I chose the default option, same for the "Virtual Hard Disk" setup.

  • Within the "New Disk Wizard" I chose "dynamically expanding storage" for the "Hard Disk Storage Type".
This will have just created a new virtual server called "Ubuntu9" in a "powered off" state.
  • Right-click "Ubuntu9" and choose "Settings...":

  • Click "CD/DVD-ROM" on the left-handside, then click "Mount CD/DVD Drive", choose "ISO Image File" and click the folder icon to the right-handside:

  • The Virtual Media Manager windows appears.
    Click "Add" and browse to where the downloaded Ubuntu ISO image was saved and click "Open". Then click "Select".

  • You will now be back at the Settings window, just click "Ok"

  • Now select "Ubuntu9" and then click the "Start" button
The virtual server now starts with the Ubuntu disk image auto-mounted and boots from this image. Use the cursor keys to select your default language and then choose "Install Ubuntu".

Ubuntu will start to install and load up the Gnome based installation wizard.
  • Select your language, timezone and keyboard layout when prompted.

  • You will now be presented with the disk formatting screen - choose "SCSI1 (0,0,0) (sda) 8.6GB ATA VBOX HARDDISK"

  • Enter some user information and login details and then click the "Install" button - this was a little scary as the host box is my main PC and although I'm running the installation via the VirtualBox it's still felt strange thinking that I might be clicking to reformat my main drive with Linux...
Ubuntu will automatically install after the disk formatting is complete, this can take a while. If it gets stucks at the "checking mirrors" stage then you might have some issues with the networking setup - the Ubuntu setup wants to be able to connect to the internet. I had to change my network settings from "NAT" to "Bridged" to get it working on my system.

If everything went ok you should now now be able to un-mount the Ubuntu disk image (via the Settings option) and start up your new Ubuntu machine:

That's it you can now use Ubuntu as if it was installed as your primary OS!

Technorati Tags: , , , , ,