Blog

JavaOne 2008 Day Three

09 May, 2008
Xebia Background Header Wave

Today was the third day of the conference. Another couple of hours to go and then it is all over again. The fatigue is kicking in, and we’re starting to run on reserve power. The topics of today included:

  • Mylyn
  • Groovy
  • Semantic Web
  • SOA
  • OSGi

Erik Jan on Mylyn
It’s now the third day of the JavaOne and the signs of fatigue are beginning to show, so today I haven’t been to any Bird of a Feather sessions at night. I did go to a session about Mylyn. I’ve blogged about it before, but I was impressed with what they have done with it. They have added a lot of connectors for different issue tracking system. One of the things I’ve missed, which they’ve now announced is the ability to automatically log time worked on an issue. Also they have created a perspective where you can keep more context for your task so that any webpages that you have looked at are also saved with your task.
With a demo the presenter showed another great use for Mylyn. When you’re pair programming for instance, and one of the two is going home, you can easily create a patch of the changes and save it with the task similar to the context. Your colleague can then easily continue the work on his own computer.
So my next project we all are going to use Mylyn, so that we can track the work that has been done and improve on our estimates. The added benefit of pairing and taking over will simplify pair programming.
Jeroen on Groovy scripting and the Semantic Web
To start off my day. I attended the Groovy and Grails talk by Guillaume LaForge and Graeme Rocher. Unfortunately Graeme was ill, so Guillaume did the presentation on his own. In this talk he went further than during the scripting bowl. People got to experience first-hand what it means to have the power of the Meta-Object Protocol (MOP) at their hands. Although Groovy is not the only language with a MOP – Ruby, Lisp and Smalltalk also have one -, we focus on this language.
THe Meta-Object Protocol makes Groovy a dynamic language. It makes it possible to add and override methods and properties to existing class definitions at runtime. Two small examples which Guillaume showed us were the following:
Adding methods at runtime

class Dog {}
Dog.metaClass.bark = { -> "Woof" }
def d = new Dog()
print d.bark()
==> Woof

Override method at runtime (Note: This is not a good idea…)

Integer.metaClass.plus = { Integer i -> 1 }
3 + 4
==> 1

Next to that, he also explained some nice methodMissing tricks, in the next code sample, the missing method will be added to the class definition so that the next time the penalty of going through methodMissing is removed.

class Dog {}
Dog.metaClass.methodMissing = { String name, args ->
    def cached = { Object[] a -> println "Dogs don't $name"}
    Dog.metaClass."$name" = cached
    cached.call(args)
}
new Dog().quack()

In all Guillaume showed what the power of Groovy over Java is, and what Groovy can contribute to your current enterprise application development.
After the lunch I went to the Semantic Web panel discussion. Here we had a panel of 5 Semantic Web gurus who held a discussion, showed some cool apps, and andwered questions from the audience. What soon became clear was that the current focus is on the Semantic Web as a social networking tool. Many of the demo applications were centered around that theme.
According to these gurus, the problem with the current social networks is that there are too many, and each of those is centralied and lives on its own island. The Semantic Web can help in this aspect. There are no competing standards, everything is interoperable, and it is decentralised, everything is identified by its own URI. One demo showed an addressbook, in whch you could drop yourself, and easily gain access to your friends, and your friends’ friends, etc.
Another big announcement they gve was that Yahoo! will be adding RDFa to all it’s pages and will be pushing it out through its APIs. This is a big step, which will make Yahoo! a semantic company joining other companies such as Reuters and the W3C as supporters of Semantic standards. Adding the RDF means adding semantic tags to the pages. A semantic tag is different from a normal blog tag in that it gives a meaning to the data such as whether it is a place, an organization, a person, or something completely else.
After almost 10 years, we’re finally taking steps to where Tim Berners Lee envisioned we should be going with the web, but the full Semantic Web is still far away. We can only hope that this step by Yahoo! will be followed by more companies.
Marco on his (SOA) day
Sun Java Composite Application Platform Suite: Implementing Selected EAI Patterns
At JavaPolis I was constantly being told what a great book Enterprise Architecture Patterns was, so as soon as I returned to the office I had it ordered. Unfortunately I haven’t really had the chance to put it to use it since then, as my last project was not exactly suited for this type of approach. This session, although a bit dry, rekindled my interest, showing real life implementations of those patterns using Sun’s Java CAPS. Now let’s hope that at least this time I will be able to use all the knowledge I gathered.
LifeCycle ES: Adobe’s Java 2 Platform, Enterprise Edition (J2EE Platform), SOA Platform
One thing is sure: there’s no lack of platforms in this session’s title. Even more than the previous session it was centered around a product, in this case created by the very same company that is famous for their Acrobat reader. Keeping that in mind, it wasn’t too surprising that the demo was about doing a PDF processor. Now I’m still not sure how that was connected to the SOA stuff, but that might also be because I was too busy trying to remember of what actor the speaker made me think of (French Stewart of 3rd Rock –mostly because of the nasal voice).
Converting Large Applications to OSGi
I knew only the basics of OSGi because of a session I attended by Peter Kriens at JavaPolis, and was warned by the very same speaker (well, not personally of course – although he did look directly at me when he addressed the room) that the subject could become a bit hard to grasp. He needn’t have feared: it was a very clear talk, with some useful instructions how to tackle the conversion of an already existing application.
Composite Application Design Patterns
Proof that even I make mistakes sometimes (everybody who knows me personally: stop laughing) I decided to ditch a session about choosing the right web for this. Basically it was nothing more than presenting some patterns people at SAP came up with in such a fashion that it added absolutely nothing extra to just checking the powerpoint. Now I know giving an interesting, lively presentation is really difficult but c’mon, there weren’t even any monkeys! How can you have a session about this subject without any monkeys? It’s crazy, that’s what it is ..
Designing Service-Oriented Architecture Applications with OSGI
Today’s final session took place several hours after my last one, but it was well worth going back to Moscone center for. A panel of 4 told us about the pros and cons of using OSGi based on their experience of using it to build the new version of JBoss ESB. In general they were very positive, giving some extra credit to the whiteboard pattern. Now I have never heard of it before, but it’s clear that with a name like that it must be something that can wipe all erroneous legacy code in one sweep.
Yes, I’m kidding.
Epilogue
Another very SOA-centric day, and the pieces start falling into place. I could have done without the session given by the SAP guys, but alas: win some, lose some. Tomorrow I’ll actually do some sessions from other tracks as well, here’s hoping they will be as interesting as most of those I’ve attended so far.
Mischa on Converting (Large) Applications to OSGi
BJ Hargrave and Peter Kriens are experts on OSGi and the goal of there presentation was to "Learn us how to Simplify Application Development by Building for the OSGi Service Platform"
OSGi is the dynamic module system for Java.
The Standard approach to modularization in Java has a couple of issues like:

  • Granularity of classes and packages is too small for real world applications
  • Jars provide packaging, but can not be used to restrict access
  • Severe problems like split packages
  • No versioning support
  • Has no proper extension/collaboration model

Now the OSGi framework features the following:

  • Class loading dispatch based on package name
  • Allows multiple versions of the same class in one VM
  • Jars can contain exported packages or private packages
  • Bundle == Jar (Manifest contains metadata)
  • Services provide a collaborative in-VM SOA model

So it contains all we need.
So how do you convert your application? Well, one step at a time.

  • Analyse what the dependencies between the jars are.
  • Make a project with your application and all its dependent jars
  • Create a bundle activator that calls main (Include all libraries into one bundle).

Having a working bundle (whatever the size) is a good baseline and allows for gradually replacing the dependent jars with bundles
Keep it working!
Now there is a working version, start breaking up the bundle in smaller bundles.
Currently there are several open source projects that provide OSGi metadata:

  • Apache (Derby, Struts, Felix, etc)
  • All Eclipse code
  • Codehaus Groovy

To make it even nicer there are also a couple of repositories online, so you don’t have to do all the work yourself. SpringSource Enterprise Bundle Repository is an example.
Unfortunately there are a few pitfalls such as:

  • Too much at once (Get the complete application to work on OSGi, modularize a part, test, and iterate in small increments)
  • Dynamic Class Loading (Most of the time custom class loaders are abused in applications, get rid of them)

So be careful and start small.
For those of you who want to look at some OSGi application models, have a look at the following examples:

  • Spring-DM (formerly called Spring-OSGi)
  • Apache iPOJO
  • Service Application Toolkit
  • OSGi Declarative Services
Questions?

Get in touch with us to learn more about the subject and related solutions

Explore related posts