com.zphinx.spine.start.helpers
Class AbstractConfigHelper

java.lang.Object
  extended by com.zphinx.spine.start.helpers.AbstractConfigHelper
Direct Known Subclasses:
ConfigReader, ConfigurationHelper, RoleConfigHelper

public abstract class AbstractConfigHelper
extends Object

AbstractConfigHelper serves as a base helper for objects which read data from an xml configuration file

Version:
$1.0

Copyright ©Zphinx Software Solutions

Author:
David Ladapo

Field Summary
protected  HashMap hash
          A HashMap used to temporarily store our configuration data
 
Constructor Summary
AbstractConfigHelper()
          Public Constructor
 
Method Summary
 HashMap createConfig(String fileName)
          Create the configuration objects from the configuration Filename given.
 HashMap createConfig(String fileName, boolean validating, boolean nameSpaceAware)
          Create the configuration objects from the configuration Filename given.
protected  String getNodeData(Node node)
          Gets the value of the node data
protected  void loopChildNodes(Node node)
          Loops through the child nodes of this node
protected abstract  void readNodeTypes(Node node, int type)
          Reads the different types of nodes e.g Element node
protected  void recurseNodeTree(Node node)
          Reads a node for it's sub nodes and creates our requisite objects
abstract  void resetHelper()
          Resets the helper variables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hash

protected HashMap hash
A HashMap used to temporarily store our configuration data

Constructor Detail

AbstractConfigHelper

public AbstractConfigHelper()
Public Constructor

Method Detail

createConfig

public HashMap createConfig(String fileName)
Create the configuration objects from the configuration Filename given. This must be the full path to the configuration file

Parameters:
fileName - The full name and path to the configuration file
Returns:
The Hashmap created from the contents of the configuration

createConfig

public HashMap createConfig(String fileName,
                            boolean validating,
                            boolean nameSpaceAware)
Create the configuration objects from the configuration Filename given. This must be the full path to the configuration file

Parameters:
fileName - The full name and path to the configuration file
validating - A boolean indicating if this xml file should be validated
nameSpaceAware - A boolean indicating if this xml file should be set to nameSpaceAware
Returns:
The Hashmap created from the contents of the configuration

recurseNodeTree

protected void recurseNodeTree(Node node)
                        throws Throwable
Reads a node for it's sub nodes and creates our requisite objects

Parameters:
node - A method to recurse through the xml node
Throws:
Throwable

readNodeTypes

protected abstract void readNodeTypes(Node node,
                                      int type)
                               throws NumberFormatException,
                                      Throwable
Reads the different types of nodes e.g Element node

Parameters:
node - The node to read
type - The type of node to be read e.g Node.ELEMENT_NODE
Throws:
NumberFormatException
Throwable

loopChildNodes

protected void loopChildNodes(Node node)
                       throws Throwable
Loops through the child nodes of this node

Parameters:
node - The node whose children will be read
Throws:
Throwable

resetHelper

public abstract void resetHelper()
Resets the helper variables


getNodeData

protected String getNodeData(Node node)
Gets the value of the node data

Parameters:
node - The node to examine
Returns:
The String value of this node