Class DataImporterBase

java.lang.Object
org.tquadrat.bloodpressure.spi.DataImporterBase
All Implemented Interfaces:
DataImporter
Direct Known Subclasses:
BlutdruckdatenCSVImporter

@ClassVersion(sourceVersion="$Id: DataImporterBase.java 120 2022-02-10 18:58:05Z tquadrat $") @API(status=STABLE, since="0.0.1") public abstract non-sealed class DataImporterBase extends Object implements DataImporter
The abstract base class for the data import components.
Author:
Thomas Thrien (thomas.thrien@tquadrat.org)
Version:
$Id: DataImporterBase.java 120 2022-02-10 18:58:05Z tquadrat $
Since:
0.0.1
UML Diagram
UML Diagram for "org.tquadrat.bloodpressure.spi.DataImporterBase"

UML Diagram for "org.tquadrat.bloodpressure.spi.DataImporterBase"

UML Diagram for "org.tquadrat.bloodpressure.spi.DataImporterBase"
  • Field Details

  • Constructor Details

    • DataImporterBase

      protected DataImporterBase(InputFormat inputFormat, String dataOrigin)
      Creates a new instance of DataImporterBase.
      Parameters:
      inputFormat - The input format that is handled by this implementation of DataImporter.
      dataOrigin - The identifier for the data origin.
  • Method Details

    • getKey

      public final DataImporter.Key getKey()
      Returns the registry key for this data importer.
      Specified by:
      getKey in interface DataImporter
      Returns:
      The key.
    • parse

      public abstract Collection<DataRecord> parse(URI source, ZoneId timezone, Charset encoding) throws IOException
      Parses the data on the given source location and returns a collection of DataRecord instance.
      Specified by:
      parse in interface DataImporter
      Parameters:
      source - The location for the source data.
      timezone - The time zone for the timestamp on the source data.
      encoding - The encoding of the source data.
      Returns:
      The data records.
      Throws:
      IOException - Something went wrong while pulling the data from the source.
    • registerImporter

      public static final void registerImporter(DataImporter importer)
      Registers a DataImporter instance.
      Parameters:
      importer - The instance to register.
    • retrieveDataImporter

      public static final Optional<DataImporter> retrieveDataImporter(InputFormat inputFormat, String dataOrigin)
      Returns the data importer that is identified by the given input format and data origin.
      Parameters:
      inputFormat - The input format.
      dataOrigin - The identifier for the data origin.
      Returns:
      An instance of Optional that holds the retrieved data importer.