Class Activator

  • All Implemented Interfaces:
    java.util.EventListener, org.osgi.framework.BundleActivator, org.osgi.framework.BundleListener, org.osgi.framework.SynchronousBundleListener, org.osgi.util.tracker.BundleTrackerCustomizer<org.osgi.framework.Bundle>

    public class Activator
    extends AbstractExtender
    This activator is used to cover requirement described in section 112.8.1 @@ -27,14 37,202 @@ in active bundles.
    • Field Detail

      • m_context

        private org.osgi.framework.BundleContext m_context
      • m_globalContext

        private org.osgi.framework.BundleContext m_globalContext
      • m_bundle

        private org.osgi.framework.Bundle m_bundle
      • m_runtime_reg

        private org.osgi.framework.ServiceRegistration<org.osgi.service.component.runtime.ServiceComponentRuntime> m_runtime_reg
    • Constructor Detail

      • Activator

        public Activator()
    • Method Detail

      • start

        public void start​(org.osgi.framework.BundleContext context)
                   throws java.lang.Exception
        Registers this instance as a (synchronous) bundle listener and loads the components of already registered bundles.
        Specified by:
        start in interface org.osgi.framework.BundleActivator
        Overrides:
        start in class AbstractExtender
        Parameters:
        context - The BundleContext of the SCR implementation bundle.
        Throws:
        java.lang.Exception
      • restart

        public void restart​(boolean globalExtender)
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Overrides:
        doStart in class AbstractExtender
        Throws:
        java.lang.Exception
      • stop

        public void stop​(org.osgi.framework.BundleContext context)
                  throws java.lang.Exception
        Specified by:
        stop in interface org.osgi.framework.BundleActivator
        Overrides:
        stop in class AbstractExtender
        Throws:
        java.lang.Exception
      • doStop

        public void doStop()
                    throws java.lang.Exception
        Unregisters this instance as a bundle listener and unloads all components which have been registered during the active life time of the SCR implementation bundle.
        Overrides:
        doStop in class AbstractExtender
        Throws:
        java.lang.Exception
      • doCreateExtension

        protected Activator.ScrExtension doCreateExtension​(org.osgi.framework.Bundle bundle)
                                                    throws java.lang.Exception
        Description copied from class: AbstractExtender
        Create the extension for the given bundle, or null if the bundle is not to be extended.
        Specified by:
        doCreateExtension in class AbstractExtender
        Parameters:
        bundle - the bundle to extend
        Returns:
        The extension
        Throws:
        java.lang.Exception - If something goes wrong
      • loadComponents

        private void loadComponents​(org.osgi.framework.Bundle bundle)
        Loads the components of the given bundle. If the bundle has no Service-Component header, this method has no effect. The fragments of a bundle are not checked for the header (112.4.1).

        This method calls the Bundle.getBundleContext() method to find the BundleContext of the bundle. If the context cannot be found, this method does not load components for the bundle.

      • disposeComponents

        private void disposeComponents​(org.osgi.framework.Bundle bundle)
        Unloads components of the given bundle. If no components have been loaded for the bundle, this method has no effect.
      • debug

        protected void debug​(org.osgi.framework.Bundle bundle,
                             java.lang.String msg)
        Specified by:
        debug in class AbstractExtender
      • warn

        protected void warn​(org.osgi.framework.Bundle bundle,
                            java.lang.String msg,
                            java.lang.Throwable t)
        Specified by:
        warn in class AbstractExtender