net.sourceforge.datagenerator.ant
Class DelegateEntityDefElement

java.lang.Object
  extended bynet.sourceforge.datagenerator.ant.DelegateEntityDefElement

public class DelegateEntityDefElement
extends java.lang.Object

The DelegateEntityDefElement provides an Ant wrapper for creating a EntityDef object from Ant. The EntityDef could be one of three types : GenerateEntityDef, ImportEntityDef and ExportEntityDef. To create a GenerateEntityDef, the setter for the 'target' property should be invoked. To create an ExportEntityDef, the setter for the 'source' property should be invoked with the value 'db'. To create an ImportEntityDef, the setter for the 'source' property should be invoked with any value except 'db'.

Version:
0.69
Author:
Chris Nagy

Field Summary
protected  java.lang.String catalog
          The name of the catalog that contains the table.
protected  java.util.List columnElements
          The list of column def elements.
protected  int count
          The number of rows to generate (used when creating a GenerateEntityDef).
static int DATAGENERATE_ENTITY_DEF
          Constant indicating a GenerateEntityDef.
protected  DelegateDelimiterElement delimiterElement
          The delegate delimiter element.
protected  java.lang.String encoding
          The encoding charset
protected  int entityDefType
          The type of EntityDef to create.
static int EXPORT_ENTITY_DEF
          Constant indicating an ExportEntityDef.
static int IMPORT_ENTITY_DEF
          Constant indicating an ImportEntityDef.
protected  java.util.Map plugins
          The mapping between custom types and implementations.
protected  java.lang.String schema
          The name of the schema that owns the table.
protected  java.io.File source
          The source file (used when creating an ImportEntityDef).
protected  java.lang.String table
          The name of the table.
protected  java.io.File target
          The target file (used when creating a GenerateEntityDef).
static int UNKNOWN_ENTITY_DEF
          Constant indicating that the EntityDef type is unknown.
protected  java.lang.String where
          The where clause (used when creating an ExportEntityDef).
 
Constructor Summary
DelegateEntityDefElement(java.util.Map plugins)
          Constructs an DelegateEntityDefElement with the given mapping between custom types and implementations.
 
Method Summary
 DelegateColumnDefElement createColumn()
          Creates an empty ColumnDefElement and returns it.
 DelegateDelimiterElement createDelimiter()
          Creates an empty DelegateDelimiterDefElement and returns it.
 EntityDef getEntityDef()
          Returns the wrapped entity definition.
 void setCatalog(java.lang.String name)
          Sets the name of the catalog that contains the table.
 void setCount(int count)
          Sets the number of rows to generate
 void setEncoding(java.lang.String encoding)
          Sets the encoding of the source or target file.
 void setSchema(java.lang.String name)
          Sets the name of the schema that owns the table.
 void setSource(java.lang.String source)
          Sets the source.
 void setTable(java.lang.String name)
          Sets the name of the table.
 void setTarget(java.io.File file)
          Sets the target of the generated data.
 void setWhere(java.lang.String where)
          Sets the where clause for an ExportEntityDef.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_ENTITY_DEF

public static final int UNKNOWN_ENTITY_DEF
Constant indicating that the EntityDef type is unknown.

See Also:
Constant Field Values

IMPORT_ENTITY_DEF

public static final int IMPORT_ENTITY_DEF
Constant indicating an ImportEntityDef.

See Also:
Constant Field Values

EXPORT_ENTITY_DEF

public static final int EXPORT_ENTITY_DEF
Constant indicating an ExportEntityDef.

See Also:
Constant Field Values

DATAGENERATE_ENTITY_DEF

public static final int DATAGENERATE_ENTITY_DEF
Constant indicating a GenerateEntityDef.

See Also:
Constant Field Values

plugins

protected java.util.Map plugins
The mapping between custom types and implementations.


entityDefType

protected int entityDefType
The type of EntityDef to create.


schema

protected java.lang.String schema
The name of the schema that owns the table.


catalog

protected java.lang.String catalog
The name of the catalog that contains the table.


table

protected java.lang.String table
The name of the table.


source

protected java.io.File source
The source file (used when creating an ImportEntityDef).


where

protected java.lang.String where
The where clause (used when creating an ExportEntityDef).


count

protected int count
The number of rows to generate (used when creating a GenerateEntityDef).


target

protected java.io.File target
The target file (used when creating a GenerateEntityDef).


encoding

protected java.lang.String encoding
The encoding charset


delimiterElement

protected DelegateDelimiterElement delimiterElement
The delegate delimiter element.


columnElements

protected java.util.List columnElements
The list of column def elements.

Constructor Detail

DelegateEntityDefElement

public DelegateEntityDefElement(java.util.Map plugins)
Constructs an DelegateEntityDefElement with the given mapping between custom types and implementations.

Parameters:
plugins - the plugin mappings
Method Detail

setSchema

public void setSchema(java.lang.String name)
Sets the name of the schema that owns the table.

Parameters:
name - name of the schema

setCatalog

public void setCatalog(java.lang.String name)
Sets the name of the catalog that contains the table.

Parameters:
name - name of the catalog

setTable

public void setTable(java.lang.String name)
Sets the name of the table.

Parameters:
name - name of the table

setSource

public void setSource(java.lang.String source)
Sets the source. If the source is 'db' then the EntityDef created will be an ExportEntityDef. Otherwise the source should be the file name used by an ImportEntityDef.

Parameters:
source - either 'db' or the source file

setWhere

public void setWhere(java.lang.String where)
Sets the where clause for an ExportEntityDef.

Parameters:
where - the where clause

setTarget

public void setTarget(java.io.File file)
Sets the target of the generated data. The EntityDef created will be a GenerateEntityDef.

Parameters:
file - the file containing the generated data.

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the encoding of the source or target file.

Parameters:
encoding - the encoding charset
Since:
0.71

setCount

public void setCount(int count)
Sets the number of rows to generate

Parameters:
count - the number of rows

createColumn

public DelegateColumnDefElement createColumn()
Creates an empty ColumnDefElement and returns it.

Returns:
column definition element

createDelimiter

public DelegateDelimiterElement createDelimiter()
Creates an empty DelegateDelimiterDefElement and returns it.

Returns:
delimiter formatter element

getEntityDef

public EntityDef getEntityDef()
                       throws org.apache.tools.ant.BuildException
Returns the wrapped entity definition.

Returns:
entity definition
Throws:
org.apache.tools.ant.BuildException - if the entity table, delimiter formatter or columns have errors