public class DOIIdentifierProvider extends IdentifierProvider
This class handles reservation, registration and deletion of DOIs using the direct API from DataCite. Please pay attention that some members of DataCite offer special services and want their customers to use special APIs. If you are unsure ask your registration agency.
Any identifier a method of this class returns is a string in the following format: doi:10.123/456.
| Modifier and Type | Field and Description |
|---|---|
protected ContentServiceFactory |
contentServiceFactory |
static Integer |
DELETED |
static String |
DOI_ELEMENT |
static String |
DOI_QUALIFIER |
protected DOIService |
doiService |
static Integer |
IS_REGISTERED |
static Integer |
IS_RESERVED |
protected ItemService |
itemService |
static String |
MD_SCHEMA |
static Integer |
TO_BE_DELETED |
static Integer |
TO_BE_REGISTERED |
static Integer |
TO_BE_RESERVED |
static Integer |
UPDATE_BEFORE_REGISTRATION |
static Integer |
UPDATE_REGISTERED |
static Integer |
UPDATE_RESERVED |
configurationService, parentService| Modifier | Constructor and Description |
|---|---|
protected |
DOIIdentifierProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
delete(Context context,
DSpaceObject dso)
Unbind this type of identifier(s) from an object.
|
void |
delete(Context context,
DSpaceObject dso,
String identifier)
Unbind the given identifier from an object.
|
void |
deleteOnline(Context context,
String identifier) |
String |
getDOIByObject(Context context,
DSpaceObject dso)
Search the database for a DOI, using the type and id of an DSpaceObject.
|
String |
getDOIOutOfObject(DSpaceObject dso)
Loads a DOI out of the metadata of an DSpaceObject.
|
protected String |
getNamespaceSeparator() |
DSpaceObject |
getObjectByDOI(Context context,
String identifier)
Returns a DSpaceObject depending on its DOI.
|
protected String |
getPrefix() |
protected DOI |
loadOrCreateDOI(Context context,
DSpaceObject dso,
String doiIdentifier)
Load a DOI from the database or creates it if it does not exist.
|
String |
lookup(Context context,
DSpaceObject dso)
Return the identifier for a DSpaceObject.
|
String |
mint(Context context,
DSpaceObject dso)
Create an identifier for a DSpaceObject.
|
String |
register(Context context,
DSpaceObject dso)
Create and apply an identifier to a DSpaceObject.
|
void |
register(Context context,
DSpaceObject dso,
String identifier)
Create a specific identifier and apply it to an object.
|
void |
registerOnline(Context context,
DSpaceObject dso,
String identifier) |
protected void |
removeDOIFromObject(Context context,
DSpaceObject dso,
String doi)
Removes a DOI out of the metadata of a DSpaceObject.
|
void |
reserve(Context context,
DSpaceObject dso,
String identifier)
Set an object's identifier.
|
void |
reserveOnline(Context context,
DSpaceObject dso,
String identifier) |
DSpaceObject |
resolve(Context context,
String identifier,
String... attributes)
Find the object named by a given identifier.
|
protected void |
saveDOIToObject(Context context,
DSpaceObject dso,
String doi)
Adds a DOI to the metadata of an item.
|
void |
setDOIConnector(DOIConnector connector) |
boolean |
supports(Class<? extends Identifier> identifier)
This identifier provider supports identifiers of type
DOI. |
boolean |
supports(String identifier)
This identifier provider supports identifiers in the following format:
doi:10.123/456
10.123/456
http://dx.doi.org/10.123/456
|
void |
updateMetadata(Context context,
DSpaceObject dso,
String identifier) |
void |
updateMetadataOnline(Context context,
DSpaceObject dso,
String identifier) |
setConfigurationService, setParentServicepublic static final String MD_SCHEMA
public static final String DOI_ELEMENT
public static final String DOI_QUALIFIER
public static final Integer TO_BE_REGISTERED
public static final Integer TO_BE_RESERVED
public static final Integer IS_REGISTERED
public static final Integer IS_RESERVED
public static final Integer UPDATE_RESERVED
public static final Integer UPDATE_REGISTERED
public static final Integer UPDATE_BEFORE_REGISTRATION
public static final Integer TO_BE_DELETED
public static final Integer DELETED
@Autowired(required=true) protected DOIService doiService
@Autowired(required=true) protected ContentServiceFactory contentServiceFactory
@Autowired(required=true) protected ItemService itemService
protected String getPrefix()
protected String getNamespaceSeparator()
public void setDOIConnector(DOIConnector connector)
public boolean supports(Class<? extends Identifier> identifier)
DOI.supports in class IdentifierProvideridentifier - to check if it will be supported by this provider.public boolean supports(String identifier)
supports in class IdentifierProvideridentifier - to check if it is in a supported format.public String register(Context context, DSpaceObject dso) throws IdentifierException
IdentifierProviderorg.dspace.content.DSpaceObject#resetIdentifiersCache() after its registration. If you register
identifiers directly in this method the IdentifierService will call this method for you.register in class IdentifierProviderdso - object to be named.item if it has one, else a new identifier.IdentifierException - if identifier errorpublic void register(Context context, DSpaceObject dso, String identifier) throws IdentifierException
IdentifierProviderregister in class IdentifierProviderdso - to be identified.identifier - to be created.IdentifierException - if identifier errorpublic void reserve(Context context, DSpaceObject dso, String identifier) throws IdentifierException, IllegalArgumentException
IdentifierProviderreserve in class IdentifierProvidercontext - dso - DSpaceObject the DOI should be reserved for. Some metadata of
this object will be send to the registration agency.identifier - DOI to register in a format that
DOIService.formatIdentifier(String) accepts.IdentifierException - If the format of identifier was
unrecognized or if it was impossible to
reserve the DOI (registration agency denied
for some reason, see logs).IllegalArgumentException - If identifier is a DOI already
registered for another DSpaceObject then
dso.IdentifierProvider.reserve(Context, DSpaceObject, String)public void reserveOnline(Context context, DSpaceObject dso, String identifier) throws IdentifierException, IllegalArgumentException, SQLException
public void registerOnline(Context context, DSpaceObject dso, String identifier) throws IdentifierException, IllegalArgumentException, SQLException
public void updateMetadata(Context context, DSpaceObject dso, String identifier) throws IdentifierException, IllegalArgumentException, SQLException
public void updateMetadataOnline(Context context, DSpaceObject dso, String identifier) throws IdentifierException, SQLException
IdentifierExceptionSQLExceptionpublic String mint(Context context, DSpaceObject dso) throws IdentifierException
IdentifierProvidermint in class IdentifierProviderdso - object to be named.dso if it has one, else a new identifier.IdentifierException - if identifier errorpublic DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException
IdentifierProviderresolve in class IdentifierProvideridentifier - to be resolved.attributes - additional information for resolving identifier.IdentifierNotFoundException - if identifier not foundIdentifierNotResolvableException - if identifier not resolvablepublic String lookup(Context context, DSpaceObject dso) throws IdentifierNotFoundException, IdentifierNotResolvableException
IdentifierProviderlookup in class IdentifierProviderdso - The object to be looked up.object.IdentifierNotFoundException - if identifier not foundIdentifierNotResolvableException - if identifier not resolvablepublic void delete(Context context, DSpaceObject dso) throws IdentifierException
IdentifierProviderdelete in class IdentifierProviderdso - object to lose its identity.IdentifierException - if identifier errorpublic void delete(Context context, DSpaceObject dso, String identifier) throws IdentifierException
IdentifierProviderdelete in class IdentifierProviderdso - object to be de-identified.identifier - to be removed.IdentifierException - if identifier errorpublic void deleteOnline(Context context, String identifier) throws DOIIdentifierException
DOIIdentifierExceptionpublic DSpaceObject getObjectByDOI(Context context, String identifier) throws SQLException, DOIIdentifierException, IllegalArgumentException
context - the contextidentifier - The DOI in a format that is accepted by
DOIService.formatIdentifier(String).SQLException - if database errorIdentifierException - If identifier is null or an empty string.IllegalArgumentException - If the identifier couldn't be recognized as DOI.DOIIdentifierExceptionpublic String getDOIByObject(Context context, DSpaceObject dso) throws SQLException
context - dso - DSpaceObject to find doi for. DOIs with status TO_BE_DELETED will be
ignored.SQLException - if database errorprotected DOI loadOrCreateDOI(Context context, DSpaceObject dso, String doiIdentifier) throws SQLException, DOIIdentifierException
context - dso - The DSpaceObject the DOI should be loaded or created for.doiIdentifier - A DOI or null if a DOI should be generated. The generated DOI
can be found in the appropriate column for the TableRow.SQLException - In case of an error using the database.DOIIdentifierException - If doi is not part of our prefix or
DOI is registered for another object already.public String getDOIOutOfObject(DSpaceObject dso) throws DOIIdentifierException
dso - DOIIdentifierExceptionprotected void saveDOIToObject(Context context, DSpaceObject dso, String doi) throws SQLException, AuthorizeException, IdentifierException
context - dso - DSpaceObject the DOI should be added to.doi - The DOI that should be added as metadata.SQLException - if database errorAuthorizeException - if authorization errorIdentifierExceptionprotected void removeDOIFromObject(Context context, DSpaceObject dso, String doi) throws AuthorizeException, SQLException, IdentifierException
context - dso - The DSpaceObject the DOI should be removed from.doi - The DOI to remove out of the metadata.AuthorizeException - if authorization errorSQLException - if database errorIdentifierExceptionCopyright © 2022 LYRASIS. All rights reserved.