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 |
|---|---|
static Integer |
DELETED |
static String |
DOI_ELEMENT |
static String |
DOI_QUALIFIER |
static Integer |
IS_REGISTERED |
static Integer |
IS_RESERVED |
static String |
MD_SCHEMA |
static Integer |
TO_BE_DELETED |
static Integer |
TO_BE_REGISTERED |
static Integer |
TO_BE_RESERVERED |
static Integer |
UPDATE_BEFORE_REGISTERATION |
static Integer |
UPDATE_REGISTERED |
static Integer |
UPDATE_RESERVERED |
configurationService, parentService| Constructor and Description |
|---|
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) |
static String |
getDOIByObject(Context context,
DSpaceObject dso)
Search the database for a DOI, using the type and id of an DSpaceObject.
|
static String |
getDOIOutOfObject(DSpaceObject dso)
Loads a DOI out of the metadata of an DSpaceObject.
|
protected String |
getNamespaceSeparator() |
static DSpaceObject |
getObjectByDOI(Context context,
String identifier)
Returns a DSpaceObject depending on its DOI.
|
protected String |
getPrefix() |
protected TableRow |
loadOrCreateDOI(Context context,
DSpaceObject dso,
String doi)
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_RESERVERED
public static final Integer IS_REGISTERED
public static final Integer IS_RESERVED
public static final Integer UPDATE_RESERVERED
public static final Integer UPDATE_REGISTERED
public static final Integer UPDATE_BEFORE_REGISTERATION
public static final Integer TO_BE_DELETED
public static final Integer DELETED
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
IdentifierProviderregister in class IdentifierProviderdso - object to be named.item if it has one, else a new identifier.IdentifierExceptionpublic void register(Context context, DSpaceObject dso, String identifier) throws IdentifierException
IdentifierProviderregister in class IdentifierProviderdso - to be identified.identifier - to be created.IdentifierExceptionpublic 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
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.IdentifierExceptionpublic DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException
IdentifierProviderresolve in class IdentifierProvideridentifier - to be resolved.attributes - additional information for resolving identifier.IdentifierNotFoundExceptionIdentifierNotResolvableExceptionpublic String lookup(Context context, DSpaceObject dso) throws IdentifierNotFoundException, IdentifierNotResolvableException
IdentifierProviderlookup in class IdentifierProviderdso - The object to be looked up.object.IdentifierNotFoundExceptionIdentifierNotResolvableExceptionpublic void delete(Context context, DSpaceObject dso) throws IdentifierException
IdentifierProviderdelete in class IdentifierProviderdso - object to lose its identity.IdentifierExceptionpublic void delete(Context context, DSpaceObject dso, String identifier) throws IdentifierException
IdentifierProviderdelete in class IdentifierProviderdso - object to be de-identified.identifier - to be removed.IdentifierExceptionpublic void deleteOnline(Context context, String identifier) throws DOIIdentifierException
DOIIdentifierExceptionpublic static DSpaceObject getObjectByDOI(Context context, String identifier) throws SQLException, DOIIdentifierException, IllegalArgumentException
context - the contextidentifier - The DOI in a format that is accepted by
formatIdentifier(String).SQLExceptionIdentifierException - If identifier is null or an empty string.IllegalArgumentException - If the identifier couldn't be recognized as DOI.DOIIdentifierExceptionpublic static String getDOIByObject(Context context, DSpaceObject dso) throws SQLException
context - dso - DSpaceObject to find doi for. DOIs with status TO_BE_DELETED will be
ignored.SQLExceptionprotected TableRow loadOrCreateDOI(Context context, DSpaceObject dso, String doi) throws SQLException, DOIIdentifierException
context - dso - The DSpaceObject the DOI should be loaded or created for.doi - 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 static 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.SQLExceptionAuthorizeExceptionIdentifierExceptionprotected 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.AuthorizeExceptionSQLExceptionIdentifierExceptionCopyright © 2013 DuraSpace. All Rights Reserved.