org.apache.felix.scr.impl
Class Activator

java.lang.Object
  extended by org.apache.felix.scr.impl.Activator
All Implemented Interfaces:
EventListener, BundleActivator, BundleListener, SynchronousBundleListener

public class Activator
extends Object
implements BundleActivator, SynchronousBundleListener

This activator is used to cover requirement described in section 112.8.1 @@ -27,14 37,202 @@ in active bundles.


Constructor Summary
Activator()
           
 
Method Summary
 void bundleChanged(BundleEvent event)
          Loads and unloads any components provided by the bundle whose state changed.
static ComponentRegistry createComponentRegistry(BundleContext bundleContext)
           
static Object getPackageAdmin()
           
static boolean hasCtWorkaround()
          Returns true if the ds.ctworkaround framework property has been set to true.
static void log(int level, Bundle bundle, String message, Throwable ex)
          Method to actually emit the log message.
 void start(BundleContext context)
          Registers this instance as a (synchronous) bundle listener and loads the components of already registered bundles.
 void stop(BundleContext context)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Activator

public Activator()
Method Detail

start

public void start(BundleContext context)
           throws Exception
Registers this instance as a (synchronous) bundle listener and loads the components of already registered bundles.

Specified by:
start in interface BundleActivator
Parameters:
context - The BundleContext of the SCR implementation bundle.
Throws:
Exception - If this method throws an exception, this bundle is marked as stopped and the Framework will remove this bundle's listeners, unregister all services registered by this bundle, and release all services used by this bundle.

stop

public void stop(BundleContext context)
          throws 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.

Specified by:
stop in interface BundleActivator
Parameters:
context - The BundleContext of the SCR implementation bundle.
Throws:
Exception - If this method throws an exception, the bundle is still marked as stopped, and the Framework will remove the bundle's listeners, unregister all services registered by the bundle, and release all services used by the bundle.

bundleChanged

public void bundleChanged(BundleEvent event)
Loads and unloads any components provided by the bundle whose state changed. If the bundle has been started, the components are loaded. If the bundle is about to stop, the components are unloaded.

Specified by:
bundleChanged in interface BundleListener
Parameters:
event - The BundleEvent representing the bundle state change.

createComponentRegistry

public static ComponentRegistry createComponentRegistry(BundleContext bundleContext)

log

public static void log(int level,
                       Bundle bundle,
                       String message,
                       Throwable ex)
Method to actually emit the log message. If the LogService is available, the message will be logged through the LogService. Otherwise the message is logged to stdout (or stderr in case of LOG_ERROR level messages),

Parameters:
level - The log level to log the message at
message - The message to log
ex - An optional Throwable whose stack trace is written, or null to not log a stack trace.

getPackageAdmin

public static Object getPackageAdmin()

hasCtWorkaround

public static boolean hasCtWorkaround()
Returns true if the ds.ctworkaround framework property has been set to true. Otherwise false is returned.

If this method returns true, two workarounds for the OSGi Compendium R 4.2 CT for Declarative Services are active:

Setting the ds.ctworkaround framework property is required to pass the CT but setting the property in a productive environment is strongly discouraged.

Returns:
true if the ds.ctworkaround framework property is set to true.
See Also:
FELIX-2526


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.