<?xml version="1.0" encoding="UTF-8" ?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="import" type="importType">
		<annotation><documentation>The root element for an Import XML Document.</documentation></annotation>
	</element>
	<complexType name="importType">
		<sequence>
			<element name="connection" type="connectionType">
				<annotation><documentation>The connection definition used by JDBCImporter.</documentation></annotation>
			</element>
			<element name="entity" type="importEntityType" minOccurs="1" maxOccurs="unbounded">
				<annotation><documentation>The list of tables to be imported.</documentation></annotation>
			</element>
		</sequence>
		<attribute name="log" type="string" use="required">
			<annotation><documentation>The file that will contain all info, audit and error messages.</documentation></annotation>
		</attribute>
		<attribute name="bad" type="string" use="required">
			<annotation><documentation>The file that will contain all rows that could not be imported.</documentation></annotation>
		</attribute>
		<attribute name="commitCount" type="integer" use="optional" default="1">
		  <annotation><documentation>The number of rows to import before calling commit on the connection (default is 1). If the value
			 is less than or equal to 1 then commit will not be called by the JDBCImporter and the connnection will be set to auto
			 commit.</documentation></annotation>
		</attribute>
		<attribute name="batchCount" type="integer" use="optional" default="0">
		  <annotation><documentation>The number of rows to import before calling executeBatch on the ImportEngine (default is 0). If the 
			 value is less than or equal to 1 then executeBatch will not be called by the JDBCImporter.</documentation></annotation>
		</attribute>
		<attribute name="trimValues" type="boolean" use="optional" default="false">
		  <annotation><documentation>The flag indicating that values will trimmed after reading them from the Delimiter Parser
		     </documentation></annotation>
		</attribute>
		<attribute name="preSQLFile" type="string" use="optional">
		   <annotation><documentation>The filename containing sql statements that will be executed before the import.</documentation>
		   </annotation>
		</attribute>
		<attribute name="postSQLFile" type="string" use="optional">
		   <annotation><documentation>The filename containing sql statements that will be executed after the import.</documentation>
		   </annotation>
		</attribute>		
	</complexType>
	<complexType name="connectionType">
	    <annotation><documentation>The connection definition.</documentation></annotation>
		<sequence>
			<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
				<annotation><documentation>The properties applied to the connection definition object.</documentation></annotation>
			</element>
		</sequence>
		<attribute name="type" type="string" use="required">
			<annotation><documentation>The type of connection definition. The value should map to the class that implements
			   ConnectionDef.</documentation></annotation>
		</attribute>
	</complexType>
	<complexType name="importEntityType">
		<annotation><documentation>The entity definition used in an Import XML Document.</documentation></annotation>
		<sequence>
			<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
				<annotation><documentation>The properties defined for an entity which may be used by the
				 ImportEngine.</documentation></annotation>
			</element>
			<element name="delimiter" type="delimiterParserType" >
				<annotation><documentation>The delimiter parser definition used to parse the source file.</documentation></annotation>
			</element>
			<element name="translator" type="rowTranslatorType" minOccurs="0" maxOccurs="1">
				<annotation><documentation>The row translator that will be used to translate row values.</documentation></annotation>
			</element>
			<element name="column" type="importColumnType" minOccurs="1" maxOccurs="unbounded">
				<annotation><documentation>The list of columns in the table and source file</documentation></annotation>
			</element>
		</sequence>
		<attribute name="table" type="string" use="required">
			<annotation><documentation>The table name that will contain the imported data.</documentation></annotation>
		</attribute>
		<attribute name="source" type="string" use="required">
			<annotation><documentation>The source file containing the rows to be imported.</documentation></annotation>
		</attribute>
		<attribute name="encoding" type="string" use="optional">
			<annotation><documentation>The source file's encoding charset.</documentation></annotation>
		</attribute>
		<attribute name="schema" type="string" use="optional">
			<annotation><documentation>The schema name of the table.</documentation></annotation>
		</attribute>
		<attribute name="catalog" type="string" use="optional">
			<annotation><documentation>The catalog name of the table.</documentation></annotation>
		</attribute>
		<attribute name="engine" type="string" use="optional">
			<annotation><documentation>The import engine classname to use when importing rows for the entity.</documentation></annotation>
		</attribute>
	</complexType>
	<complexType name="delimiterParserType">
		<annotation><documentation>The delimiter parser definition.</documentation></annotation>
		<sequence>
			<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
				<annotation><documentation>The properties applied to the delimiter parser.</documentation></annotation>
			</element>
		</sequence>
		<attribute name="type" type="string" use="required">
			<annotation><documentation>The type of delimiter parser. The value should map to the class that implements
			   DelimiterParser.</documentation></annotation>
		</attribute>
	</complexType>
	<complexType name="rowTranslatorType">
		<annotation><documentation>The row translator definition.</documentation></annotation>
		<sequence>
			<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
				<annotation><documentation>The properties applied to the row translator.</documentation></annotation>
			</element>
		</sequence>
		<attribute name="type" type="string" use="required">
			<annotation><documentation>The type of column translator. The value should map to the class that implements
			   RowTranslator.</documentation></annotation>
		</attribute>
	</complexType>
	<complexType name="importColumnType">
		<annotation><documentation>The column definition used in an Import XML Document.</documentation></annotation>
		<sequence>
			<element name="translator" type="columnTranslatorType" minOccurs="0" maxOccurs="1">
				<annotation><documentation>The column translator that will be used to translate column values.</documentation></annotation>
			</element>
			<element name="generator" type="columnGeneratorType" minOccurs="0" maxOccurs="1">
				<annotation><documentation>The column generator that will be used to generate values if the 'generate' attribute is set to true.</documentation></annotation>
			</element>
			<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
				<annotation><documentation>The properties defined for a column that may be used
				  by the ImportEngine.</documentation></annotation>
			</element>
		</sequence>
		<attribute name="name" type="string" use="required">
			<annotation><documentation>The name of the column.</documentation></annotation>
		</attribute>
		<attribute name="SQLType" type="sqlType" use="optional">
			<annotation><documentation>The type of the column.</documentation></annotation>
		</attribute>
		<attribute name="defaultValue" type="string" use="optional">
			<annotation><documentation>The default value of the column.</documentation></annotation>
		</attribute>
		<attribute name="translator" type="string" use="optional">
			<annotation><documentation>The class that will translate the values before they are imported.</documentation></annotation>
		</attribute>
		<attribute name="format" type="string" use="optional">
			<annotation><documentation>The format pattern used to describe how to parse numbers or dates.</documentation></annotation>
		</attribute>
		<attribute name="generate" type="boolean" use="optional" default="false">
			<annotation><documentation>The flag indicating that the column will be generated instead of read from the source file.</documentation></annotation>
		</attribute>
	</complexType>
	<complexType name="columnTranslatorType">
		<annotation><documentation>The column translator definition.</documentation></annotation>
		<sequence>
			<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
				<annotation><documentation>The properties applied to the column translator.</documentation></annotation>
			</element>
		</sequence>
		<attribute name="type" type="string" use="required">
			<annotation><documentation>The type of column translator. The value should map to the class that implements
			   ColumnTranslator.</documentation></annotation>
		</attribute>
	</complexType>
	<complexType name="propertyType">
		<annotation><documentation>A property definition.</documentation></annotation>
		<attribute name="name" type="string" use="required">
			<annotation><documentation>The name of the property.</documentation></annotation>
		</attribute>
		<attribute name="value" type="string" use="required">
			<annotation><documentation>The value of the property.</documentation></annotation>
		</attribute>
	</complexType>
	<simpleType name="sqlType">
		<annotation><documentation>The list of sql type names that are recognized by DataGenerator, JDBCImporter,
		  and JDBCExporter</documentation></annotation>
		<restriction base="xsd:string">
			<enumeration value="VARCHAR" />
			<enumeration value="CHAR" />
			<enumeration value="INTEGER" />
			<enumeration value="SMALLINT" />
			<enumeration value="TINYINT" />
			<enumeration value="BIGINT" />
			<enumeration value="NUMERIC" />
			<enumeration value="DECIMAL" />
			<enumeration value="DOUBLE" />
			<enumeration value="FLOAT" />
			<enumeration value="DATE" />
			<enumeration value="TIME" />
			<enumeration value="TIMESTAMP" />
		</restriction>
	</simpleType>

<element name="export" type="exportType">
		<annotation><documentation>The root element for an Export XML Document.</documentation></annotation>
</element>

<complexType name="exportType">
	<sequence>
		<element name="connection" type="connectionType">
			<annotation><documentation>The connection definition used by JDBCExporter.</documentation></annotation>
		</element>
		<element name="entity" type="exportEntityType" minOccurs="1" maxOccurs="unbounded">
			<annotation><documentation>The list of tables to be exported.</documentation></annotation>
		</element>
	</sequence>
	<attribute name="log" type="string" use="required">
		<annotation><documentation>The file that will contain all info, audit and error messages.</documentation></annotation>
	</attribute>
</complexType>

<complexType name="exportEntityType">
	<annotation><documentation>The entity definition used in an Export XML document.</documentation></annotation>
	<sequence>
		<element name="delimiter" type="delimiterFormatterType">
			<annotation><documentation>The delimiter formatter definition used to format the target file.</documentation></annotation>
		</element>
		<element name="column" type="exportColumnType" minOccurs="1" maxOccurs="unbounded">
			<annotation><documentation>The list of columns in the table and target file</documentation></annotation>
		</element>
	</sequence>
	<attribute name="table" type="string" use="required">
		<annotation><documentation>The table name contains the data to be exported.</documentation></annotation>
	</attribute>
	<attribute name="target" type="string" use="required">
		<annotation><documentation>The file that will contain the rows exported from the database.</documentation></annotation>
	</attribute>
	<attribute name="encoding" type="string" use="optional">
		<annotation><documentation>The target file's encoding charset.</documentation></annotation>
	</attribute>
	<attribute name="schema" type="string" use="optional">
		<annotation><documentation>The schema name of the table.</documentation></annotation>
	</attribute>
	<attribute name="catalog" type="string" use="optional">
		<annotation><documentation>The catalog name of the table.</documentation></annotation>
	</attribute>
	<attribute name="where"   type="string" use="optional">
		<annotation><documentation>The where clause to be appended to the SQL selection statement.</documentation></annotation>
	</attribute>
	<attribute name="engine" type="string" use="optional">
		<annotation><documentation>The export engine classname to use when exporting rows for the entity.</documentation></annotation>
	</attribute>
</complexType>

<complexType name="delimiterFormatterType">
	<annotation><documentation>The delimiter formatter definition.</documentation></annotation>
	<sequence>
		<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
			<annotation><documentation>The properties applied to the delimiter formatter.</documentation></annotation>
		</element>
	</sequence>
	<attribute name="type" type="string" use="required">
		<annotation><documentation>The type of delimiter formatter. The value should map to the class that implements
		   DelimiterFormatter.</documentation></annotation>
	</attribute>
</complexType>

<complexType name="exportColumnType">
	<annotation><documentation>The column definition used in an Export XML document.</documentation></annotation>
	<sequence>
			<element name="translator" type="columnTranslatorType" minOccurs="0" maxOccurs="1">
				<annotation><documentation>The column translator that will be used to translate column values.</documentation></annotation>
			</element>
	</sequence>
	<attribute name="name"         type="string" use="required">
		<annotation><documentation>The name of the column.</documentation></annotation>
	</attribute>
	<attribute name="SQLType" type="sqlType" use="optional">
		<annotation><documentation>The type of the column.</documentation></annotation>
	</attribute>
	<attribute name="translator" type="string" use="optional">
		<annotation><documentation>The class that will translate the values after they are exported.</documentation></annotation>
	</attribute>
	<attribute name="format" type="string" use="optional">
		<annotation><documentation>The format pattern used to describe how to format numbers or dates.</documentation></annotation>
	</attribute>
</complexType>

<element name="generate" type="generateType">
	<annotation><documentation>The root element for a Generate XML Document.</documentation></annotation>
</element>

<complexType name="generateType">
	<sequence>
		<element name="connection" type="connectionType">
			<annotation><documentation>The connection definition used by DataGenerator.</documentation></annotation>
		</element>
		<element name="entity" type="generateEntityType" minOccurs="1" maxOccurs="unbounded">
			<annotation><documentation>The list of tables whose values will be generated.</documentation></annotation>
		</element>
	</sequence>
	<attribute name="log" type="string" use="required">
		<annotation><documentation>The file that will contain all info, audit and error messages.</documentation></annotation>
	</attribute>
</complexType>

<complexType name="generateEntityType">
	<annotation><documentation>The entity definition used in a Generate XML document.</documentation></annotation>
	<sequence>
		<element name="delimiter" type="delimiterFormatterType">
			<annotation><documentation>The delimiter formatter definition used to format the target file.</documentation></annotation>
		</element>		
		<element name="column" type="generateColumnType" minOccurs="1" maxOccurs="unbounded">
			<annotation><documentation>The list of columns in the table and target file</documentation></annotation>
		</element>
	</sequence>
	<attribute name="table" type="string" use="required">
		<annotation><documentation>The table name whose data will be generated.</documentation></annotation>
	</attribute>
	<attribute name="schema" type="string" use="optional">
		<annotation><documentation>The schema name of the table.</documentation></annotation>
	</attribute>
	<attribute name="catalog" type="string" use="optional">
		<annotation><documentation>The catalog name of the table.</documentation></annotation>
	</attribute>
	<attribute name="target" type="string" use="optional">
		<annotation><documentation>The file that will contain the rows generated (used for entities that are generated).</documentation></annotation>
	</attribute>
	<attribute name="count"   type="integer" use="optional">
		<annotation><documentation>The number of rows to generate (used for entities that are generated).</documentation></annotation>
	</attribute>
	<attribute name="where"   type="string" use="optional">
		<annotation><documentation>The where clause to be appended to the SQL selection statement (used for source entities whose data comes from the database).</documentation></annotation>
	</attribute>
	<attribute name="source" type="string" use="optional">
		<annotation><documentation>The source file containing the rows or 'db' (used for source entities).</documentation></annotation>
	</attribute>
	<attribute name="encoding" type="string" use="optional">
		<annotation><documentation>The source or target file's encoding charset.</documentation></annotation>
	</attribute>
</complexType>

<complexType name="generateColumnType">
	<annotation><documentation>The column definition used in a Generate XML document.</documentation></annotation>
	<sequence>
		<element name="generator" type="columnGeneratorType">
			<annotation><documentation>The column generator that will be used to generate values.</documentation></annotation>
		</element>
	</sequence>
	<attribute name="name"         type="string" use="required">
		<annotation><documentation>The name of the column.</documentation></annotation>
	</attribute>
	<attribute name="SQLType" type="sqlType" use="optional">
		<annotation><documentation>The type of the column.</documentation></annotation>
	</attribute>
	<attribute name="format" type="string" use="optional">
		<annotation><documentation>The format pattern used to describe how to format numbers or dates.</documentation></annotation>
	</attribute>
</complexType>

<complexType name="columnGeneratorType">
	<annotation><documentation>The column generator definition.</documentation></annotation>
	<sequence>
		<element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded">
			<annotation><documentation>The properties applied to the column generator.</documentation></annotation>
		</element>
	</sequence>
	<attribute name="type" type="string" use="required">
		<annotation><documentation>The type of column generator. The value should map to the class that implements
		   ColumnValueGenerator.</documentation></annotation>
	</attribute>
</complexType>
</schema>