Class ImportSchemaDescriptor

java.lang.Object
com.illumon.iris.utils.ImportSchemaDescriptor

public class ImportSchemaDescriptor
extends Object
Support classes for programmatic creation of ImportSource blocks for schema files. Generates the ImportSource block based on a passed list of ImportColumnDescriptors.
  • Constructor Details

    • ImportSchemaDescriptor

      public ImportSchemaDescriptor​(String name, String type, List<ImportSchemaDescriptor.ImportColumnDescriptor> columnDescriptors)
      Outer class for the ImportSource block.
      Parameters:
      name - The name to be used in the ImportSource block. This can be used to select a particular set of import details, when a table might be loaded from multiple, different, sources of the same type.
      type - Normally CSV or JDBC - the type of the source that will use this ImportSource block.
      columnDescriptors - A List of ImportColumn details. (sourceName, formula, etc)
    • ImportSchemaDescriptor

      public ImportSchemaDescriptor​(String name, String type, int maxError, String arrayDelimiter, List<ImportSchemaDescriptor.ImportColumnDescriptor> columnDescriptors, List<org.jdom2.Element> unsupportedElements)
      Outer class for the ImportSource block.
      Parameters:
      name - The name to be used in the ImportSource block. This can be used to select a particular set of import details, when a table might be loaded from multiple, different, sources of the same type.
      type - Normally CSV or JDBC - the type of the source that will use this ImportSource block.
      maxError - max errors permissible during an import (default 0)
      arrayDelimiter - delimiter to use when parsing array values (default unspecified)
      columnDescriptors - A List of ImportColumn details. (sourceName, formula, etc)
  • Method Details

    • findSourceType

      public static Class<?> findSourceType​(String typeName)
      Finds a likely compatible target column class for a passed class name.
      Parameters:
      typeName - Name of the class to match
      Returns:
      Class that is a likely compatible match, or throws ClassNotFound if no match can be found.
    • generateImportSource

      public org.jdom2.Document generateImportSource()
    • generateImportSource

      public org.jdom2.Document generateImportSource​(boolean intermediate)
    • generateImportSource

      public org.jdom2.Document generateImportSource​(String imports, boolean intermediate)
      Creates the ImportSource block for a schema file
      Parameters:
      imports - Any entries for the <Imports> element. This element will be omitted if imports is null
      Returns:
      a String with the ImportSource block