According to Carlos Perez, it was one of the top five technologies to learn in 2008. It is open to discussions but the fact is it is getting more and more popular. So I recommend you to read this article if you do not have a clue on what the OSGi is and then you can continue with a tutorial given at the end of this article.
OSGi technology allows adding functionalities/services that are independently developed and plugged into an application framework. So most notable items in OSGi technology we can talk about are OSGi container and bundles that can be deployed to this container.
There is a consortium including Ericsson, IBM, Sun Microsystems, Nokia, Intel, BMW, and Philips. This consortium is known as “OSGi Alliance” (OSGi stands for Open Service Gateway Initiative).
OSGi alliance maintains a specification (like EJB Specification or Servlet Specification) so that several vendors can build OSGi Containers and developers can use these containers to deploy their bundles. So with specification released by OSGi Alliance there are some popular OSGi Container implementations such:
With these containers you can built your applications in a modular form. For example Eclipse is based on Equinox container and what we call plug-ins are actually OSGi bundles.
A bundle can search for other bundles, use them or it can use container’s services, it can export some of its packages. A bundle may have dependency on another bundle and this dependency can be optional, mandatory or it can require a specific version or version range. A bundle can also have its own classpath which can prevent many conflicts.
A bundle is actually a jar and a META-INF file which includes directives for the OSGi container.
For example you can build a bundle (lets call it time-bundle) which synchronizes a time attribute from a time server and export that time. And another bundle (lets call this one log-bundle) which logs some important happenings in the environment. Log-bunde can have an optional dependency on time-bundle. Log-bundle may use the synchronized time if time-bundle is available in the container, if it is not, it simple uses the system time without throwing an error.
Thus allows us reduced complexity, easy deployment (you can undeploy for example time-bundle and use a better one, a better version without restarting the whole application), reuse and many more.
Now download an OSGi container and start to develop some bundles.
- Here are some examples what the bundles look are like: http://felix.apache.org/site/apache-felix-osgi-tutorial.html
- Download Felix OSGi Container: http://felix.apache.org/site/downloads.html
- Start Felix and Install your bundles: http://felix.apache.org/site/apache-felix-usage-documentation.html
When you have knowledge on the basic terms I recommend you to continue with: http://www.springsource.org/osgi.