org.apache.felix.scr.impl
Class BundleComponentActivator

java.lang.Object
  extended by org.apache.felix.scr.impl.BundleComponentActivator
All Implemented Interfaces:
Logger

public class BundleComponentActivator
extends Object
implements Logger

The BundleComponentActivator is helper class to load and unload Components of a single bundle. It will read information from the metadata.xml file descriptors and create the corresponding managers.


Method Summary
 void disableComponent(String name)
          Implements the ComponentContext.disableComponent(String) method by first finding the component(s) for the name and then starting a thread to actually disable all components found.
 void enableComponent(String name)
          Implements the ComponentContext.enableComponent(String) method by first finding the component(s) for the name and then starting a thread to actually enable all components found.
 BundleContext getBundleContext()
          Returns the BundleContext
 ScrConfiguration getConfiguration()
           
 boolean isLogEnabled(int level)
          Returns true if logging for the given level is enabled.
 void log(int level, String message, ComponentMetadata metadata, Throwable ex)
          Method to actually emit the log message.
 void log(int level, String pattern, Object[] arguments, ComponentMetadata metadata, Throwable ex)
          Method to actually emit the log message.
 long registerComponentId(AbstractComponentManager componentManager)
           
 void schedule(Runnable task)
          Schedules the given task for asynchrounous execution or synchronously runs the task if the thread is not running.
 void unregisterComponentId(AbstractComponentManager componentManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBundleContext

public BundleContext getBundleContext()
Returns the BundleContext

Returns:
the BundleContext

getConfiguration

public ScrConfiguration getConfiguration()

enableComponent

public void enableComponent(String name)
Implements the ComponentContext.enableComponent(String) method by first finding the component(s) for the name and then starting a thread to actually enable all components found.

If no component matching the given name is found the thread is not started and the method does nothing.

Parameters:
name - The name of the component to enable or null to enable all components.

disableComponent

public void disableComponent(String name)
Implements the ComponentContext.disableComponent(String) method by first finding the component(s) for the name and then starting a thread to actually disable all components found.

If no component matching the given name is found the thread is not started and the method does nothing.

Parameters:
name - The name of the component to disable or null to disable all components.

registerComponentId

public long registerComponentId(AbstractComponentManager componentManager)

unregisterComponentId

public void unregisterComponentId(AbstractComponentManager componentManager)

schedule

public void schedule(Runnable task)
Schedules the given task for asynchrounous execution or synchronously runs the task if the thread is not running. If this instance is not active, the task is not executed.

Parameters:
task - The component task to execute

isLogEnabled

public boolean isLogEnabled(int level)
Returns true if logging for the given level is enabled.

Specified by:
isLogEnabled in interface Logger

log

public void log(int level,
                String pattern,
                Object[] arguments,
                ComponentMetadata metadata,
                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),

Specified by:
log in interface Logger
Parameters:
level - The log level to log the message at
pattern - The java.text.MessageFormat message format string for preparing the message
arguments - The format arguments for the pattern string.
ex - An optional Throwable whose stack trace is written, or null to not log a stack trace.

log

public void log(int level,
                String message,
                ComponentMetadata metadata,
                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),

Specified by:
log in interface Logger
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.
metadata - The ComponentMetadata whose processing caused the message. This may be null if the component metadata is not known or applicable.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.