|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jdbcimporter.Importer
The Importer class is the main class that controls the import of data to the database.
Field Summary | |
protected CustomObjectFactory |
binaryDelimiterParserFactory
Custom object factory used to create binary delimiter parsers. |
static java.lang.String |
COLUMNTRANSLATOR_PREFIX
Prefix for the column translator type to class in the custom properties. |
protected CustomObjectFactory |
columnTranslatorFactory
Custom object factory used to create column translators. |
protected CustomObjectFactory |
columnValueGeneratorFactory
Custom object factory used to create column generators. |
static java.lang.String |
CONNECTION_PREFIX
Prefix for the connection definition type to class in the custom properties. |
protected CustomObjectFactory |
connectionDefFactory
Custom object factory used to create connection definitions. |
static java.lang.String |
DELIMITER_PREFIX
Prefix for the delimiter parser type to class in the custom properties. |
protected CustomObjectFactory |
delimiterParserFactory
Custom object factory used to create delimiter parsers. |
protected java.lang.String |
engineClassname
The import engine classname. |
protected boolean |
failOnError
Flag indicating that the import should stop on the first error (default is false). |
static java.lang.String |
GENERATOR_PREFIX
Prefix for the column value generator classes to use. |
protected ImportDef |
importDef
The import definition. |
protected boolean |
importFailed
Flag indicating that the import failed and the fail on error flag is set to true. |
protected java.util.List |
importListeners
The list of import listeners. |
protected static org.apache.commons.logging.Log |
LOG
The log for debug information. |
static java.lang.String |
ROWTRANSLATOR_PREFIX
Prefix for the row translator type to class in the custom properties. |
protected CustomObjectFactory |
rowTranslatorFactory
Custom object factory used to create row translators. |
Constructor Summary | |
Importer()
Constructs a new importer. |
Method Summary | |
void |
addImportListener(ImportListener listener)
Adds an import listener. |
void |
beginImport()
Import data into the database by processing each entity definition via the import engine. |
protected void |
executeSQLFile(java.sql.Connection connection,
java.io.File SQLFile)
Execute a series of sql statements stored in a file. |
protected void |
fireImportEntityEvent(ImportEntityEvent e,
boolean start)
Fire an import entity event to the listeners. |
protected void |
fireImportEvent(ImportEvent e,
boolean start)
Fire an import event to the listeners. |
ImportDef |
getImportDef()
Returns the ImportDef. |
boolean |
hasImportFailed()
Returns the flag indicating that the import failed. |
void |
initImportDef(org.xml.sax.InputSource input)
Read and parse the import config file into an ImportDef class. |
void |
initPlugins(java.util.Properties pluginProperties)
Initialize the plugin mappings. |
void |
initPlugins(java.lang.String pluginFile)
Parse the plugin property file and adds the external connection definition config classes and delimiter parser config classes to the appropriate factories. |
static void |
main(java.lang.String[] args)
|
void |
removeImportListener(ImportListener listener)
Removes an import listener. |
void |
setEngine(java.lang.String engineClassname)
Sets the import engine to use. |
void |
setFailonerror(boolean flag)
Sets a flag to indicate that the import should stop after the first error. |
void |
setImportDef(ImportDef importDef)
Sets the ImportDef. |
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
public static final java.lang.String CONNECTION_PREFIX
public static final java.lang.String DELIMITER_PREFIX
public static final java.lang.String COLUMNTRANSLATOR_PREFIX
public static final java.lang.String GENERATOR_PREFIX
public static final java.lang.String ROWTRANSLATOR_PREFIX
protected CustomObjectFactory connectionDefFactory
protected CustomObjectFactory delimiterParserFactory
protected CustomObjectFactory binaryDelimiterParserFactory
protected CustomObjectFactory columnTranslatorFactory
protected CustomObjectFactory columnValueGeneratorFactory
protected CustomObjectFactory rowTranslatorFactory
protected ImportDef importDef
protected java.lang.String engineClassname
protected java.util.List importListeners
protected boolean failOnError
protected boolean importFailed
Constructor Detail |
public Importer()
Method Detail |
public void setImportDef(ImportDef importDef)
importDef
- import defpublic void setFailonerror(boolean flag)
flag
- flagpublic boolean hasImportFailed()
public void initImportDef(org.xml.sax.InputSource input) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, org.w3c.dom.DOMException, InvalidCustomObjectDefException
input
- import config as xml
java.io.IOException
- if the import config cannot be read
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
org.w3c.dom.DOMException
InvalidCustomObjectDefException
public ImportDef getImportDef()
public void initPlugins(java.lang.String pluginFile) throws java.io.FileNotFoundException, java.io.IOException
pluginFile
- plugin property file
java.io.FileNotFoundException
- if the plugin file cannot be found
java.io.IOException
- if the plugin file cannot be opened and readpublic void initPlugins(java.util.Properties pluginProperties)
pluginProperties
- the defined plugin mappingspublic void setEngine(java.lang.String engineClassname)
engineClassname
- the classname of the import enginepublic void beginImport() throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
- if the log file or bad log file is not valid
java.io.IOException
- if the log file or bad log file cannot be opened and written topublic void addImportListener(ImportListener listener)
listener
- an import listenerpublic void removeImportListener(ImportListener listener)
listener
- an import listenerprotected void fireImportEvent(ImportEvent e, boolean start)
e
- the import eventstart
- true if the import is starting and false if the import is finishedprotected void fireImportEntityEvent(ImportEntityEvent e, boolean start)
e
- the import entity eventstart
- true if the import of the entity is starting and false if the
import of the entity is finishedprotected void executeSQLFile(java.sql.Connection connection, java.io.File SQLFile)
connection
- The JDBC ConnectionSQLFile
- The file containing sql statementspublic static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |