Interface ImportProcessor

All Known Implementing Classes:
DefaultImportProcessor

public interface ImportProcessor
Parses and handles a particular import file.

Note that ImportManager will delegate processing to the first ImportProcessor for which canProcess(Import) returns true.

Author:
Phillip Verheyden (phillipuniverse), Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canProcess(Import metadata)
    Whether or not this processor can handle the given import.
    void
    Performs the operations required to transform the given file into persisting into a backing data store.
  • Method Details

    • canProcess

      boolean canProcess(Import metadata)
      Whether or not this processor can handle the given import.
      Parameters:
      metadata - details about a particular import that needs to be processed
      Returns:
      true if this processor should handle the import, false otherwise
    • process

      void process(ImportProcessingContext<? extends FileReaderContext> context)
      Performs the operations required to transform the given file into persisting into a backing data store. The actual persistence will usually be remote and so this processor's main job is to convert the file to a JSON representation and publish batch messages for resource tiers to persist to their data store.

      Any records which are detected to have errors (ex: invalid row types) are pruned from the published batches, and a new BatchItemCompletion is created in the data store for each. The Import.errorCount is updated accordingly.

      If at the end of this processing, the processor detects that the Import.successCount and Import.errorCount sum to Import.totalItems, it will mark the import as complete.

      Parameters:
      context - the current import being executed
      Throws:
      ImportProcessingException - if there was a problem such as not being able to read the file, could not convert the contents, etc