Search code examples
osgiapache-felixapache-karafosgi-bundlekaraf

Apache Karaf and OSGI Bundles


After Googling a lot on Apache Karaf ,I understood that it is used for testing and building of OSGI bundles.I am still yet to figure out what to do with Apache Karaf and how to use it I didnt quite understand the need for OSGI bundles also.

Moreover I would also like to know the answers to my following doubts:

  1. What exacltly is Apache karaf in simple words?
  2. What purpose does it solve?Can it be used for solving day-to-day algorithmic problems?
  3. And where can I find nice tutorial problems on Karaf to start with
  4. What is the difference between Apache Karaf,Apache Felix and Apache Maven and how are they related to OSGI?

Solution

    1. Apache Karaf is a OSGi Container bringing the infrastructure to run OSGi-Bundles (std. Jar with OSGi Manifest), as Tomcat is a Web Container giving the infrastructure to run web-Applications.
    2. Don't know about your day-to-day algorithmic problems but it solves a lot of other day-to-day issues due to it's OSGi nature. For this you'd better take a look at OSGi and what it is about. In short:
      OSGi helps you on two main issues, high cohesion and low coupling. Due to the classloader seperation (it's a graph not a tree) it's possible to run multiple versions of the same artifact.
      Due to the service registry it's possible to have a plugin like architecture where one application can listen for multiple implementations of one Interface (service)
    3. There are plenty around, even Books to get you started you just need to google for it. Or take a look at the Apache Karaf documentation and the corresponding Articles
      • Apache maven: it's a build system it's there to manage your dependencies for Build time.
      • Apache Felix: it's a OSGi Framework implementation (like Eclipse Equinox).
      • Apache Karaf: It's as said in 1. a OSGi Container, solving a lot of infrastructural questions, like: logging. easy Deployment, ease on provisioning, and lot's more. For the complete stack again, take a look at the documentation