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 of
MetadataSource useful in cases
of plain metadata sources.
It provides the method to mapping metadata to DSpace Format when source is a file
with a list of <key, value> strings.- Author:
- Pasquale Cavallo (pasquale.cavallo at 4science dot it)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRecord(InputStream is) Return an ImportRecord constructed from input file.Return a list of ImportRecord constructed from input file.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 serviceMethods inherited from class org.dspace.importer.external.metadatamapping.AbstractMetadataFieldMapping
getMetadataFieldMap, getMetadataProcessor, resultToDCValueMapping, setMetadataFieldMap, setMetadataProcessorMap, toDCValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dspace.importer.external.service.components.FileSource
isValidSourceForFileMethods inherited from interface org.dspace.importer.external.service.components.MetadataSource
getImportSource
-
Constructor Details
-
AbstractPlainMetadataSource
public AbstractPlainMetadataSource()
-
-
Method Details
-
readData
protected abstract List<PlainMetadataSourceDto> readData(InputStream fileInpuStream) throws FileSourceException - Throws:
FileSourceException
-
setSupportedExtensions
Set the file extensions supported by this metadata service- Parameters:
supportedExtensions- the file extensions (xml,txt,...) supported by this service
-
getSupportedExtensions
Description copied from interface:FileSourceGet the file extensions (xml, csv, txt, ...) supported by the FileSource- Specified by:
getSupportedExtensionsin interfaceFileSource
-
getRecords
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
-