net.sourceforge.datagenerator.config
Class GenerateEntityConfigDelegate

java.lang.Object
  extended bynet.sourceforge.datagenerator.config.GenerateEntityConfigDelegate
All Implemented Interfaces:
EntityConfigDelegate

public class GenerateEntityConfigDelegate
extends java.lang.Object
implements EntityConfigDelegate

The GenerateEntityConfigDelegate constructs GenerateEntityDef and GenerateColumnDef from the Node objects.

Version:
0.6
Author:
Chris Nagy

Field Summary
static java.lang.String COLUMN_VALUE_GENERATOR_TAG
          The element name that contains the column value generator definiton.
static java.lang.String COLUMN_VALUE_GENERATOR_TYPE_ATTR
          The attribute name in the COLUMN_VALUE_GENERATOR_TAG element that contains the column value generator type.
protected  CustomObjectFactory columnValueGeneratorFactory
          The custom object factory that can create ColumnValueGenerator from column value generator types.
static java.lang.String COUNT_ATTR
          The attribute name that contains the number of rows that will be generated.
static java.lang.String DELIMITER_TAG
          The element name that contains the delimiter formatter definition.
static java.lang.String DELIMITER_TYPE_ATTR
          The attribute name in the DELIMITER_TAG element that contains contains the delimiter formatter type.
protected  CustomObjectFactory delimiterFormatterFactory
          The custom object factory that can create DelimiterFormatters from delimiter formatter types.
static java.lang.String TARGET_ATTR
          The attribute name that contains the name of data file that will contain the data generated.
static java.lang.String TARGET_ENCODING_ATTR
          The attribute name that contains the encoding of the target file.
 
Constructor Summary
GenerateEntityConfigDelegate()
           
 
Method Summary
 ColumnDef createColumnDef(org.w3c.dom.Node node)
          Create a ColumnDef from the given node and apply any custom attributes.
 EntityDef createEntityDef(org.w3c.dom.Node node)
          Create an EntityDef from the given node and apply any custom attributes.
protected  void initDelimiter(GenerateEntityDef entityDef, org.w3c.dom.Node delimiter)
          Load the delimiter formatter defined in the given node into the GenerateEntityDef.
 void setColumnValueGeneratorFactory(CustomObjectFactory factory)
          Set the custom object factory for creating column value generators.
 void setDelimiterFormatterFactory(CustomObjectFactory factory)
          Set the custom object factory for creating delimiter formatters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TARGET_ATTR

public static final java.lang.String TARGET_ATTR
The attribute name that contains the name of data file that will contain the data generated.

See Also:
Constant Field Values

TARGET_ENCODING_ATTR

public static final java.lang.String TARGET_ENCODING_ATTR
The attribute name that contains the encoding of the target file.

See Also:
Constant Field Values

COUNT_ATTR

public static final java.lang.String COUNT_ATTR
The attribute name that contains the number of rows that will be generated.

See Also:
Constant Field Values

DELIMITER_TAG

public static final java.lang.String DELIMITER_TAG
The element name that contains the delimiter formatter definition.

See Also:
Constant Field Values

DELIMITER_TYPE_ATTR

public static final java.lang.String DELIMITER_TYPE_ATTR
The attribute name in the DELIMITER_TAG element that contains contains the delimiter formatter type.

See Also:
Constant Field Values

COLUMN_VALUE_GENERATOR_TAG

public static final java.lang.String COLUMN_VALUE_GENERATOR_TAG
The element name that contains the column value generator definiton.

See Also:
Constant Field Values

COLUMN_VALUE_GENERATOR_TYPE_ATTR

public static final java.lang.String COLUMN_VALUE_GENERATOR_TYPE_ATTR
The attribute name in the COLUMN_VALUE_GENERATOR_TAG element that contains the column value generator type.

See Also:
Constant Field Values

delimiterFormatterFactory

protected CustomObjectFactory delimiterFormatterFactory
The custom object factory that can create DelimiterFormatters from delimiter formatter types.


columnValueGeneratorFactory

protected CustomObjectFactory columnValueGeneratorFactory
The custom object factory that can create ColumnValueGenerator from column value generator types.

Constructor Detail

GenerateEntityConfigDelegate

public GenerateEntityConfigDelegate()
Method Detail

createEntityDef

public EntityDef createEntityDef(org.w3c.dom.Node node)
                          throws org.w3c.dom.DOMException,
                                 InvalidCustomObjectDefException
Description copied from interface: EntityConfigDelegate
Create an EntityDef from the given node and apply any custom attributes. The following are standard attributes that are applied by the EntityConfig: catalog, schema, table.

Specified by:
createEntityDef in interface EntityConfigDelegate
Parameters:
node - the element node with the name 'entity'
Returns:
the EntityDef
Throws:
InvalidCustomObjectDefException - if the custom EntityDef could not be created
org.w3c.dom.DOMException - if any custom attributes are missing or invalid
See Also:
EntityConfigDelegate.createEntityDef(org.w3c.dom.Node)

createColumnDef

public ColumnDef createColumnDef(org.w3c.dom.Node node)
                          throws org.w3c.dom.DOMException,
                                 InvalidCustomObjectDefException
Description copied from interface: EntityConfigDelegate
Create a ColumnDef from the given node and apply any custom attributes. The following are standard attributes that are applied by the EntityConfig: name, SQLType, format, default.

Specified by:
createColumnDef in interface EntityConfigDelegate
Parameters:
node - the element node with the name 'column'
Returns:
the ColumnDef
Throws:
org.w3c.dom.DOMException - if any custom attributes are missing or invalid
InvalidCustomObjectDefException - if the custom ColumnDef could not be created
See Also:
EntityConfigDelegate.createColumnDef(org.w3c.dom.Node)

setColumnValueGeneratorFactory

public void setColumnValueGeneratorFactory(CustomObjectFactory factory)
Set the custom object factory for creating column value generators.

Parameters:
factory - the column value generator factory

setDelimiterFormatterFactory

public void setDelimiterFormatterFactory(CustomObjectFactory factory)
Set the custom object factory for creating delimiter formatters.

Parameters:
factory - the delimiter formatter factory

initDelimiter

protected void initDelimiter(GenerateEntityDef entityDef,
                             org.w3c.dom.Node delimiter)
                      throws org.w3c.dom.DOMException,
                             InvalidCustomObjectDefException
Load the delimiter formatter defined in the given node into the GenerateEntityDef.

Parameters:
entityDef - the generate entity definition
delimiter - the node containing the delimiter formatter definition.
Throws:
org.w3c.dom.DOMException - if the node is invalid
InvalidCustomObjectDefException - if the delimiter formatter could not be created by the delimiter formatter factory