|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jconfig.handler.ScriptHandler
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(); }
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 |
public ScriptHandler()
Method Detail |
public Configuration load(java.lang.String configurationName) throws ConfigurationManagerException
load
in interface ConfigurationHandler
configurationName
- The name of the file to be found.
ConfigurationManagerException
- thrown if the "_config.script" isn't foundpublic void store(Configuration configuration) throws ConfigurationManagerException
store
in interface ConfigurationHandler
configuration
-
ConfigurationManagerException
public Configuration load(java.lang.String configurationName, ConfigurationParser parser) throws ConfigurationManagerException
ConfigurationHandler
load
in interface ConfigurationHandler
configurationName
- the name of the configurationparser
- the parser that should be used
ConfigurationManagerException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |