Class AbstractPlainMetadataSource
- java.lang.Object
-
- org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping<PlainMetadataSourceDto>
-
- org.dspace.importer.external.service.components.AbstractPlainMetadataSource
-
- All Implemented Interfaces:
MetadataFieldMapping<PlainMetadataSourceDto,MetadataContributor<PlainMetadataSourceDto>>,FileSource,MetadataSource
- Direct Known Subclasses:
BibtexImportMetadataSourceServiceImpl,CharacterSeparatedImportMetadataSourceServiceImpl,EndnoteImportMetadataSourceServiceImpl,RisImportMetadataSourceServiceImpl
public abstract class AbstractPlainMetadataSource extends AbstractMetadataFieldMapping<PlainMetadataSourceDto> implements FileSource
This class is an abstract implementation ofMetadataSourceuseful in cases of plain metadata sources. It provides the methot to mapping metadata to DSpace Format when source is a file whit a list ofstrings. - Author:
- Pasquale Cavallo (pasquale.cavallo at 4science dot it)
-
-
Constructor Summary
Constructors Constructor Description AbstractPlainMetadataSource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ImportRecordgetRecord(InputStream is)Return an ImportRecord constructed from input file.List<ImportRecord>getRecords(InputStream is)Return a list of ImportRecord constructed from input file.List<String>getSupportedExtensions()Get the file extensions (xml, csv, txt, ...) supported by the FileSourceprotected abstract List<PlainMetadataSourceDto>readData(InputStream fileInpuStream)voidsetSupportedExtensions(List<String> supportedExtensions)Set the file extensions supported by this metadata service-
Methods inherited from class org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping
getMetadataFieldMap, getMetadataProcessor, resultToDCValueMapping, setMetadataFieldMap, setMetadataProcessorMap, toDCValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.importer.external.service.components.FileSource
isValidSourceForFile
-
Methods inherited from interface org.dspace.importer.external.service.components.MetadataSource
getImportSource
-
-
-
-
Method Detail
-
readData
protected abstract List<PlainMetadataSourceDto> readData(InputStream fileInpuStream) throws FileSourceException
- Throws:
FileSourceException
-
setSupportedExtensions
public void setSupportedExtensions(List<String> supportedExtensions)
Set the file extensions supported by this metadata service- Parameters:
supportedExtensions- the file extensions (xml,txt,...) supported by this service
-
getSupportedExtensions
public List<String> getSupportedExtensions()
Description copied from interface:FileSourceGet the file extensions (xml, csv, txt, ...) supported by the FileSource- Specified by:
getSupportedExtensionsin interfaceFileSource
-
getRecords
public List<ImportRecord> getRecords(InputStream is) throws FileSourceException
Return a list of ImportRecord constructed from input file. This list is based on the results retrieved from the file (InputStream) parsed through abstract method readData- Specified by:
getRecordsin interfaceFileSource- Parameters:
is- The inputStream of the file- Returns:
- A list of
ImportRecord - Throws:
FileSourceException- if, for any reason, the file is not parsable
-
getRecord
public ImportRecord getRecord(InputStream is) throws FileSourceException, FileMultipleOccurencesException
Return an ImportRecord constructed from input file. This list is based on the result retrieved from the file (InputStream) parsed through abstract method "readData" implementation- Specified by:
getRecordin interfaceFileSource- Parameters:
is- 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
-
-