Dienstag, 24. August 2010

OSGi Bundle Quality or Bundle Information Repository

A lot of projects build their JARs as OSGi bundles e.g. Jersey. The quality varies from very good bundles up to the bundles they do not work they only generate a MANIFEST file. Often you spend a lot of time until you have your frameworks running in an OSGi environment. Even if these frameworks JARs are offered as OSGi bundles already. So Neil Bartlett came up at Twitter with the idea to build a portal where you can find information about the quality of OSGi bundles.

After the twitter post from Neil, I think about such a portal and here are my first ideas about such a information portal. I think first we need a small command line tool which implements a set of static and dynamic tests for OSGi bundles. Nice would be a set of plugins which integrate the tool into your build tool (e.g. maven, ant) or favorite IDE.

What kind of static tests should this bundle test tool support?
  • Check if the to test JAR (bundle) have a valid MANIFEST e.g. to check via Peter Kriens BND lib.
  • Check some MANIFEST pattern e.g. do the bundle import the exported packages, which is a OSGi best practice.
  • Do the bundle describe e.g. via extra configuration where to get the runtime dependencies e.g. via maven pom.xml? Provide this dependencies (JARs) all of the imported packages.
  • Use the bundle a framework for declarative services? E.g. do the bundle use DS, Blue Print, iPOJO, Pearbeary...
  • Which OSGi services does the bundle use e.g. configuration service, logging service etc.

What kind of dynamic test should the test tool provided?
  • Check if the bundle can be deployed in an OSGi container (equinox, felix,… therefore the pax runner can be used for implementation). The bundle should ship a reference set of runtime dependencies or provided a configuration file which describes where to get these dependencies e.g. via maven or ivy. The order in which the runtime dependencies will be started can be determined via a static test on each bundle (for implementation the BND lib can be used, or pax runner do this already?). In addition to the runtime dependencies it should be a possibility that a bundle can describe a set of system properties.
  • Test that the exported packages can be used from a bundle. There for a test bundle can be generated which use the exported package resources of the bundle under test.
  • Check that if a started OSGi bundle provides OSGi services.
  • When a bundle use a framework for declarative services e.g. DS, verify that the decelerated services are up and running in the service registry.
  • Check that a bundle restart works. Service is down and will be started again etc.

When we have such a tool to automatically verify the quality of an OSGi bundle and get a set of information about the bundle. A central information portal/repository would be very nice where you can submit your bundles and the checks will be run on your bundle and published. Where you can search for bundles and you get information where to download the bundle and a set of information of the quality of the bundle. I think such an information repository about OSGi bundles and there quality should be hosted under www.osgi.org.

Here some ideas how to submit a bundle into such an information repository/portal? I think the portal should provide a REST service and web form to submit bundles to check and to add to the repository. The runtime dependencies can submit as ZIP or as maven pom.xml or ivy configuration. For the REST service plugins for build tools and IDEs would be nice. E.g. a plugin for maven which will be bind to the deploy phase of maven, could automatically deploy the bundle to check also to the bundle information repository.

Is anyone interested to build the testing tool with me as an open source project? Or is there a cool tool out there which can do such tests? Please contact me or write a comment to the post?


Sonntag, 15. August 2010

Eclipse Tipp Reloaded - Disable STS Dashboard On Startup

Last year I wrote a blog entry how to disable the STS (Spring Tool Suite) dashboard on eclipse startup see here. In newer version of STS the option is now in the preference dialog of STS see the screenshot bellow.

  • http://tux2323.blogspot.com/2009/11/eclipse-tipp-disable-sts-dashboard-on.html
  • http://www.springsource.com/developer/sts

Import a Clojure Leiningen Project into Eclipse

To import a leiningen project in the Eclipse IDE add the eclipse leiningen plugin in the project.clj as dev-dependency.

When you now invoke the command "lein help" there is a new task called eclipse. Invoke the leiningen task eclipse via "lein eclipse". The eclipse leiningen tasks creates the eclipse projects files ".project" and ".classpath".

Now you can import the project in the eclipse IDE, therefore you can use the import eclipse wizard. Therefore select "File->Import->Existing Project into Workspace" then click the next button and select the leiningen project as root directory now you can import the project via click on the finish button.

When you have installed the eclipse plugin counterclockwise you can know develop with syntax highlighting, run the project and debug the project from the eclipse IDE.


Samstag, 14. August 2010

My first Clojure Web Application

I’m a fan of LISP, so I'm known a fan of Clojure, because Clojure brings LISP features to the Java platform. I don’t know if Clojure is good programming language for production use or for my daily work, but it makes a lot of fun to develop in Clojure, just try it. My first step was to write in clojure a simple hello world web application.

I choose leinigen as build and dependency management tool and the clojure web framework Compojure to develop a super simple hello world web application.

Here are the steps how I create my first hello world web application in clojure in 3 minutes:

1.) Download Leiningen
Download the lein bash script from:


2.) Install Leiningen
Invoke the bash script with the follow command:

lein self-install

3.) Create a New Clojure Project
Creating a new project with leinigen, therefore invoke the follow command:

lein new helloworld-webapp

4.) Add Compojure Dependency
Add the compojure dependency to the project, therefore add the follow dependecies to the project.clj file.

5.) Create the Hello World Application
Add the follow lines of code in "src/helloworld_webapp/core.clj"

6.) Run the Web Application
To start the hello world web application invoke the follow command:

lein test

7.) Invoke the Application
Now you can use the simple web application in your favorite browser open the URL:


Source Code
The source code of this simple demo can be found on GitHub: