irssibot.config
Class ConfigParser

java.lang.Object
  |
  +--irssibot.config.ConfigParser

public class ConfigParser
extends java.lang.Object

Confiduration file parser.

Version:
$Name: $ $Revision: 1.12 $
Author:
Matti Dahlbom

Field Summary
private  java.util.ArrayList databases
          List of database descriptors
private  java.lang.String dateFormatString
          Logging date format string
private  java.util.Vector initialModules
          List of modules to load at bot startup
private  CommonLog log
          Logger
private  java.lang.String moduleBaseDir
          Module base dir
private  java.util.Vector serverInstances
          List of server instances
 
Constructor Summary
ConfigParser(java.lang.String configFileName)
          Constructs.
 
Method Summary
 java.util.ArrayList getDatabases()
          Returns database descriptors.
 java.lang.String getDateFormatString()
          Returns date format string.
 java.util.Vector getInitialModules()
          Return initial modules list.
 java.util.Vector getInstanceData()
          Returns server instance descriptors.
 CommonLog getLog()
          Returns logger.
 java.lang.String getModuleBaseDir()
          Returns the module base dir.
private  void handleDatabaseNode(org.w3c.dom.Node node)
          Reads database information.
private  void handleGeneralNode(org.w3c.dom.Node node)
          Parse general information.
private  void handleServerInstanceNode(org.w3c.dom.Node node)
          Create and init a new server instance.
private  void parse(org.w3c.dom.Node node)
          Parses the DOM document representing the config file.
private  org.w3c.dom.Node readConfigFile(java.lang.String configFileName)
          Reads config file and generates a DOM document out of it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private CommonLog log
Logger


dateFormatString

private java.lang.String dateFormatString
Logging date format string


initialModules

private java.util.Vector initialModules
List of modules to load at bot startup


serverInstances

private java.util.Vector serverInstances
List of server instances


databases

private java.util.ArrayList databases
List of database descriptors


moduleBaseDir

private java.lang.String moduleBaseDir
Module base dir

Constructor Detail

ConfigParser

public ConfigParser(java.lang.String configFileName)
             throws java.io.IOException
Constructs.

Parameters:
configFileName - config file name
Throws:
java.io.IOException - if reading the config file fails
Method Detail

readConfigFile

private org.w3c.dom.Node readConfigFile(java.lang.String configFileName)
                                 throws java.io.IOException
Reads config file and generates a DOM document out of it.

Parameters:
configFileName - config file name
Returns:
contents of the config file
Throws:
java.io.IOException - if reading the config file fails

handleDatabaseNode

private void handleDatabaseNode(org.w3c.dom.Node node)
Reads database information.

Parameters:
node - database node

handleGeneralNode

private void handleGeneralNode(org.w3c.dom.Node node)
Parse general information.

Parameters:
node - server-instance node

handleServerInstanceNode

private void handleServerInstanceNode(org.w3c.dom.Node node)
Create and init a new server instance.

Parameters:
node - server-instance node

parse

private void parse(org.w3c.dom.Node node)
Parses the DOM document representing the config file.

Parameters:
node - document root node

getDatabases

public java.util.ArrayList getDatabases()
Returns database descriptors.


getInitialModules

public java.util.Vector getInitialModules()
Return initial modules list.


getInstanceData

public java.util.Vector getInstanceData()
Returns server instance descriptors.


getLog

public CommonLog getLog()
Returns logger.


getDateFormatString

public java.lang.String getDateFormatString()
Returns date format string.


getModuleBaseDir

public java.lang.String getModuleBaseDir()
Returns the module base dir.



IrssiBot (c) 2000-2002 Matti Dahlbom