org.apache.ace.configurator
Class Configurator

java.lang.Object
  extended by org.apache.ace.configurator.Configurator
All Implemented Interfaces:
Runnable

public class Configurator
extends Object
implements Runnable

Configures bundles managed by the ConfigurationAdmin. This Configurator uses text files as configuration files containing properties. When a configuration file is added, the properties are being read and added. If the config file is removed, the properties are removed as well.

The configuration files should be stored in the configuration directory (often the 'conf' directory) of the OSGi framework and should have the format: <pid>.cfg

Note: this Configurator is based upon the principle in the FileInstall bundle Peter Kriens wrote. (see http://www.aqute.biz/Code/FileInstall for more information)


Constructor Summary
Configurator(File dir, long pollInterval, boolean reconfig)
          Instantiates a new configurator.
 
Method Summary
protected  void deleteConfig(String pid, String factoryPid)
          Removes a configuration from ConfigAdmin.
protected  String parsePid(File file)
          Remove the config extension (.cfg) and return the resulting String.
 void run()
          Starts the actual Timer task, and calls the configurator to make sure the configurations are performed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configurator

public Configurator(File dir,
                    long pollInterval,
                    boolean reconfig)
Instantiates a new configurator.

Parameters:
dir - The directory to watch.
pollInterval - The poll iterval in ms.
reconfig - Whether or not to use reconfiguration: if false, existing configuration values will not be overwritten, only new values (for a given pid) will be added.
Method Detail

run

public void run()
Starts the actual Timer task, and calls the configurator to make sure the configurations are performed. Checking whether a new configuration is present, will be done with an interval that can be defined via a system property.

Specified by:
run in interface Runnable

deleteConfig

protected void deleteConfig(String pid,
                            String factoryPid)
Removes a configuration from ConfigAdmin.


parsePid

protected String parsePid(File file)
Remove the config extension (.cfg) and return the resulting String.



Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.