org.apache.felix.cm.impl
Class ConfigurationManager

java.lang.Object
  extended by org.apache.felix.cm.impl.ConfigurationManager
All Implemented Interfaces:
java.util.EventListener, org.osgi.framework.BundleActivator, org.osgi.framework.BundleListener

public class ConfigurationManager
extends java.lang.Object
implements org.osgi.framework.BundleActivator, org.osgi.framework.BundleListener

The ConfigurationManager is the central class in this implementation of the Configuration Admin Service Specification. As such it has the following tasks:

The default FilePersistenceManager is configured with a configuration location taken from the felix.cm.dir framework property. If this property is not set the config directory in the current working directory as specified in the user.dir system property is used.


Field Summary
static java.lang.String CM_CONFIG_DIR
          The name of the bundle context property defining the location for the configuration files (value is "felix.cm.dir").
static java.lang.String CM_LOG_LEVEL
          The name of the bundle context property defining the maximum log level (value is "felix.cm.loglevel").
 
Constructor Summary
ConfigurationManager()
           
 
Method Summary
 void bundleChanged(org.osgi.framework.BundleEvent event)
           
 void callPlugins(java.util.Dictionary props, org.osgi.framework.ServiceReference sr, java.lang.String configPid, java.lang.String factoryPid)
          Calls the registered configuration plugins on the given configuration properties from the given configuration object.
 void configure(java.lang.String[] pid, org.osgi.framework.ServiceReference sr, boolean factory, ConfigurationMap<?> configs)
          Schedules the configuration of the referenced service with configuration for the given PID.
 org.osgi.framework.BundleContext getBundleContext()
           
 boolean isLogEnabled(int level)
           
 void log(int level, java.lang.String format, java.lang.Object[] args)
           
 void log(int level, java.lang.String message, java.lang.Throwable t)
           
 void start(org.osgi.framework.BundleContext bundleContext)
           
 void stop(org.osgi.framework.BundleContext bundleContext)
           
static java.lang.String toString(org.osgi.framework.ServiceReference ref)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CM_CONFIG_DIR

public static final java.lang.String CM_CONFIG_DIR
The name of the bundle context property defining the location for the configuration files (value is "felix.cm.dir").

See Also:
start(BundleContext), Constant Field Values

CM_LOG_LEVEL

public static final java.lang.String CM_LOG_LEVEL
The name of the bundle context property defining the maximum log level (value is "felix.cm.loglevel"). The log level setting is only used if there is no OSGi LogService available. Otherwise this setting is ignored.

This value of this property is expected to be an integer number corresponding to the log level values of the OSGi LogService. That is 1 for errors, 2 for warnings, 3 for informational messages and 4 for debug messages. The default value is 2, such that only warnings and errors are logged in the absence of a LogService.

See Also:
Constant Field Values
Constructor Detail

ConfigurationManager

public ConfigurationManager()
Method Detail

start

public void start(org.osgi.framework.BundleContext bundleContext)
Specified by:
start in interface org.osgi.framework.BundleActivator

stop

public void stop(org.osgi.framework.BundleContext bundleContext)
Specified by:
stop in interface org.osgi.framework.BundleActivator

getBundleContext

public org.osgi.framework.BundleContext getBundleContext()

bundleChanged

public void bundleChanged(org.osgi.framework.BundleEvent event)
Specified by:
bundleChanged in interface org.osgi.framework.BundleListener

configure

public void configure(java.lang.String[] pid,
                      org.osgi.framework.ServiceReference sr,
                      boolean factory,
                      ConfigurationMap<?> configs)
Schedules the configuration of the referenced service with configuration for the given PID.

Parameters:
pid - The list of service PID of the configurations to be provided to the referenced service.
sr - The ServiceReference to the service to be configured.
factory - true If the service is considered to be a ManagedServiceFactory. Otherwise the service is considered to be a ManagedService.

callPlugins

public void callPlugins(java.util.Dictionary props,
                        org.osgi.framework.ServiceReference sr,
                        java.lang.String configPid,
                        java.lang.String factoryPid)
Calls the registered configuration plugins on the given configuration properties from the given configuration object.

The plugins to be called are selected as ConfigurationPlugin services registered with a cm.target property set to * or the factory PID of the configuration (for factory configurations) or the PID of the configuration (for non-factory configurations).

Parameters:
props - The configuraiton properties run through the registered ConfigurationPlugin services. This must not be null.
sr - The service reference of the managed service (factory) which is to be updated with configuration
configPid - The PID of the configuration object whose properties are to be augmented
factoryPid - the factory PID of the configuration object whose properties are to be augmented. This is non-null only for a factory configuration.

isLogEnabled

public boolean isLogEnabled(int level)

log

public void log(int level,
                java.lang.String format,
                java.lang.Object[] args)

log

public void log(int level,
                java.lang.String message,
                java.lang.Throwable t)

toString

public static java.lang.String toString(org.osgi.framework.ServiceReference ref)


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