net.sourceforge.datagenerator
Class DataGenerator

java.lang.Object
  extended bynet.sourceforge.datagenerator.DataGenerator

public class DataGenerator
extends java.lang.Object

The DataGenerator class is the main class that controls the generation of data.

Version:
0.6
Author:
Chris Nagy

Field Summary
protected  CustomObjectFactory binaryDelimiterParserFactory
          The factory for producing binary delimiter parsers.
static java.lang.String COLUMNTRANSLATOR_PREFIX
          Prefix for the column translator classes to use.
protected  CustomObjectFactory columnTranslatorFactory
          The factory for producing column translators.
protected  CustomObjectFactory columnValueGeneratorFactory
          The factory for producing column value generators.
static java.lang.String CONNECTION_PREFIX
          Prefix for the connection definition classes to use.
protected  CustomObjectFactory connectionDefFactory
          The factory for producing connection definitions.
protected  java.util.List dataGeneratorListeners
          The event listeners.
static java.lang.String DELIMITER_PARSER_PREFIX
          Prefix for the delimiter parser classes to use.
static java.lang.String DELIMITER_PREFIX
          Prefix for the delimiter formatter classes to use.
protected  CustomObjectFactory delimiterFormatterFactory
          The factory for producing delimiter formatters.
protected  CustomObjectFactory delimiterParserFactory
          The factory for producing delimiter parsers.
protected  GenerateDef generateDef
          The data generation definition.
static java.lang.String GENERATOR_PREFIX
          Prefix for the column value generator classes to use.
protected static org.apache.commons.logging.Log LOG
          The log for debug information.
 
Constructor Summary
DataGenerator()
          Constructs a new data generator with the default mappings.
 
Method Summary
 void addDataGeneratorListener(DataGeneratorListener listener)
          Adds a data generator listener.
 void beginGenerate()
          Generate data by processing entity definitions via the entity generator.
protected  void fireDataGeneratorEvent(DataGeneratorEvent e, boolean start)
          Fire a data generator event to the event listeners.
 void initGenerateDef(org.xml.sax.InputSource source)
          Read and parses the generate config file into a GenerateDef class.
protected  void initPlugins(java.util.Properties pluginProperties)
          Adds the external connection definition classes, delimiter formatter, delimiter parsers, column value generator, and column translator classes to the appropriate factories.
 void initPlugins(java.lang.String pluginFile)
          Parse the plugin property file and adds the external connection definition classes, delimiter formatter and column value generator classes to the appropriate factories.
static void main(java.lang.String[] args)
           
 void removeDataGeneratorListener(DataGeneratorListener listener)
          Removes a data generator listener.
 void setGenerateDef(GenerateDef def)
          Sets the generate def.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.commons.logging.Log LOG
The log for debug information.


CONNECTION_PREFIX

public static final java.lang.String CONNECTION_PREFIX
Prefix for the connection definition classes to use.

See Also:
Constant Field Values

DELIMITER_PREFIX

public static final java.lang.String DELIMITER_PREFIX
Prefix for the delimiter formatter classes to use.

See Also:
Constant Field Values

DELIMITER_PARSER_PREFIX

public static final java.lang.String DELIMITER_PARSER_PREFIX
Prefix for the delimiter parser classes to use.

See Also:
Constant Field Values

GENERATOR_PREFIX

public static final java.lang.String GENERATOR_PREFIX
Prefix for the column value generator classes to use.

See Also:
Constant Field Values

COLUMNTRANSLATOR_PREFIX

public static final java.lang.String COLUMNTRANSLATOR_PREFIX
Prefix for the column translator classes to use.

See Also:
Constant Field Values

connectionDefFactory

protected CustomObjectFactory connectionDefFactory
The factory for producing connection definitions.


delimiterFormatterFactory

protected CustomObjectFactory delimiterFormatterFactory
The factory for producing delimiter formatters.


delimiterParserFactory

protected CustomObjectFactory delimiterParserFactory
The factory for producing delimiter parsers.


binaryDelimiterParserFactory

protected CustomObjectFactory binaryDelimiterParserFactory
The factory for producing binary delimiter parsers.

Since:
0.74

columnValueGeneratorFactory

protected CustomObjectFactory columnValueGeneratorFactory
The factory for producing column value generators.


columnTranslatorFactory

protected CustomObjectFactory columnTranslatorFactory
The factory for producing column translators.


generateDef

protected GenerateDef generateDef
The data generation definition.


dataGeneratorListeners

protected java.util.List dataGeneratorListeners
The event listeners.

Constructor Detail

DataGenerator

public DataGenerator()
Constructs a new data generator with the default mappings.

Method Detail

setGenerateDef

public void setGenerateDef(GenerateDef def)
Sets the generate def.

Parameters:
def - generate def

initGenerateDef

public void initGenerateDef(org.xml.sax.InputSource source)
                     throws java.io.IOException,
                            javax.xml.parsers.ParserConfigurationException,
                            org.xml.sax.SAXException,
                            org.w3c.dom.DOMException,
                            InvalidCustomObjectDefException
Read and parses the generate config file into a GenerateDef class.

Parameters:
source - input source
Throws:
java.io.IOException - if the file could not be read
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
org.w3c.dom.DOMException
InvalidCustomObjectDefException

initPlugins

public void initPlugins(java.lang.String pluginFile)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Parse the plugin property file and adds the external connection definition classes, delimiter formatter and column value generator classes to the appropriate factories.

Parameters:
pluginFile - plugin property file
Throws:
java.io.FileNotFoundException - if the plugin file cannot be found
java.io.IOException - if the plugin file cannot be opened and read

initPlugins

protected void initPlugins(java.util.Properties pluginProperties)
Adds the external connection definition classes, delimiter formatter, delimiter parsers, column value generator, and column translator classes to the appropriate factories.

Parameters:
pluginProperties - the set of plugins

beginGenerate

public void beginGenerate()
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Generate data by processing entity definitions via the entity generator.

Throws:
java.io.FileNotFoundException - if the log file is not valid
java.io.IOException - if the log file file cannot be opened and written to

fireDataGeneratorEvent

protected void fireDataGeneratorEvent(DataGeneratorEvent e,
                                      boolean start)
Fire a data generator event to the event listeners.

Parameters:
e - the event
start - true if the data generation started

addDataGeneratorListener

public void addDataGeneratorListener(DataGeneratorListener listener)
Adds a data generator listener.

Parameters:
listener - the listener

removeDataGeneratorListener

public void removeDataGeneratorListener(DataGeneratorListener listener)
Removes a data generator listener.

Parameters:
listener - the listener

main

public static void main(java.lang.String[] args)