Class ArXivImportMetadataSourceServiceImpl
- java.lang.Object
-
- org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
-
- org.dspace.importer.external.service.AbstractImportMetadataSourceService<org.apache.axiom.om.OMElement>
-
- org.dspace.importer.external.arxiv.service.ArXivImportMetadataSourceServiceImpl
-
- All Implemented Interfaces:
MetadataSource,QuerySource
public class ArXivImportMetadataSourceServiceImpl extends AbstractImportMetadataSourceService<org.apache.axiom.om.OMElement> implements QuerySource
Implements a data source for querying ArXiv- Author:
- Pasquale Cavallo (pasquale.cavallo at 4Science dot it)
-
-
Field Summary
-
Fields inherited from class org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
error, exceptionHandlersMap, interRequestTime, lastRequest, lock, maxRetry, operationId, retry, warning
-
-
Constructor Summary
Constructors Constructor Description ArXivImportMetadataSourceServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<ImportRecord>findMatchingRecords(Item item)Expect this method will be not used and erased from the interface soonCollection<ImportRecord>findMatchingRecords(Query query)Finds records based on query object.StringgetBaseAddress()Return the baseAddress set to this objectStringgetImportSource()The string that identifies this import implementation.ImportRecordgetRecord(String id)Get a single record of metadata from the arxiv by ArXiv ID.ImportRecordgetRecord(Query query)Get a single record from the ArXiv matching the query.Collection<ImportRecord>getRecords(String query, int start, int count)Find the number of records matching the query string in ArXiv.Collection<ImportRecord>getRecords(Query query)Find records based on a object query and convert them to a list metadata mapped in ImportRecord.intgetRecordsCount(String query)Find the number of records matching the query string in ArXiv;intgetRecordsCount(Query query)Find the number of records matching a query; The entry with the key "query" of the Query's map will be used to get the query string.voidinit()Initialize the classvoidsetBaseAddress(String baseAddress)Set the baseAddress to this object-
Methods inherited from class org.dspace.importer.external.service.AbstractImportMetadataSourceService
getGenerateQueryForItem, getMetadataFieldMapping, setGenerateQueryForItem, setMetadataFieldMapping, transformSourceRecords
-
Methods inherited from class org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
getError, getExceptionHandler, getMaxRetry, getOperationId, getRetry, getWarning, handleException, initExceptionHandlers, retry, setError, setMaxRetry, setWarning, throwSourceException, throwSourceExceptionHook
-
-
-
-
Method Detail
-
getRecords
public Collection<ImportRecord> getRecords(String query, int start, int count) throws MetadataSourceException
Find the number of records matching the query string in ArXiv. Supports pagination.- Specified by:
getRecordsin interfaceQuerySource- Parameters:
query- a query string to base the search on.start- offset to start atcount- number of records to retrieve.- Returns:
- a set of records. Fully transformed.
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getRecords
public Collection<ImportRecord> getRecords(Query query) throws MetadataSourceException
Find records based on a object query and convert them to a list metadata mapped in ImportRecord. The entry with the key "query" of the Query's map will be used as query string value.- Specified by:
getRecordsin interfaceQuerySource- Parameters:
query- a query object to base the search on.- Returns:
- a set of records. Fully transformed.
- Throws:
MetadataSourceException- if the underlying methods throw any exception.- See Also:
Query,ImportRecord
-
getRecordsCount
public int getRecordsCount(String query) throws MetadataSourceException
Find the number of records matching the query string in ArXiv;- Specified by:
getRecordsCountin interfaceQuerySource- Parameters:
query- a query object to base the search on.- Returns:
- the sum of the matching records over this import source
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getRecordsCount
public int getRecordsCount(Query query) throws MetadataSourceException
Find the number of records matching a query; The entry with the key "query" of the Query's map will be used to get the query string.- Specified by:
getRecordsCountin interfaceQuerySource- Parameters:
query- a query string to base the search on.- Returns:
- the sum of the matching records over this import source
- Throws:
MetadataSourceException- if the underlying methods throw any exception.- See Also:
Query
-
getRecord
public ImportRecord getRecord(String id) throws MetadataSourceException
Get a single record of metadata from the arxiv by ArXiv ID.- Specified by:
getRecordin interfaceQuerySource- Parameters:
id- id of the record in ArXiv- Returns:
- the first matching record
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getRecord
public ImportRecord getRecord(Query query) throws MetadataSourceException
Get a single record from the ArXiv matching the query. Field "query" will be used to get data from.- Specified by:
getRecordin interfaceQuerySource- Parameters:
query- a query matching a single record- Returns:
- the first matching record
- Throws:
MetadataSourceException- if the underlying methods throw any exception.- See Also:
Query
-
init
public void init() throws ExceptionInitialize the class- Specified by:
initin classAbstractRemoteMetadataSource- Throws:
Exception- on generic exception
-
getImportSource
public String getImportSource()
The string that identifies this import implementation. Preferable a URI- Specified by:
getImportSourcein interfaceMetadataSource- Returns:
- the identifying uri
-
findMatchingRecords
public Collection<ImportRecord> findMatchingRecords(Item item) throws MetadataSourceException
Expect this method will be not used and erased from the interface soon- Specified by:
findMatchingRecordsin interfaceQuerySource- Parameters:
item- an item to base the search on- Returns:
- a collection of import records. Only the identifier of the found records may be put in the record.
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
findMatchingRecords
public Collection<ImportRecord> findMatchingRecords(Query query) throws MetadataSourceException
Finds records based on query object. Supports search by title and/or author- Specified by:
findMatchingRecordsin interfaceQuerySource- Parameters:
query- a query object to base the search on.- Returns:
- a collection of import records.
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getBaseAddress
public String getBaseAddress()
Return the baseAddress set to this object- Returns:
- The String object that represents the baseAddress of this object
-
setBaseAddress
public void setBaseAddress(String baseAddress)
Set the baseAddress to this object- Parameters:
baseAddress- The String object that represents the baseAddress of this object
-
-