concept BundleActivator in category osgi

appears as: BundleActivator, BundleActivator, A BundleActivator
OSGi in Action: Creating Modular Applications in Java

This is an excerpt from Manning's book OSGi in Action: Creating Modular Applications in Java.

With that, we conclude our high-level look at the major API players in the lifecycle layer (BundleActivator, BundleContext, and Bundle). You now know the following:

  • BundleActivator is the entry point for the bundles, much like static main() in a standard Java application.
  • public class Activator implements BundleActivator {
      BundleContext m_context;
      public void start(BundleContext context) {
        m_context = context;
        startTestThread();
      }
      public void stop(BundleContext context) {
        stopTestThread();
      }
    }