Class SpringContextPluginBundleActivator

java.lang.Object
eu.rarogsoftware.rarog.platform.plugins.context.SpringContextPluginBundleActivator
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public class SpringContextPluginBundleActivator extends Object implements org.osgi.framework.BundleActivator
Implementation of BundleActivator that out-of-box provide all needed functionality for spring based plugins. This activator provides full set of functionality for spring based plugin without need for further configuration.

It automatically:

  • initializes spring context for provided `META-INF/spring/beans.xml`,
  • provides support for ExportComponent and ComponentImport annotations,
  • exports and imports spring components to/from OSGi,
  • invokes basic initializers available in API package,
  • exposes PluginActivator if none is present in spring context,
  • exposes FeatureDescriptors available in spring context,
  • cleans spring context and exposed services on bundle stop.

By default it exposes SimplePluginActivator if none is found in spring context. If plugin expose implementation of PluginActivator it will be used instead.

Exposed spring beans have additional property `BeanName` with original bean name, that allow filtering for bean name in OSGi.

Since:
1.0.0
See Also:
  • Field Details

    • bundleContext

      protected org.osgi.framework.BundleContext bundleContext
    • springContext

      protected OsgiPluginApplicationContext springContext
  • Constructor Details

    • SpringContextPluginBundleActivator

      public SpringContextPluginBundleActivator()
  • Method Details

    • start

      public final void start(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      start in interface org.osgi.framework.BundleActivator
      Throws:
      Exception
    • stop

      public final void stop(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      stop in interface org.osgi.framework.BundleActivator
      Throws:
      Exception
    • getBundleContext

      public org.osgi.framework.BundleContext getBundleContext()
    • getSpringContext

      public OsgiPluginApplicationContext getSpringContext()