net.sourceforge.jdbcexporter.config
Class ExportEntityConfigDelegate

java.lang.Object
  extended bynet.sourceforge.jdbcexporter.config.ExportEntityConfigDelegate
All Implemented Interfaces:
EntityConfigDelegate

public class ExportEntityConfigDelegate
extends java.lang.Object
implements EntityConfigDelegate

The ExportEntityConfigDelegate constructs ExportEntityDef and ExportColumnDef from the Node objects.

Version:
0.6
Author:
Chris Nagy

Field Summary
static java.lang.String COLUMN_TRANSLATOR_ATTR
          The attribute name that contains the ColumnTranslator classname to use on all column values to be exported.
static java.lang.String COLUMN_TRANSLATOR_TAG
          The element name that contains the ColumnTranslator definition.
static java.lang.String COLUMN_TRANSLATOR_TYPE_ATTR
          The attribute name in the COLUMN_TRANSLATOR_TAG element that contains the column translator type.
protected  CustomObjectFactory columnTranslatorFactory
          The custom object factory that can create ColumnTranslators from column translator types.
static java.lang.String DELIMITER_TAG
          The element name that contains the DelimiterFormatter definition.
static java.lang.String DELIMITER_TYPE_ATTR
          The attribute name in the DELIMITER_TAG element that contains contains the delimiter type.
protected  CustomObjectFactory delimiterFormatterFactory
          The custom object factory that can create DelimiterFormatters from delimiter formatter types.
protected  boolean delimiterMandatory
          Flag indicating that the 'delimiter' child element is mandatory (default true).
static java.lang.String EXPORT_ENGINE_ATTR
          The element name that contains the class name of export engine used to export this entity.
protected static org.apache.commons.logging.Log LOG
          The log for debug information.
static java.lang.String TARGET_ATTR
          The attribute name that contains the name of data file that will contain the data exported.
static java.lang.String TARGET_ENCODING_ATTR
          The attribute name that contains the encoding of the target file.
protected  boolean targetMandatory
          Flag indicating that the 'target' attribute is mandatory (default true).
static java.lang.String WHERE_CLAUSE_ATTR
          The attribute name that contains the where clause for the sql select statement.
 
Constructor Summary
ExportEntityConfigDelegate()
          Creates an ExportEntityConfigDelegate that requires the 'target' attribute and the 'delimiter' child element.
ExportEntityConfigDelegate(boolean targetMandatory, boolean delimiterMandatory)
          Creates an ExportEntityConfigDelegate with the given mandatory flags.
 
Method Summary
 ColumnDef createColumnDef(org.w3c.dom.Node column)
          Create a ColumnDef from the given node and apply any custom attributes.
 EntityDef createEntityDef(org.w3c.dom.Node node)
          Create an EntityDef from the given node and apply any custom attributes.
protected  void initDelimiter(ExportEntityDef entityDef, org.w3c.dom.Node delimiter)
          Load the delimiter formatter defined in the given node into the ExportEntityDef.
protected  ColumnTranslator instantiateTranslator(java.lang.String className)
          Instantiate a column translator.
 void setColumnTranslatorFactory(CustomObjectFactory factory)
          Set the custom object factory for create column translators.
 void setDelimiterFormatterFactory(CustomObjectFactory factory)
          Set the custom object factory for creating delimiter formatters.
 
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.


TARGET_ATTR

public static final java.lang.String TARGET_ATTR
The attribute name that contains the name of data file that will contain the data exported.

See Also:
Constant Field Values

TARGET_ENCODING_ATTR

public static final java.lang.String TARGET_ENCODING_ATTR
The attribute name that contains the encoding of the target file.

See Also:
Constant Field Values

WHERE_CLAUSE_ATTR

public static final java.lang.String WHERE_CLAUSE_ATTR
The attribute name that contains the where clause for the sql select statement.

See Also:
Constant Field Values

EXPORT_ENGINE_ATTR

public static final java.lang.String EXPORT_ENGINE_ATTR
The element name that contains the class name of export engine used to export this entity.

See Also:
Constant Field Values

DELIMITER_TAG

public static final java.lang.String DELIMITER_TAG
The element name that contains the DelimiterFormatter definition.

See Also:
Constant Field Values

DELIMITER_TYPE_ATTR

public static final java.lang.String DELIMITER_TYPE_ATTR
The attribute name in the DELIMITER_TAG element that contains contains the delimiter type.

See Also:
Constant Field Values

COLUMN_TRANSLATOR_ATTR

public static final java.lang.String COLUMN_TRANSLATOR_ATTR
The attribute name that contains the ColumnTranslator classname to use on all column values to be exported.

See Also:
Constant Field Values

COLUMN_TRANSLATOR_TAG

public static final java.lang.String COLUMN_TRANSLATOR_TAG
The element name that contains the ColumnTranslator definition.

See Also:
Constant Field Values

COLUMN_TRANSLATOR_TYPE_ATTR

public static final java.lang.String COLUMN_TRANSLATOR_TYPE_ATTR
The attribute name in the COLUMN_TRANSLATOR_TAG element that contains the column translator type.

See Also:
Constant Field Values

delimiterFormatterFactory

protected CustomObjectFactory delimiterFormatterFactory
The custom object factory that can create DelimiterFormatters from delimiter formatter types.


columnTranslatorFactory

protected CustomObjectFactory columnTranslatorFactory
The custom object factory that can create ColumnTranslators from column translator types.


targetMandatory

protected boolean targetMandatory
Flag indicating that the 'target' attribute is mandatory (default true).


delimiterMandatory

protected boolean delimiterMandatory
Flag indicating that the 'delimiter' child element is mandatory (default true).

Constructor Detail

ExportEntityConfigDelegate

public ExportEntityConfigDelegate()
Creates an ExportEntityConfigDelegate that requires the 'target' attribute and the 'delimiter' child element.


ExportEntityConfigDelegate

public ExportEntityConfigDelegate(boolean targetMandatory,
                                  boolean delimiterMandatory)
Creates an ExportEntityConfigDelegate with the given mandatory flags.

Parameters:
targetMandatory - flag indicating whether the 'target' attribute is required or not
delimiterMandatory - flag indicating whether the 'delimiter' element is required or not
Since:
0.69
Method Detail

createEntityDef

public EntityDef createEntityDef(org.w3c.dom.Node node)
                          throws org.w3c.dom.DOMException,
                                 InvalidCustomObjectDefException
Description copied from interface: EntityConfigDelegate
Create an EntityDef from the given node and apply any custom attributes. The following are standard attributes that are applied by the EntityConfig: catalog, schema, table.

Specified by:
createEntityDef in interface EntityConfigDelegate
Parameters:
node - the element node with the name 'entity'
Returns:
the EntityDef
Throws:
InvalidCustomObjectDefException - if the custom EntityDef could not be created
org.w3c.dom.DOMException - if any custom attributes are missing or invalid
See Also:
EntityConfigDelegate.createEntityDef(org.w3c.dom.Node)

createColumnDef

public ColumnDef createColumnDef(org.w3c.dom.Node column)
                          throws org.w3c.dom.DOMException,
                                 InvalidCustomObjectDefException
Description copied from interface: EntityConfigDelegate
Create a ColumnDef from the given node and apply any custom attributes. The following are standard attributes that are applied by the EntityConfig: name, SQLType, format, default.

Specified by:
createColumnDef in interface EntityConfigDelegate
Parameters:
column - the element node with the name 'column'
Returns:
the ColumnDef
Throws:
org.w3c.dom.DOMException - if any custom attributes are missing or invalid
InvalidCustomObjectDefException - if the custom ColumnDef could not be created
See Also:
EntityConfigDelegate.createColumnDef(org.w3c.dom.Node)

setDelimiterFormatterFactory

public void setDelimiterFormatterFactory(CustomObjectFactory factory)
Set the custom object factory for creating delimiter formatters.

Parameters:
factory - the delimiter formatter factory

setColumnTranslatorFactory

public void setColumnTranslatorFactory(CustomObjectFactory factory)
Set the custom object factory for create column translators.

Parameters:
factory - the delimiter formatter factory

initDelimiter

protected void initDelimiter(ExportEntityDef entityDef,
                             org.w3c.dom.Node delimiter)
                      throws org.w3c.dom.DOMException,
                             InvalidCustomObjectDefException
Load the delimiter formatter defined in the given node into the ExportEntityDef.

Parameters:
entityDef - the export entity definition
delimiter - the node containing the delimiter formatter definition.
Throws:
org.w3c.dom.DOMException - if the node is invalid
InvalidCustomObjectDefException - if the delimiter formatter could not be created by the delimiter formatter factory

instantiateTranslator

protected ColumnTranslator instantiateTranslator(java.lang.String className)
                                          throws org.w3c.dom.DOMException
Instantiate a column translator.

Parameters:
className - the class name of the column translator
Returns:
the column translator
Throws:
org.w3c.dom.DOMException - if the column translator could not be instantiated