Class AbstractTestImportQuery

All Implemented Interfaces:
RemoteQuery<Inflatable<Table>>, Serializable
Direct Known Subclasses:
CsvTestImportQuery, XmlTestImportQuery

public abstract class AbstractTestImportQuery extends ContextAwareRemoteQuery<Inflatable<Table>>
Base implementation for CSV and XML preview table implementations that extracts the common logic.
See Also:
  • Field Details

    • nextSerial

      protected final AtomicLong nextSerial
    • schemaElement

      protected final org.jdom2.Element schemaElement
    • typeSpecificFields

      protected final Map<String,Object> typeSpecificFields
  • Constructor Details

    • AbstractTestImportQuery

      public AbstractTestImportQuery(org.jdom2.Element schemaElement, Map<String,Object> typeSpecificFields)
      Constructor.
      Parameters:
      schemaElement - The schema element for the import query whose preview table is being generated
      typeSpecificFields - The type specific fields map object that has all the extracted values from the current import query
  • Method Details

    • execute

      public Inflatable<Table> execute(Database database)
      Description copied from interface: RemoteQuery
      Execute a query on a remote host.
      Parameters:
      database - database to use for execution.
      Returns:
      result of the query.
    • getPreviewTable

      public Table getPreviewTable(@NotNull com.fishlib.io.logger.Logger logger)
      Generates and returns an in memory preview table or table stored at a temp location using the provided properties. Delegates the import to doImportAndGetWriterFactory(Logger). Returns the table with the partition column
      Parameters:
      logger - The (logger) of the current process
      Returns:
      The generated preview table instance
    • doImportAndGetWriterFactory

      @NotNull protected abstract PreviewTableImportTableWriterFactory doImportAndGetWriterFactory(@NotNull com.fishlib.io.logger.Logger logger)
      Builds an in memory preview table using a temp location and returns the TableWriterFactory to extract the generated table. Holds the implementation specific logic on building a preview table
      Parameters:
      logger - The (logger) of the current process
      Returns:
      The table writer factory used in the preview table import
    • getNoDataError

      @NotNull protected String getNoDataError()
      Returns an implementation specific informative error message when no partitions were generated.
      Returns:
      error message that no data was found.