Adrian Colyer on Spring & OSGi
Just dipped into one or two segments of Adrian Colyer's InfoQ video interview on Spring & OSGi. There are bookmarks for anyone else who doesn't want to hear the full half hour.
Just dipped into one or two segments of Adrian Colyer's InfoQ video interview on Spring & OSGi. There are bookmarks for anyone else who doesn't want to hear the full half hour.
Posted by
Glyn
at
10:28 AM
0
comments
Labels: OSGi
Neil Bartlett has published another excellent OSGi tutorial in his EclipseZone series, this time introducing Declarative Services.
A must for anyone learning OSGi, and I include myself since I'm not an application programmer.
He'll also be giving a talk at the OSGi Community Event in Munich later this month.
Posted by
Glyn
at
1:47 PM
0
comments
Labels: OSGi
Interoperation is currently a hot topic on the JSR 277 mailing list -- see the "Relationship to JSR 291" thread in the archive.
One of the approaches to interoperation is a 'kernel'. What follows is an extract from the README of the prototype plus the related class diagrams.
Goal
The goal is to enable JSR 277 to interoperate in a first class way with JSR 291 (OSGi). JSR 277 modules must be able to use JSR 291 modules and vice versa without significant restrictions.
The framework can probably enable other types of module systems to interoperate, but that isn't the primary goal.
Strawman
The code [of the prototype] is only a strawman. It is not integrated with Felix or any other OSGi implementation. Nor is it integrated with JSR 277.
However, it outlines the interfaces that are likely to be needed to enable such module systems to interoperate well and provides several JUnit 4.1 testcases which drive the framework to illustrate the framework's features.
The code is licensed under the Apache License v2.0. See LICENSE.txt.
Module systems and wiring
The lack of a standard method of building delegation networks between class loaders requires each module system to interoperate specifically with each other module system. The framework provides a standard way for module systems to create delegation paths, or 'wires', to modules in other module systems.
We need a module system registry or 'kernel' to keep track of the available ModuleSystems. Something like the following.
public interface Kernel {
boolean registerModuleSystem(String moduleSystem, ModuleSystem ms);
boolean deregisterModuleSystem(String moduleSystem);
ModuleSystem getModuleSystem(String moduleSystem);
ModuleSystem[] getModuleSystems();
...
}
public interface WireFactory extends ModuleSystemRelated {
Wire resolve(Dependency dep);
Wire create(ResolutionContext ctx, Dependency dep);
Wire createLocal(ResolutionContext ctx, Dependency dep);
void complete(ResolutionContext ctx);
}
The module system class hierarchy shows wire factories, dependencies, and
Posted by
Glyn
at
7:12 AM
0
comments
Thanks to Colm Smyth for pointing out Jasper Potts' presentation from JavaOne on modularising Swing applications using a Spring-OSGi derivative known as SPAR. Nice to see OSGi being used by Sun.
Posted by
Glyn
at
8:56 AM
0
comments
Labels: OSGi
It may have been for me, but read the SD Times' view in OSGi Alliance Reaching Universal Middleware Goal.
Posted by
Glyn
at
11:39 AM
2
comments
Labels: OSGi
Posted by
Glyn
at
8:07 AM
6
comments
The various approaches to interoperation between JSR 277 and JSR 291 (OSGi) raise some interesting design considerations. The crucial distinction between these JSRs is that JSR 277 aims to be part of the Java 7 platform whereas JSR 291 is implemented as pure Java that will run on more or less any Java platform.
The JSR 277 Expert Group, or more accurately the spec. lead, is exploring the option of making some components such as the repository, module definition, and module instance pluggable and then having JSR 291 provide alternative implementations. This requires JSR 291 to surface its modules as JSR 277 modules, which will either require some generalisation of the notion of a JSR 277 module or a force fit. A force fit would probably result in unacceptable restrictions on interoperation and should be avoided.
A more ambitious approach, favoured by several Expert Group members including myself, is to rework JSR 277 to provide a 'custom module system' API analogous in concept to the way custom class loaders can be built on top of the existing class loader API.
In this scheme, the JSR 277 module system would simply be the default module system packaged with the Java 7 platform and JSR 291 could implement its module system on top of the API. The challenge in this approach would be to design the API so that multiple module systems implemented to the API would naturally interoperate. A benefit of this design is that it would allow module system implementations to evolve faster than the underlying platform - something that JSR 277 doesn't yet enable its own module system to do.
A third approach, which I prototyped to prove that reasonable interoperation is achievable, involves a module system interoperation 'kernel' with which multiple module systems may register. Each module system provides a class, known as a 'wire factory' , for creating delegation paths ('wires') to its modules' class loaders.
One benefit of both the custom module system API and of the interoperation kernel is that they do not complicate the API that the module developer has to deal with. The 'plugin' approach requires generalisations of the concepts of repository, module, and module definition to be exposed on the module developer API. Although this kind of generalisation may actually improve the API, it could also end up making it more obscure. We'll have to wait and see.
Posted by
Glyn
at
9:39 AM
0
comments
Much was made of OpenJDK at last week's JavaOne conference. On Tuesday morning, Rich Green delighted in telling the assembled masses "We are now, as regards the open-sourcing of Java, done" and then posted the following:
From: Rich Green
To: announce@openjdk.java.net
Subject: Open JDK is here!
Today begins the next phase for Java. I am pleased to announce that
we have completed the open source release of Open JDK.
It's a great day for innovation - and remember, compatibility matters!
Rich
Posted by
Glyn
at
10:54 AM
1 comments
Modularity had a lot of focus at last week's JavaOne conference. There were multiple references to JSRs 277 and 294 by Sun speakers, specific technical sessions on these JSRs, and a combined JSR 277 and 294 BOF.
There were a number of questions and comments at the JSR 294 session on the strawman's structuring of superpackage membership information in a separate source file rather than distributed across the source files of the member classes. This is something we should discuss on the mailing list (which you can read via the observer list).
Apart from an OSGi Best Practices technical session and the JSR 291 BOF, there were several mentions of OSGi and JSR 291 in other sessions. The goal of interoperating well with JSR 291 was presented in the JSR 277 session and even mentioned in one of Sun's general sessions1. Stanley Ho will float a proposal on the JSR 277 mailing list in due course, so subscribe to the observer list if you are interested (Expert Group discussions should begin to be mirrored there soon).
Ethan Nicholas gave an update on the browser edition work to minimise the download and initial install size of the JRE. This seems to be making good progress, although it is not based on any of the above JSRs, so there may be some 'shake-out' in due course.
In one of the "meet the team" sessions, I asked Sun's class library team what their plan was for exploiting JSR 277 and JSR 294 in the JRE. It seems they don't yet have one. I expect this to change, particularly after the JSR 277 and JSR 294 prototypes become available in a subproject of OpenJDK.
In contrast, the Apache Harmony session described how OSGi had been used from the start to modularise the class libraries. I gave a demo. of prototype JVM support for modular Harmony in the JSR 291 BOF.
GlassFish v3 is developing a module system known as HK2 ("Hundred Kilobytes Kernel") which is loosely based on JSR 277. It also has a dependency injection framework similar to Guice. (Unlike GlassFish which is mostly licensed under the CDDL, HK2 currently has no license defined, so you may want to avoid looking at the source code until there is a proper license.)
I had face to face meetings with Andreas Sterbenz to discuss aspects of JSR 294 and with Stanley Ho and Michał Cierniak to discuss interoperation of JSR 277 with JSR 291. There's a lot of work ahead and we won't know for quite a while how good the interoperation with JSR 291 will really be, but everyone concerned seems to be well aware of the importance of this capability.
1. See a couple of minutes from Intro. and Technical Deep Dive starting at 18 minutes and 45 seconds from the start when Danny Coward talks about modularity and refers to the goal of interoperation with OSGi.
The FAB for JSR 291 began today (Tuesday 8 May) - just in time for tomorrow's JSR 291 BOF session at JavaOne.
Posted by
Glyn
at
7:18 AM
0
comments
This week's JavaOne should be an interesting experience as it's my first.
After checking in this afternoon, I thought I'd sample James Gosling's session at the end of the Netbeans day. The content/time ratio was rather low, so I went for a walk in the daylight instead.
Perusing the pocket schedule in a Mexican restaurant later, I was pleased to see the JSR 291 BOF had made it into print, although it was too late for the IBM flyer. It seems like the BOF is competing with the tail end of the Eclipse party and Oracle's free screening of Spiderman 3. I'll be lucky if my co-presenter turns up (only kidding Richard).
The online session scheduler (JSP) seems to be struggling to stay up. How many thousands of people are hammering it? It finally let me switch a session.
Well, even blogging can't keep me awake. It's 9pm and 22.5 hours since I woke up. Better get to bed - tomorrow looks like a long day with sessions more or less continuously from 8.30am to 10.50pm. Boy do these American's take work seriously...
Posted by
Glyn
at
4:41 AM
2
comments
I've recently been tinkering with Google's dependency injection framework, Guice, and getting a simple example to run under the Equinox OSGi framework. It was straightforward except that there are a couple of extra dependencies (i.e. that you couldn't infer from the source code of the example) that need to be expressed as imported/exported packages because of a code generation library, cglib, that Guice uses.
This morning, I thought I'd try running the example using the Apache Harmony JDK 5.0M1 and it ran cleanly first time. I'm very impressed since Guice makes extensive use of generics and annotations and cglib is hardly typical application code.
Posted by
Glyn
at
11:50 AM
0
comments
InfoQ published an article on why one company has decided to use OSGi, in conjunction with Spring, for application modularity.
They are not starting from scratch, so it will be interesting to see how pleased they are with the result. On the face of it, OSGi is a good match to their requirements, particularly for versioning and for deploying application updates without restarting the server.
Posted by
Glyn
at
9:15 AM
0
comments
After reconsideration, a JSR 291 BOF1 has been accepted for JavaOne 2007. The plan is for Richard Hall and I to lead the session.
I hope to include some thoughts on JSR 277 interoperation as well as JSR 294 (superpackages) exploitation.
1. BOF-21240 entitled "JSR 291: Dynamic Component Support For The Java SE Platform", Wednesday 9 May, 9:55pm-10:45pm
A former colleague, Stuart McCulloch, just released some tools for building an OSGi application using Maven.
Apparently it uses bnd under the covers, although the example provided seems to need quite a bit spelling out by hand. Since I'm only a neophite Maven user, it's hard to tell...
Posted by
Glyn
at
9:02 AM
2
comments
Labels: OSGi
Jeff is a colleague from Eclipse who often has an interesting perspective. You may be interested in his new blog or the first post on provisioning changes in Eclipse.
Welcome to the blogosphere, Jeff!
Posted by
Glyn
at
4:04 PM
0
comments
Labels: Eclipse
According to the advance publicity, there seems to be one session1 at this year's JavaOne conference devoted to OSGi and only a couple of others that refer to OSGi. Not a single mention of JSR 291, although I did try putting in a submission.
I noticed an interesting tidbit in the conference guide: "[James Gosling] has also built a WYSIWYG text editor; a constraint-based drawing editor; and a text editor called Emacs, for UNIX systems."
So did Gosling invent Emacs as well as Java? Well, no, he didn't. The truth is rather more interesting.
Richard Stallman wrote the first version of Emacs and Gosling produced a C version to run on UNIX. A twist is that a legal tussle over the Emacs source code provoked Stallman to write the first precursor of the GPL. Stallman has since endorsed Sun's use of the GPL for their OpenJDK project, so I guess he and Gosling are friends again.
1. TS-1419 "Best OSGi Practices" on Thursday May 10 1:30 PM - 2:30 PM
Posted by
Glyn
at
1:22 PM
2
comments
Thanks to Hal for the link to Costin's blog on Spring-OSGi which recently shipped the first milestone build.
Now I'm on the look out for the first application to take advantage of Spring-OSGi. Any takers?
Posted by
Glyn
at
1:16 PM
3
comments
The JSR 294 Expert Group now has a publicly visible mailing list which is good timing as the Expert Group only kicked off a couple of weeks ago, so there'll be a complete archive of its deliberations.
It's a little disappointing that the newly revamped jcp.org site doesn't appear to be capable of hosting openly readable mailing lists as I would like that to be the default for all JSR Expert Groups.
Posted by
Glyn
at
12:14 PM
0
comments
Labels: JSR 294