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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ImportRecordgetRecord(InputStream inputStream)Return an ImportRecord constructed from input file.List<ImportRecord>getRecords(InputStream inputStream)Return a list of ImportRecord constructed from input file.List<String>getSupportedExtensions()Get the file extensions (xml, csv, txt, ...) supported by the FileSourcedefault booleanisValidSourceForFile(String originalName)This method is used to decide if the FileSource manage the file format-
Methods inherited from interface org.dspace.importer.external.service.components.MetadataSource
getImportSource
-
-
-
-
Method Detail
-
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
ImportRecord getRecord(InputStream inputStream) throws FileSourceException, FileMultipleOccurencesException
Return an ImportRecord constructed from input file.- Parameters:
inputStream- The inputStream of the file- Returns:
- An
ImportRecordmatching the file content - Throws:
FileSourceException- if, for any reason, the file is not parsableFileMultipleOccurencesException- 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
-
-