org.jconfig.handler
Class SimpleScriptHandler

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

public class SimpleScriptHandler
extends AbstractHandler

The SimpleScriptHandler will read in a text file. The file should be anntotated where every line containing properties should start with either spaces or tabs. Every other line is considered as category.
Example:

 basic:
   prop1: hello
   prop2: world
   
 more:
   simple_one: 1 

Author:
Andreas Mecky, Terry Dye

Constructor Summary
SimpleScriptHandler()
          Constructs a SimpleScriptHandler.
 
Method Summary
 java.io.File getFile()
          The File that should be "watched" for changes.
protected  java.util.SortedMap getSortedProperties(java.lang.String categoryName, Configuration configuration)
           
 Configuration load(java.lang.String configurationName)
          This method loads all files that are found ending with "_config.script".
 Configuration load(java.lang.String configurationName, ConfigurationParser parser)
          This method loads a configuration using a specific parser and returns it
 Configuration load(java.lang.String configurationName, java.io.InputStream is)
           
 Configuration load(java.lang.String configurationName, java.lang.String fileName)
           
 void store(Configuration configuration)
          This method is not yet implemented!
 
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

SimpleScriptHandler

public SimpleScriptHandler()
Constructs a SimpleScriptHandler. Nothing special happens during construction.

Method Detail

load

public Configuration load(java.lang.String configurationName)
                   throws ConfigurationManagerException
This method loads all files that are found ending with "_config.script". Example: my_config.script

Parameters:
configurationName - The name of the file to be found.
Returns:
The configured/loaded Configuration
Throws:
ConfigurationManagerException - thrown if the "_config.script" isn't found

load

public Configuration load(java.lang.String configurationName,
                          java.lang.String fileName)
                   throws ConfigurationManagerException
Throws:
ConfigurationManagerException

load

public Configuration load(java.lang.String configurationName,
                          java.io.InputStream is)
                   throws ConfigurationManagerException
Throws:
ConfigurationManagerException

store

public void store(Configuration configuration)
           throws ConfigurationManagerException
This method is not yet implemented!

Parameters:
configuration -
Throws:
ConfigurationManagerException

getSortedProperties

protected java.util.SortedMap getSortedProperties(java.lang.String categoryName,
                                                  Configuration configuration)

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

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.