org.jconfig.handler
Class ScriptHandler

java.lang.Object
  extended byorg.jconfig.handler.ScriptHandler
All Implemented Interfaces:
ConfigurationHandler

public class ScriptHandler
extends java.lang.Object
implements ConfigurationHandler

Configurations can be loaded from many types of files. The ScriptHandler is just another implementation of this. The text file is expected to be called [your_file_name]_config.script. Example "my_config.script". A my_config.script could look like this: variables { basepath = /tmp } category general { hello = world more = words } category special extends general { hello = me more = override } category stuff extends special { my crap = is real crap } You can use the ConfigurationHandler directly: ScriptHandler scriptHandler = new ScriptHandler(); try { Configuration cfg = scriptHandler.load("my"); cfg.getCategory("general").getProperty("hello"); // equals world } catch ( Exception e ) { e.printStackTrace(); }

Author:
Andreas Mecky, Terry Dye

Constructor Summary
ScriptHandler()
          Constructs a ScriptHandler.
 
Method Summary
 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
 void store(Configuration configuration)
          This method is not yet implemented!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptHandler

public ScriptHandler()
Constructs a ScriptHandler. 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

Specified by:
load in interface ConfigurationHandler
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

store

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

Specified by:
store in interface ConfigurationHandler
Parameters:
configuration -
Throws:
ConfigurationManagerException

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

Specified by:
load in interface ConfigurationHandler
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.