|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.datagenerator.EntityGenerator
The EntityGenerator generates data for all the given entities. It manages the dependencies between each entity.
Field Summary | |
protected static org.apache.commons.logging.Log |
LOG
The log for debug information. |
Constructor Summary | |
EntityGenerator()
|
Method Summary | |
void |
addDataGeneratorListener(DataGeneratorListener listener)
Adds a data generator listener. |
void |
buildDependencyMap(GenerateEntityDef[] entities)
Build the dependency map between entities. |
protected void |
deleteRowFromDisk(java.lang.String entityName,
int row)
Delete a given row from temporary storage. |
protected void |
fillInColumnTypes(EntityDef entityDef)
Fill in the column SQL Types that are missing. |
protected ColumnValue[] |
fillInValues(EntityDef entityDef,
ColumnValue[] values)
Returns the transformed column values. |
protected net.sourceforge.datagenerator.GenerateColumnState |
findColumn(net.sourceforge.datagenerator.GenerateEntityState entityState,
java.lang.String columnName)
Find the state of the column's generation of data. |
protected void |
fireDataGeneratorEntityEvent(DataGeneratorEntityEvent e)
Fire a data generator entity event to the listeners. |
protected void |
fireDataGeneratorRowEvent(DataGeneratorRowEvent e)
Fire a data generator row event to the listeners. |
protected int |
loadExportSourceValues(net.sourceforge.datagenerator.GenerateEntityState entityState)
Load the source values for a given entity from the database. |
protected int |
loadImportSourceValues(net.sourceforge.datagenerator.GenerateEntityState entityState)
Load the source values for a given entity from a file. |
protected void |
loadSourceValues(net.sourceforge.datagenerator.GenerateColumnState state)
Load the source values for a given column. |
void |
processEntities(GenerateEntityDef[] entities)
Process the given entity definitions. |
protected void |
processEntity(net.sourceforge.datagenerator.GenerateEntityState entityState,
boolean readFromTmp)
Process the current entity state by generating data for the columns. |
protected void |
readRowFromDisk(java.lang.String entityName,
int row,
ColumnValue[] values)
Read a given row to from a temporary file. |
void |
removeDataGeneratorListener(DataGeneratorListener listener)
Removes a data generator listener. |
void |
setConnection(java.sql.Connection con)
Set the connection. |
void |
setSourceEntities(EntityDef[] entities)
Sets the source entities whose data will be used to fill dependent column values. |
protected void |
writeRowToDisk(java.lang.String entityName,
int row,
ColumnValue[] values)
Write a given row to a temporary file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static org.apache.commons.logging.Log LOG
Constructor Detail |
public EntityGenerator()
Method Detail |
public void setConnection(java.sql.Connection con)
con
- the connectionpublic void setSourceEntities(EntityDef[] entities)
entities
- the list of entitiespublic void buildDependencyMap(GenerateEntityDef[] entities)
entities
- the entity definitionsprotected net.sourceforge.datagenerator.GenerateColumnState findColumn(net.sourceforge.datagenerator.GenerateEntityState entityState, java.lang.String columnName)
entityState
- the entity state that is requesting the statecolumnName
- the name of the column (could be fully qualified or local to the given entity state)
public void processEntities(GenerateEntityDef[] entities)
entities
- the entity definitionspublic void addDataGeneratorListener(DataGeneratorListener listener)
listener
- the listenerpublic void removeDataGeneratorListener(DataGeneratorListener listener)
listener
- the listenerprotected void fireDataGeneratorRowEvent(DataGeneratorRowEvent e)
e
- the data generator row eventprotected void fireDataGeneratorEntityEvent(DataGeneratorEntityEvent e)
e
- the data generator entity eventprotected void processEntity(net.sourceforge.datagenerator.GenerateEntityState entityState, boolean readFromTmp)
entityState
- the current entity statereadFromTmp
- whether to read the already generated column values from a
tmp file.protected void loadSourceValues(net.sourceforge.datagenerator.GenerateColumnState state)
state
- The column's stateprotected int loadImportSourceValues(net.sourceforge.datagenerator.GenerateEntityState entityState) throws java.sql.SQLException, java.io.IOException
entityState
- the entity's state
java.sql.SQLException
- thrown if the db column translators could not be setup or cleaned up
java.io.IOException
- thrown if the file could not be parsed properlyprotected int loadExportSourceValues(net.sourceforge.datagenerator.GenerateEntityState entityState) throws java.sql.SQLException
entityState
- the entity's state
java.sql.SQLException
- thrown if the data could not be retrieved from the databaseprotected void deleteRowFromDisk(java.lang.String entityName, int row)
entityName
- the name of the entityrow
- the row numberprotected void writeRowToDisk(java.lang.String entityName, int row, ColumnValue[] values)
entityName
- the name of the entityrow
- the row numbervalues
- the valuesprotected void readRowFromDisk(java.lang.String entityName, int row, ColumnValue[] values)
entityName
- the name of the entityrow
- the row numbervalues
- the values to read intoprotected void fillInColumnTypes(EntityDef entityDef) throws java.sql.SQLException
entityDef
- the entity definition
java.sql.SQLException
- thrown if the SQL Types could not be retrievedprotected ColumnValue[] fillInValues(EntityDef entityDef, ColumnValue[] values) throws MalformedDataException
entityDef
- the entity definitionvalues
- the rows' values
MalformedDataException
- if the rows' values are incorrect
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |