net.sourceforge.jdbcexporter
Class Exporter

java.lang.Object
  extended bynet.sourceforge.jdbcexporter.Exporter

public class Exporter
extends java.lang.Object

The Exporter class is the main class that controls the export of data from the database.

Version:
0.6
Author:
Chris Nagy

Field Summary
static java.lang.String COLUMNTRANSLATOR_PREFIX
          Prefix for the column translator type/class mappings to use.
protected  CustomObjectFactory columnTranslatorFactory
          Custom object factory for column translators.
static java.lang.String CONNECTION_PREFIX
          Prefix for the connection config type/class mappings to use.
protected  CustomObjectFactory connectionDefFactory
          Custom object factory for connection definitions.
static java.lang.String DELIMITER_PREFIX
          Prefix for the delimiter formatter type/class mappings to use.
protected  CustomObjectFactory delimiterFormatterFactory
          Custom object factory for delimiter formatters.
protected  java.lang.String engineClassname
          Export engine class name.
protected  ExportDef exportDef
          Export definition.
protected  java.util.List exportListeners
          The list of export listeners.
protected static org.apache.commons.logging.Log LOG
          The log for debug information.
 
Constructor Summary
Exporter()
          Constructs a new exporter.
 
Method Summary
 void addExportListener(ExportListener listener)
          Adds an export listener.
 void beginExport()
          Export data from the database by processing each entity definition via the export engine.
protected  void fireExportEntityEvent(ExportEntityEvent e, boolean start)
          Fire an export entity event to the listeners.
protected  void fireExportEvent(ExportEvent e, boolean start)
          Fire an export event to the listeners.
 void initExportDef(org.xml.sax.InputSource source)
          Read and parse the export config file into an ExportDef class.
 void initPlugins(java.util.Properties pluginProperties)
          Adds the external connection definition classes and delimiter formatter classes to the appropriate factories.
 void initPlugins(java.lang.String pluginFile)
          Parse the plugin property file and adds the external connection definition classes and delimiter formatter classes to the appropriate factories.
static void main(java.lang.String[] args)
           
 void removeExportListener(ExportListener listener)
          Removes an export listener.
 void setEngine(java.lang.String engineClassname)
          Sets the export engine to use.
 void setExportDef(ExportDef exportDef)
          Sets the export def.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.commons.logging.Log LOG
The log for debug information.


CONNECTION_PREFIX

public static final java.lang.String CONNECTION_PREFIX
Prefix for the connection config type/class mappings to use.

See Also:
Constant Field Values

DELIMITER_PREFIX

public static final java.lang.String DELIMITER_PREFIX
Prefix for the delimiter formatter type/class mappings to use.

See Also:
Constant Field Values

COLUMNTRANSLATOR_PREFIX

public static final java.lang.String COLUMNTRANSLATOR_PREFIX
Prefix for the column translator type/class mappings to use.

See Also:
Constant Field Values

connectionDefFactory

protected CustomObjectFactory connectionDefFactory
Custom object factory for connection definitions.


delimiterFormatterFactory

protected CustomObjectFactory delimiterFormatterFactory
Custom object factory for delimiter formatters.


columnTranslatorFactory

protected CustomObjectFactory columnTranslatorFactory
Custom object factory for column translators.


exportDef

protected ExportDef exportDef
Export definition.


engineClassname

protected java.lang.String engineClassname
Export engine class name.


exportListeners

protected java.util.List exportListeners
The list of export listeners.

Constructor Detail

Exporter

public Exporter()
Constructs a new exporter.

Method Detail

setExportDef

public void setExportDef(ExportDef exportDef)
Sets the export def.

Parameters:
exportDef - the export def

initExportDef

public void initExportDef(org.xml.sax.InputSource source)
                   throws java.io.FileNotFoundException,
                          java.io.IOException,
                          javax.xml.parsers.ParserConfigurationException,
                          org.xml.sax.SAXException,
                          org.w3c.dom.DOMException,
                          InvalidCustomObjectDefException
Read and parse the export config file into an ExportDef class.

Parameters:
source - export config file
Throws:
java.io.IOException - if the export config file cannot be opened and read
java.io.FileNotFoundException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
org.w3c.dom.DOMException
InvalidCustomObjectDefException

initPlugins

public void initPlugins(java.lang.String pluginFile)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Parse the plugin property file and adds the external connection definition classes and delimiter formatter classes to the appropriate factories.

Parameters:
pluginFile - plugin property file
Throws:
java.io.FileNotFoundException - if the plugin file cannot be found
java.io.IOException - if the plugin file cannot be opened and read

initPlugins

public void initPlugins(java.util.Properties pluginProperties)
Adds the external connection definition classes and delimiter formatter classes to the appropriate factories.

Parameters:
pluginProperties - the plugin properties

setEngine

public void setEngine(java.lang.String engineClassname)
Sets the export engine to use.

Parameters:
engineClassname - the classname of the export engine

beginExport

public void beginExport()
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Export data from the database by processing each entity definition via the export engine.

Throws:
java.io.FileNotFoundException - if the log file is not valid
java.io.IOException - if the log file cannot be opened and written to

addExportListener

public void addExportListener(ExportListener listener)
Adds an export listener.

Parameters:
listener - an export listener

removeExportListener

public void removeExportListener(ExportListener listener)
Removes an export listener.

Parameters:
listener - an export listener

fireExportEvent

protected void fireExportEvent(ExportEvent e,
                               boolean start)
Fire an export event to the listeners.

Parameters:
e - the export event
start - true if the export is starting and false if the export is finished

fireExportEntityEvent

protected void fireExportEntityEvent(ExportEntityEvent e,
                                     boolean start)
Fire an export entity event to the listeners.

Parameters:
e - the export entity event
start - true if the export of the entity is starting and false if the export of the entity is finished

main

public static void main(java.lang.String[] args)