org.pentaho.reporting.engine.classic.core.modules.misc.configstore.filesystem
Class FileConfigStorage

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.modules.misc.configstore.filesystem.FileConfigStorage
All Implemented Interfaces:
ConfigStorage

public class FileConfigStorage
extends Object
implements ConfigStorage

The FileConfigStorage is a storage provider that stores its content on the local filesystem. The directory used contains the data as plain text property files.

Author:
Thomas Morgner

Constructor Summary
FileConfigStorage(File baseDirectory)
          Creates a new file config storage and stores the contents in the given directory.
 
Method Summary
 boolean isAvailable(String configPath)
          Tests, whether some configuration data exists for the given configuration.
 org.pentaho.reporting.libraries.base.config.Configuration load(String configPath, org.pentaho.reporting.libraries.base.config.Configuration defaults)
          Loads the properties from the given path, specifying the given properties as default.
 void store(String configPath, org.pentaho.reporting.libraries.base.config.Configuration config)
          Stores the given properties on the defined path.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileConfigStorage

public FileConfigStorage(File baseDirectory)
Creates a new file config storage and stores the contents in the given directory.

Parameters:
baseDirectory - the directory that should contain the files.
Method Detail

store

public void store(String configPath,
                  org.pentaho.reporting.libraries.base.config.Configuration config)
           throws ConfigStoreException
Stores the given properties on the defined path.

This implementation stores the data as property files.

Specified by:
store in interface ConfigStorage
Parameters:
configPath - the configuration path that specifies where to store the properties.
config - the configuration, that should be stored.
Throws:
ConfigStoreException - if an error occured.
See Also:
#storeProperties(java.lang.String, java.util.Properties)

load

public org.pentaho.reporting.libraries.base.config.Configuration load(String configPath,
                                                                      org.pentaho.reporting.libraries.base.config.Configuration defaults)
                                                               throws ConfigStoreException
Loads the properties from the given path, specifying the given properties as default.

Specified by:
load in interface ConfigStorage
Parameters:
configPath - the configuration path from where to load the properties.
defaults - the property set that acts as fallback to provide default values.
Returns:
the loaded properties.
Throws:
ConfigStoreException - if an error occured.

isAvailable

public boolean isAvailable(String configPath)
Tests, whether some configuration data exists for the given configuration.

Specified by:
isAvailable in interface ConfigStorage
Parameters:
configPath - the configuration path to the property storage.
Returns:
true, if there are properties under this path, false otherwise.

toString

public String toString()
Overrides:
toString in class Object