org.jconfig.handler
Class PropertiesFileHandler

java.lang.Object
  extended byorg.jconfig.handler.AbstractHandler
      extended byorg.jconfig.handler.PropertiesFileHandler
All Implemented Interfaces:
ConfigurationHandler, java.util.EventListener, FileListener

public class PropertiesFileHandler
extends AbstractHandler

The PropertiesFileHandler can read a java-properties file and store all entries inside the default category (general) with the given property name and value. It is meant to be a helper to convert property files into the structure of jConfig. After you have read a property you can use for example the XMLFileHandler to save it in XML form.

Author:
Andreas Mecky , Terry Dye

Constructor Summary
PropertiesFileHandler()
          Default constructor
PropertiesFileHandler(java.io.File file)
          Constructor with File
PropertiesFileHandler(java.lang.String filename)
          Constructor with filename
 
Method Summary
 java.io.File getFile()
          The File that should be "watched" for changes.
 Configuration load(java.lang.String configName)
          This method loads a configuration and returns it
 Configuration load(java.lang.String configurationName, ConfigurationParser parser)
          This method loads a configuration using a specific parser and returns it
 void setFile(java.io.File file)
          This method sets the file that will be processed
 void store(Configuration configuration)
          This method should store all categories and properties.
 
Methods inherited from class org.jconfig.handler.AbstractHandler
addFileListener, fileChanged, fireFireChangedEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesFileHandler

public PropertiesFileHandler()
Default constructor


PropertiesFileHandler

public PropertiesFileHandler(java.lang.String filename)
Constructor with filename

Parameters:
filename -

PropertiesFileHandler

public PropertiesFileHandler(java.io.File file)
Constructor with File

Parameters:
file -
Method Detail

setFile

public void setFile(java.io.File file)
This method sets the file that will be processed

Parameters:
file - the file

load

public Configuration load(java.lang.String configName)
                   throws ConfigurationManagerException
Description copied from interface: ConfigurationHandler
This method loads a configuration and returns it

Parameters:
configName - the name of the configuration
Returns:
the Configuration
Throws:
ConfigurationManagerException

store

public void store(Configuration configuration)
           throws ConfigurationManagerException
This method should store all categories and properties.

Parameters:
configuration - the Configuration that should be saved
Throws:
ConfigurationManagerException

getFile

public java.io.File getFile()
Description copied from class: AbstractHandler
The File that should be "watched" for changes.

Specified by:
getFile in class AbstractHandler
Returns:
The File object
See Also:
AbstractHandler.getFile()

load

public Configuration load(java.lang.String configurationName,
                          ConfigurationParser parser)
                   throws ConfigurationManagerException
Description copied from interface: ConfigurationHandler
This method loads a configuration using a specific parser and returns it

Parameters:
configurationName - the name of the configuration
parser - the parser that should be used
Returns:
the Configuration
Throws:
ConfigurationManagerException


Copyright © 2001-2005 Andreas Mecky, Terry Dye. All Rights Reserved.