In this final post in the series about OSGi Applications we will be looking at internal bundle repositories. An internal bundle repository lets you share OSGi bundles that are saved in a single location across multiple OSGi applications installed into the Liberty Profile.
Last time in this series we looked at creating a simple OSGi application and used an activator class that is informed when a bundle starts and stops to print a message. This time we’ll use the same activator class to do something more useful: register an OSGi services.
A Blueprint Container is a mechanism to simplify this process and remove all of the OSGi specific Java code, replacing it with a simple XML file and using dependency injection in the Java code. Today we’ll start using Blueprint by creating a new bundle that imports the service we created last time and registers a second service. We’ll then use this new service to print a message containing the date in the Servlet.
OSGi Applications that run in an enterprise environment are a great alternative to deploying the traditional EAR file. This series is going to run through an introduction to OSGi Applications for an enterprise developer, if you don’t know why you might want to do this then Ian Robinson has done an excellent explanation of the advantages of using OSGi Applications.