Package com.illumon.iris.importers.util
Class XmlImport.Builder
java.lang.Object
com.illumon.iris.importers.util.ImportBuilder<BUILDER_TYPE,IMPORTER_TYPE>
com.illumon.iris.importers.util.FileImportBuilder<XmlImport.Builder,XmlImport>
com.illumon.iris.importers.util.XmlImport.Builder
- All Implemented Interfaces:
XmlImportBuilder
- Enclosing class:
- XmlImport
public static class XmlImport.Builder extends FileImportBuilder<XmlImport.Builder,XmlImport> implements XmlImportBuilder
The Builder class allows setting properties for an XML import and provides a
build()
method which returns a XmlImport object that will use the configured properties to import batch data.-
Field Summary
Fields inherited from class com.illumon.iris.importers.util.FileImportBuilder
sourceDirectory, sourceFile, sourceGlob
Fields inherited from class com.illumon.iris.importers.util.ImportBuilder
destinationDirectory, destinationPartitions, namespace, outputMode, partitionColumn, schemaService, sourceName, strict, table
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description XmlImport
build()
Creates an XmlImport object using the properties that have been set in theXmlImport.Builder
.protected XmlImport.Builder
getThis()
Returns this builder.XmlImport.Builder
setConstantColumnValue(String constantColumnValue)
Sets the value to use for source columns with a sourceType of CONSTANT.XmlImport.Builder
setDelimiter(char delimiter)
Set the delimiter character used for array data elements.XmlImport.Builder
setElementType(String elementType)
Sets the name or path of the element that will contain data elements.XmlImport.Builder
setMaxDepth(int maxDepth)
Sets a value indicating, starting from Start Depth, how many levels of element paths to traverse and concatenate to provide a list that can be selected under Element Name.XmlImport.Builder
setPositionValues(boolean positionValues)
Set whether field values within the document will be found by name or by position.XmlImport.Builder
setStartDepth(int startDepth)
Set the value, under the element indicated by Start Index, indication how many levels of first children to traverse to find an element that contains data to import.XmlImport.Builder
setStartIndex(int startIndex)
Set the value starting from the root of the document, of the index (1 being the first top-level element in the document after the root) of the element under which data can be found.XmlImport.Builder
setUseAttributeValues(boolean useAttributeValues)
Sets whether field values will be taken from attribute values.XmlImport.Builder
setUseElementValues(boolean useElementValues)
Sets whether field values will be taken from element values.Methods inherited from class com.illumon.iris.importers.util.FileImportBuilder
setSourceDirectory, setSourceDirectory, setSourceFile, setSourceGlob
Methods inherited from class com.illumon.iris.importers.util.ImportBuilder
setDestinationDirectory, setDestinationPartitions, setDestinationPartitions, setOutputMode, setOutputMode, setPartitionColumn, setSchemaService, setSourceName, setStrict
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.importers.util.XmlImportBuilder
setDestinationDirectory, setDestinationPartitions, setDestinationPartitions, setOutputMode, setOutputMode, setPartitionColumn, setSourceDirectory, setSourceDirectory, setSourceFile, setSourceGlob, setSourceName, setStrict
-
Constructor Details
-
Builder
Creates the XmlImportBuilder object. Normally accessed throughXmlImport.builder(String, String)
.- Parameters:
namespace
- The String name of the namespace into which data will be imported.table
- The String name of the table into which data will be imported.
-
-
Method Details
-
setDelimiter
Set the delimiter character used for array data elements. Default is comma. This can be used to set a different character such as pipe (|), semi-colon (;), or any other single character.- Specified by:
setDelimiter
in interfaceXmlImportBuilder
- Parameters:
delimiter
- The char to use as an array delimiter.- Returns:
- this builder.
-
setConstantColumnValue
Sets the value to use for source columns with a sourceType of CONSTANT.- Specified by:
setConstantColumnValue
in interfaceXmlImportBuilder
- Parameters:
constantColumnValue
- String value for the constant column.- Returns:
- this builder.
-
setElementType
Sets the name or path of the element that will contain data elements.- Specified by:
setElementType
in interfaceXmlImportBuilder
- Parameters:
elementType
- The String element name or path under which to find data elements.- Returns:
- this builder.
-
setStartIndex
Set the value starting from the root of the document, of the index (1 being the first top-level element in the document after the root) of the element under which data can be found.- Specified by:
setStartIndex
in interfaceXmlImportBuilder
- Parameters:
startIndex
- int index value of the starting element.- Returns:
- this builder.
-
setStartDepth
Set the value, under the element indicated by Start Index, indication how many levels of first children to traverse to find an element that contains data to import.- Specified by:
setStartDepth
in interfaceXmlImportBuilder
- Parameters:
startDepth
- int value of the starting depth.- Returns:
- this builder.
-
setMaxDepth
Sets a value indicating, starting from Start Depth, how many levels of element paths to traverse and concatenate to provide a list that can be selected under Element Name.- Specified by:
setMaxDepth
in interfaceXmlImportBuilder
- Parameters:
maxDepth
- int value of the maximum depth.- Returns:
- this builder.
-
setUseAttributeValues
Sets whether field values will be taken from attribute values. E.g., <Record ID="XYZ" Price="10.25" />- Specified by:
setUseAttributeValues
in interfaceXmlImportBuilder
- Parameters:
useAttributeValues
- boolean of whether to use attribute values. Default is false.- Returns:
- this builder.
-
setUseElementValues
Sets whether field values will be taken from element values. E.g., <Price>10.25</>- Specified by:
setUseElementValues
in interfaceXmlImportBuilder
- Parameters:
useElementValues
- boolean of whether to use element values. Default is true.- Returns:
- this builder.
-
setPositionValues
Set whether field values within the document will be found by name or by position.E.g., a value called Price might be contained in an element named Price, or an attribute named Price. When this option is included, field names (column names) will be taken from the table schema, and the data values will be parsed into them by matching the position of the value with the position of column in the schema.
- Specified by:
setPositionValues
in interfaceXmlImportBuilder
- Parameters:
positionValues
- boolean of whether to use positional values. Default is false.- Returns:
- this builder.
-
getThis
Description copied from class:ImportBuilder
Returns this builder. Concrete subclasses mus provide "this" so that the setters can chain properly.- Specified by:
getThis
in classImportBuilder<XmlImport.Builder,XmlImport>
- Returns:
- this builder.
-
build
Creates an XmlImport object using the properties that have been set in theXmlImport.Builder
.- Specified by:
build
in interfaceXmlImportBuilder
- Specified by:
build
in classImportBuilder<XmlImport.Builder,XmlImport>
- Returns:
- A
XmlImport
object.
-