Sun's GlassFish Embracing Spring

Engineering | Rod Johnson | February 16, 2007 | ...

Sun take open source seriously these days, and users seem to be starting to take Sun open source seriously too.

GlassFish was late to the party in open source application servers, but it seems to be gaining traction. And, more importantly, it actually seems to be pretty good. Various Interface21ers, including Costin and Juergen, have taken a look at GlassFish and given it the thumbs up (although we haven't yet worked with it in production). From what I've heard, performance is excellent--probably substantially due to the reworked servlet engine based on NIO. The JPA implementation--TopLink…

WebLogic 10 Tech Preview Ships - Builds on Spring Framework

Engineering | Rod Johnson | February 11, 2007 | ...

Congratulations to the WebLogic team on shipping a preview of WebLogic 10, which passes the Java EE 5 CTS. It's good to see BEA getting back to their tradition of being quick off the mark, after their aberration with J2EE 1.4.

This is interesting news for the Spring community, because WebLogic 10 uses Pitchfork internally. The Pitchfork Project is an open source project led by Interface21 and collaboratively developed with BEA that implements EJB 3.0 interception and JSR-250 injection on top of Spring. It is used inside the WebLogic 10 EJB container and in other parts of the server to meet new…

Why the name Acegi?

Engineering | Ben Alex | January 25, 2007 | ...

Between Rod's recent blog on the origins of the Interface name, a recent thread querying the renaming of Acegi Security, and a suggestion late last year from my colleague Ben Hale to blog about the origins of the "Acegi" name, I've decided that it's probably time to do so!

First of all, the pronunciation: it's "ah-see-gee". Now that we've got that out of the way, let's go through where it came from:

  • Back in the early 1990s, I started a bulletin board system. I still remember using my first 300 baud modem, and actually watching the characters appearing at the same speed as I could read them! Anyway, a BBS required a name, and I quite liked "Midnight BBS" (or was it "Lightning BBS"?). After attempting to register my preferred name with the Australian BBS Registry, I received a phone call to be informed that the name was taken. I searched for another name, found no conflicts, and changed all of my screens (anyone remember Avatar?). I then went to register the BBS with its new name, although someone else had just beaten me to the same name. There were about 800 BBSes in Australia around the time - this was competitive stuff! So, I decided to go with something that was guaranteed to be original: characters 1, 3, 5, 7 and 9 from the English alphabet. Acegi BBS was then born.
  • This was the BBS heyday. It had callers from all across Australia, and it was the first BBS in our area code to acquire the seemingly limitless capacity of a CD-ROM. I became the 3:624 network coordinator for Fidonet and helped distributed "echomail" throughout our region. Before long, people started sending cheques payable to "Acegi BBS", as they wanted greater file download limits and access to Fidonet's netmail.
  • Because I needed to cash cheques with "Acegi" in the name, in early 1993 we decided to register a business name. Acegi Computer Technology was selected, and people happily made out their cheques accordingly.
  • In about 1995, I moved to Sydney with work. Dial-up Internet was just starting to become publicly available in Australia (it still cost around $5 per hour for modem access!). Because a BBS draws most of its users from a particular local area and I was leaving that area, I gave Acegi BBS to a friend to continue running. He too subsequently moved, and passed the BBS to another friend. I lost track after that. I did a Google for "Acegi BBS" and even found an old 1995 record of it.
  • By 1996 I needed a company for my IT projects, so Acegi Technology Pty Limited was born. It has remained operational since.
  • Sometime around November 2003, I wrote what eventually became Acegi Security. I put it into a ZIP file and shot it across to Rod and Juergen. I proposed the new project be called "Spring Security". However, they didn't have time to fully review it at that stage, so suggested I simply get it out there as "_____ Security System for Spring". As such, I prefixed "Acegi" into the name. As of today there are about 660,000 hits on Google for a search of "Acegi", and nearly all of it relates to the security framework.
Where to now? The next phase of the name is a "fork". Whilst Acegi Technology Pty Limited will continue to operate, Acegi Security will be renamed to "Spring Security". We're undertaking the rename for several good reasons. However, it's more than just a renaming exercise. It's actually a repositioning, moving Acegi Security even further into the Spring portfolio of products.

For those of you who haven't heard of the Spring portfolio, you'll be hearing more about it over the coming months. Spring is really a family of related products with comparable technical and cultural dimensions. Every product in the Spring portfolio shares a consistent quality of architecture, key design patterns, codebase, documentation, test coverage, friendly community, open source licensing, integrated samples, release roadmap and availability of commercial services (such as in-depth training and support) from Interface21

Dynamic DataSource Routing

Engineering | Mark Fisher | January 23, 2007 | ...

Spring 2.0.1 introduced an AbstractRoutingDataSource. I believe that it deserves attention, since (based on frequent questions from clients) I have a hunch that there are quite a few 'home-grown' solutions to this problem floating around. That combined with the fact that it is trivial to implement yet easy to overlook, and now I have several reasons to dust off my corner of the team blog.

The general idea is that a routing DataSource acts as an intermediary - while the 'real' DataSource can be determined dynamically at runtime based upon a lookup key. One potential use-case is for ensuring transaction-specific isolation levels which are not supported by standard JTA. For that, Spring provides an implementation: IsolationLevelDataSourceRouter

Java to JavaScript Compilation with AJAX and Spring Integration

Engineering | Ben Alex | January 22, 2007 | ...

For some time I have been interested in client-centric, web-based user interfaces. These Generation IV frameworks are characterised by their component-based, event-driven programming model, and focus on the presentation logic residing entirely on the client. Targeting a web browser in this manner typically necessitates the use of JavaScript or Flash, which in itself imposes a number of unique challenges.

It is possible to address many of these challenges if we can program in Java and automatically produce a JavaScript or Flash runtime module. Two well-known products for achieving this today are Google Web Toolkit (GWT) and Open Laszlo respectively. Both are available under OSI-approved licenses and have active communities, together with their own unique complexity. One consideration is to what extent they fulfil an objective of providing a transparent Java-based development environment that targets web browser deployment. This consideration has several facets, including IDE support, debugging integration, reflective capabilities, runtime widget binding and alike. All of…

Spring IDE powering ahead

Engineering | Rod Johnson | January 21, 2007 | ...

I had a great time at the Spring Experience conference last month. One pleasant surprise I had was the extent of the recent work the Spring IDE team have been doing. I ran into Spring IDE developer Christian Dupuis several times at the conference, and it seems that each time he'd implemented a new feature...

The forthcoming 2.0 release of Spring IDE is a comprehensive update to match the new features in Spring 2.0. And the Spring IDE team is making great progress with two of the big ticket items: XML extension namespaces and the AOP enhancements. (Btw, in case you're wondering why I haven't posted for a while, I spent a lot of time writing a Spring 2.0 update article over at InfoQ

Installing WebSphere Application Server 6.1 on Ubuntu

Engineering | Rob Harrop | January 19, 2007 | ...

Recently I've been doing some work with a client on WAS 6.1. Since we have a number of Spring users on WAS and I need to test the application, I decided it was time to get a copy of WAS running on one of my work laptops. I say 'one of' because I'm currently working on both my Mac (with OSX) and my ThinkPad (with Ubuntu) - more recently I've just been using the ThinkPad because I can have Oracle XE and WAS running without the need for a VM tool like Parallels. I still prefer the Mac, but to be honest there isn't much difference day-to-day - I just miss some of the more useful Mac tools like Spotlight, Quicksilver, TextMate and NewsFire.

Anyway, back to the main topic - installing WAS 6.1 on Ubuntu. I'm using Ubuntu Edgy and my first attempts at an install failed completely and I just couldn't figure out why. Thankfully a quick Google turned up this article. I was completely unaware that /bin/sh was linked to dash instead of bash - what on earth possessed them. I didn't really like the suggested solution of running the installer, letting it fail and then changing all the scripts in the installed directory. Instead, I just relinked /bin/sh with a quick sudo unlink /bin/sh followed by sudo ln -s /bin/bash /bin/sh. After that, the installer ran like a dream and I was up and running with a WAS install in about 15 minutes.

Even on my ThinkPad with Oracle XE running at the same time, WAS runs pretty quickly. One of the nicest things about WAS is that the tools provided (admin console, command-line tools) are really robust. The Admin Console is noticeable for its performance - many other servers have consoles that are painfully slow.

A Bridge Too Far

Engineering | Rob Harrop | January 16, 2007 | ...

In my last entry I presented a technique for creating strategy classes that take full advantage of any generic metadata that is present in your application. At the end of that entry I showed this code snippet:

EntitlementCalculator calculator = new DividendEntitlementCalculator();
calculator.calculateEntitlement(new MergerCorporateActionEvent());

You'll remember that DividendEntitlementCalculator was defined as:

public class DividendEntitlementCalculator implements EntitlementCalculator<DividendCorporateActionEvent> {

    public void calculateEntitlement(DividendCorporateActionEvent event) {

    }
}

As such it is not correct to pass an instance of MergerCorporateActionEvent into the calculateEntitlement method of the DividendEntitlementCalculator class. However, as I mentioned in my last entry that code will compile. Why? Well, EntitlementCalculator.calculateEntitlement() is defined to accept any type that extends CorporateActionEvent so it should compile. So in this scenario what happens at runtime and how does Java enforce type safety? Well, as you might imagine running this code gives you a ClassCastException saying that you cannot cast a MergerCorporateActionEvent to DividendCoporateActionEvent. In this way, Java can enforce type safety for you application - there is no way that the MergerCorporateActionEvent can creep into a method where DividendCorporateActionEvent is expected.

The real question here is: 'Where does that ClassCastException come from?' The answer is pretty simple - the Java compiler adds the code to create and throw it as appropriate by introducing a bridge method. Bridge methods are synthetic methods that the compiler will generate and add to your classes to ensure type safety in the face of generic types.

In the case shown above EntitlementCalculator.calculateEntitlement can be called with any object that is type compatible with CorporateActionEvent. However, DividendEntitlementCalculator accepts only objects that are type compatible with DividendCorporateActionEvent, but, since you can call the DividendEntitlementCalculator via the EntitlementCalculator interface it too must accept CorporateActionEvent. So what does this translate to in the compiled class file? We have the user supplied method:

public void calculateEntitlement(DividendCorporateActionEvent event) {
    System.out.println(event);
}

Which translates to this bytecode:

public void calculateEntitlement(bigbank.DividendCorporateActionEvent);
  Code:
   Stack=2, Locals=2, Args_size=2
   0:   getstatic       #2; //Field java…

Unit Testing with Stubs and Mocks

Engineering | Dave Syer | January 15, 2007 | ...

I was on site with some clients the other day, and they asked me about unit testing and mock objects. I decided to write up some of the discussion we had as a tutorial on creating dependencies (collaborators) for unit testing. We discuss two options, stubbing and mock objects and give some simple examples that illustrate the usage, and the advantages and disadvantages of both approaches.

It is common in unit tests to mock or stub collaborators of the class under test so that the test is independent of the implementation of the collaborators. It is also a useful thing to be able to do to…

What's New and Cool in Spring 2.0?

Engineering | Ben Alex | December 16, 2006 | ...

Last month Rod Johnson presented at three Australian Spring User Group meetings a session entitled, "What's New and Cool in Spring 2.0". Rod mentioned during those meetings that I'd make his presentation available, so here it is.

There are some other recent presentations that people have also been emailing me about. In no particular order, here is the latest:

For those of you who attended the presentations, I hope you enjoyed them.

Get the Spring newsletter

Thank you for your interest. Someone will get back to you shortly.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all