org.fuin.kickstart4j
Class ConfigParser

java.lang.Object
  extended by org.fuin.kickstart4j.ConfigParser

public final class ConfigParser
extends Object

Parses a XML configuration.


Constructor Summary
ConfigParser()
          Default constructor.
 
Method Summary
 void copyToConfig(Config config)
          Copies the values from the handler into the config.
static Config create(File configFile)
          Creates an object from a XML configuration file.
static Config create(URL configFileURL)
          Creates an object from a XML configuration file.
static void parse(Config config, File configFile)
          Fills an object from an XML configuration file.
static void parse(Config config, URL configFileURL)
          Fills an object from an XML configuration file.
 void parse(URL url)
          Starts the parsing process.
 void put(Config config, String key, String value)
          Set a property in the configuration by it's name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigParser

public ConfigParser()
Default constructor.

Method Detail

parse

public void parse(URL url)
           throws InvalidConfigException
Starts the parsing process.

Parameters:
url - URL of the XML configuration file.
Throws:
InvalidConfigException - Error parsing the configuration.

copyToConfig

public void copyToConfig(Config config)
                  throws InvalidConfigException
Copies the values from the handler into the config.

Parameters:
config - Configuration to use.
Throws:
InvalidConfigException - Error copying the values.

put

public final void put(Config config,
                      String key,
                      String value)
Set a property in the configuration by it's name. If the key is not known it is ignored.

Parameters:
config - Configuration to populate.
key - Name of the property.
value - Value of the property.

parse

public static void parse(Config config,
                         File configFile)
                  throws InvalidConfigException
Fills an object from an XML configuration file.

Parameters:
config - Configuration to populate.
configFile - Configuration file.
Throws:
InvalidConfigException - Error reading the file.

parse

public static void parse(Config config,
                         URL configFileURL)
                  throws InvalidConfigException
Fills an object from an XML configuration file.

Parameters:
config - Configuration to populate.
configFileURL - URL of the configuration file.
Throws:
InvalidConfigException - Error reading the file.

create

public static Config create(URL configFileURL)
                     throws InvalidConfigException
Creates an object from a XML configuration file.

Parameters:
configFileURL - URL of the configuration file.
Returns:
Configuration filled with values from the file.
Throws:
InvalidConfigException - Error reading the file.

create

public static Config create(File configFile)
                     throws InvalidConfigException
Creates an object from a XML configuration file.

Parameters:
configFile - Configuration file.
Returns:
Configuration filled with values from the file.
Throws:
InvalidConfigException - Error reading the file.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.