|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.JDBCTask
net.sourceforge.addam.impexp.ImportDataTask
public class ImportDataTask
Field Summary | |
---|---|
private int |
batchSize
|
private boolean |
deleteFirst
|
protected File |
dir
|
private List<Tables> |
excludes
|
private List<Tables> |
includes
|
private Script |
post
|
private Script |
pre
|
private boolean |
truncateFirst
|
Fields inherited from class org.apache.tools.ant.Task |
---|
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
project |
Constructor Summary | |
---|---|
ImportDataTask()
|
Method Summary | |
---|---|
void |
addPost(Script script)
used for setting a script to execute after importing data |
void |
addPre(Script script)
used for setting a script to execute before importing data |
private void |
emptyTable(String tableName)
|
void |
execute()
Imports all data from the listed files into the named tables. |
private void |
executeScript(Script script)
|
protected List<String> |
getTableNames()
returns all Tables included by not excluded |
void |
importTable(String tableName,
Connection connection)
Imports all data from the file into the named table. |
void |
setBatchSize(int batchSize)
|
void |
setDeleteFirst(boolean deleteFirst)
|
void |
setDir(File tableDir)
|
void |
setExcludeFile(File tableFile)
this is a shortcut for having a |
void |
setExcludes(String names)
|
void |
setExcludesPattern(String pattern)
|
void |
setIncludeFile(File tableFile)
this is a shortcut for having an |
void |
setIncludes(String names)
|
void |
setIncludesPattern(String pattern)
|
void |
setTruncateFirst(boolean truncateFirst)
|
Methods inherited from class org.apache.tools.ant.taskdefs.JDBCTask |
---|
createClasspath, getClasspath, getConnection, getLoader, getLoaderMap, getPassword, getRdbms, getUrl, getUserId, getVersion, isAutocommit, isCaching, isValidRdbms, setAutocommit, setCaching, setClasspath, setClasspathRef, setDriver, setPassword, setRdbms, setUrl, setUserid, setVersion |
Methods inherited from class org.apache.tools.ant.Task |
---|
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
getProject, setProject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean deleteFirst
private boolean truncateFirst
private Script pre
private Script post
private int batchSize
private final List<Tables> includes
private final List<Tables> excludes
protected File dir
Constructor Detail |
---|
public ImportDataTask()
Method Detail |
---|
public void setDir(File tableDir)
tableDir
- the directory to write the files intopublic void setTruncateFirst(boolean truncateFirst)
truncateFirst
- if true, 'truncateFirst table ' will be executed before
importing new data from a file. the default value is false.public void setDeleteFirst(boolean deleteFirst)
deleteFirst
- if true, 'delete from public void addPre(Script script)
public void addPost(Script script)
public void setBatchSize(int batchSize)
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- if anything goes wrongprivate void executeScript(Script script)
private void emptyTable(String tableName)
public void importTable(String tableName, Connection connection) throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
- if anything goes wrongpublic void setIncludeFile(File tableFile)
tableFile
- a file containing an ordered list of tablespublic void setExcludeFile(File tableFile)
tableFile
- a file containing an ordered list of tablespublic void setIncludesPattern(String pattern)
pattern
- a regexp pattern to compare table names topublic void setExcludesPattern(String pattern)
pattern
- a regexp pattern to compare table names topublic void setIncludes(String names)
names
- a comma separated list of table namespublic void setExcludes(String names)
names
- a comma separated list of table namesprotected List<String> getTableNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |