Interface FileSource

All Superinterfaces:
MetadataSource
All Known Implementing Classes:
AbstractPlainMetadataSource, BibtexImportMetadataSourceServiceImpl, CharacterSeparatedImportMetadataSourceServiceImpl, EndnoteImportMetadataSourceServiceImpl, PubmedImportMetadataSourceServiceImpl, RisImportMetadataSourceServiceImpl

public interface FileSource extends MetadataSource
This interface declare the base methods to work with files containing metadata.
Author:
Pasquale Cavallo (pasquale.cavallo at 4science dot it)
  • Method Details

    • getSupportedExtensions

      List<String> getSupportedExtensions()
      Get the file extensions (xml, csv, txt, ...) supported by the FileSource
    • getRecords

      List<ImportRecord> getRecords(InputStream inputStream) throws FileSourceException
      Return a list of ImportRecord constructed from input file.
      Parameters:
      inputStream - The inputStream of the file
      Returns:
      A list of ImportRecord
      Throws:
      FileSourceException - if, for any reason, the file is not parsable
    • getRecord

      Return an ImportRecord constructed from input file.
      Parameters:
      inputStream - The inputStream of the file
      Returns:
      An ImportRecord matching the file content
      Throws:
      FileSourceException - if, for any reason, the file is not parsable
      FileMultipleOccurencesException - if the file contains more than one entry
    • isValidSourceForFile

      default boolean isValidSourceForFile(String originalName)
      This method is used to decide if the FileSource manage the file format
      Parameters:
      originalName - the file file original name
      Returns:
      true if the FileSource can parse the file, false otherwise