Package org.dspace.identifier.doi
Class DataCiteConnector
java.lang.Object
org.dspace.identifier.doi.DataCiteConnector
- All Implemented Interfaces:
DOIConnector
- Author:
- Pascal-Nicolas Becker
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConfigurationServiceprotected StringName of crosswalk to convert metadata into DataCite Metadata Scheme.protected StringPath on the DataCite server used to generate DOIs.protected HandleServiceprotected StringStores the hostname of the DataCite server.protected StringPath on the DataCite server used to register metadata.protected Stringprotected StringStores the scheme used to connect to the DataCite server.protected Stringprotected ParameterizedDisseminationCrosswalkDisseminationCrosswalk to map local metadata into DataCite metadata. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.jdom2.ElementvoidSends the DELETE-Request to the DOI registry.protected StringextractAlternateIdentifier(Context context, String content) protected StringextractDOI(org.jdom2.Element root) protected Stringprotected StringbooleanisDOIRegistered(Context context, String doi) booleanisDOIReserved(Context context, String doi) protected voidvoidregisterDOI(Context context, DSpaceObject dso, String doi) Sends a request to the DOI registry to register a DOI.voidreserveDOI(Context context, DSpaceObject dso, String doi) Sends a request to the DOI registry to reserve a DOI.protected DataCiteConnector.DataCiteResponsesendDOIGetRequest(String doi) protected DataCiteConnector.DataCiteResponsesendDOIPostRequest(String doi, String url) protected DataCiteConnector.DataCiteResponsesendGetRequest(String doi, String path) protected DataCiteConnector.DataCiteResponsesendHttpRequest(org.apache.http.client.methods.HttpUriRequest req, String doi) Internal method to send requests prepared by the caller to DataCite.protected DataCiteConnector.DataCiteResponseprotected DataCiteConnector.DataCiteResponseprotected DataCiteConnector.DataCiteResponsesendMetadataPostRequest(String doi, String metadata) Send a DataCite metadata document to the registrar.protected DataCiteConnector.DataCiteResponsesendMetadataPostRequest(String doi, org.jdom2.Element metadataRoot) Send a DataCite metadata document to the registrar.voidsetConfigurationService(ConfigurationService configurationService) voidsetDATACITE_DOI_PATH(String DATACITE_DOI_PATH) Set the path on the DataCite server to register DOIs.voidsetDATACITE_HOST(String DATACITE_HOST) Set the hostname of the DataCite server.voidsetDATACITE_METADATA_PATH(String DATACITE_METADATA_PATH) Set the path to register metadata on DataCite server.voidsetDATACITE_SCHEME(String DATACITE_SCHEME) Used to set the scheme to connect the DataCite server.voidsetDisseminationCrosswalkName(String CROSSWALK_NAME) Set the name of the dissemination crosswalk used to convert the metadata into DataCite Metadata Schema.voidupdateMetadata(Context context, DSpaceObject dso, String doi) Sends a request to the DOI registry to update metadata for a DOI.
-
Field Details
-
SCHEME
Stores the scheme used to connect to the DataCite server. It will be set by spring dependency injection. -
HOST
Stores the hostname of the DataCite server. Set by spring dependency injection. -
DOI_PATH
Path on the DataCite server used to generate DOIs. Set by spring dependency injection. -
METADATA_PATH
Path on the DataCite server used to register metadata. Set by spring dependency injection. -
CROSSWALK_NAME
Name of crosswalk to convert metadata into DataCite Metadata Scheme. Set by spring dependency injection. -
xwalk
DisseminationCrosswalk to map local metadata into DataCite metadata. The name of the crosswalk is set by spring dependency injection usingsetDisseminationCrosswalkNamewhich instantiates the crosswalk. -
configurationService
-
USERNAME
-
PASSWORD
-
handleService
-
-
Constructor Details
-
DataCiteConnector
public DataCiteConnector()
-
-
Method Details
-
setDATACITE_SCHEME
Used to set the scheme to connect the DataCite server. Used by spring dependency injection.- Parameters:
DATACITE_SCHEME- Probably https or http.
-
setDATACITE_HOST
Set the hostname of the DataCite server. Used by spring dependency injection.- Parameters:
DATACITE_HOST- Hostname to connect to register DOIs (f.e. test.datacite.org).
-
setDATACITE_DOI_PATH
Set the path on the DataCite server to register DOIs. Used by spring dependency injection.- Parameters:
DATACITE_DOI_PATH- Path to register DOIs, f.e. /doi.
-
setDATACITE_METADATA_PATH
Set the path to register metadata on DataCite server. Used by spring dependency injection.- Parameters:
DATACITE_METADATA_PATH- Path to register metadata, f.e. /mds.
-
setConfigurationService
@Autowired(required=true) public void setConfigurationService(ConfigurationService configurationService) -
setDisseminationCrosswalkName
Set the name of the dissemination crosswalk used to convert the metadata into DataCite Metadata Schema. Used by spring dependency injection.- Parameters:
CROSSWALK_NAME- The name of the dissemination crosswalk to use. This crosswalk must be configured in dspace.cfg.
-
prepareXwalk
protected void prepareXwalk() -
getUsername
-
getPassword
-
isDOIReserved
- Specified by:
isDOIReservedin interfaceDOIConnector- Throws:
DOIIdentifierException
-
isDOIRegistered
- Specified by:
isDOIRegisteredin interfaceDOIConnector- Throws:
DOIIdentifierException
-
deleteDOI
Description copied from interface:DOIConnectorSends the DELETE-Request to the DOI registry.This method sends a request to "delete" a DOI. As DOIs are persistent identifiers they should never be deleted. For example, if you send a HTTP DELETE request to the DataCite Metadata API directly, it will set the DOI to inactive.
- Specified by:
deleteDOIin interfaceDOIConnector- Parameters:
context- The relevant DSpace Context.doi- DOI string to "delete"- Throws:
DOIIdentifierException- if DOI error
-
reserveDOI
Description copied from interface:DOIConnectorSends a request to the DOI registry to reserve a DOI. The DOIConnector should check weather this DOI is reserved for another object already. In this case it should throw anDOIIdentifierException. DOIIdentifierException} and set the error code toDOIIdentifierException.DOI_ALREADY_EXISTS.- Specified by:
reserveDOIin interfaceDOIConnector- Parameters:
context- The relevant DSpace Context.dso- DSpace object to associate to the DOIdoi- DOI string to reserve- Throws:
DOIIdentifierException- if DOI error
-
registerDOI
public void registerDOI(Context context, DSpaceObject dso, String doi) throws DOIIdentifierException Description copied from interface:DOIConnectorSends a request to the DOI registry to register a DOI. The DOIConnector ensures compliance with the workflow of the registration agency. For example, if a DOI has to be reserved before it can be registered the DOIConnector has to check if it is reserved. In this case you can throw anDOIIdentifierException. and set the error code toDOIIdentifierException.RESERVE_FIRST.- Specified by:
registerDOIin interfaceDOIConnector- Parameters:
context- The relevant DSpace Context.dso- DSpace object to associate to the DOIdoi- DOI string to register- Throws:
DOIIdentifierException- if DOI error
-
updateMetadata
public void updateMetadata(Context context, DSpaceObject dso, String doi) throws DOIIdentifierException Description copied from interface:DOIConnectorSends a request to the DOI registry to update metadata for a DOI. The DOIConnector should check weather the DOI is reserved or registered for the specified DSpace Object before it sends the metadata update.- Specified by:
updateMetadatain interfaceDOIConnector- Parameters:
context- The relevant DSpace Context.dso- DSpace object associated to the DOIdoi- DOI string to update (metadata)- Throws:
DOIIdentifierException- if DOI error
-
sendDOIPostRequest
protected DataCiteConnector.DataCiteResponse sendDOIPostRequest(String doi, String url) throws DOIIdentifierException - Throws:
DOIIdentifierException
-
sendMetadataDeleteRequest
protected DataCiteConnector.DataCiteResponse sendMetadataDeleteRequest(String doi) throws DOIIdentifierException - Throws:
DOIIdentifierException
-
sendDOIGetRequest
protected DataCiteConnector.DataCiteResponse sendDOIGetRequest(String doi) throws DOIIdentifierException - Throws:
DOIIdentifierException
-
sendMetadataGetRequest
protected DataCiteConnector.DataCiteResponse sendMetadataGetRequest(String doi) throws DOIIdentifierException - Throws:
DOIIdentifierException
-
sendGetRequest
protected DataCiteConnector.DataCiteResponse sendGetRequest(String doi, String path) throws DOIIdentifierException - Throws:
DOIIdentifierException
-
sendMetadataPostRequest
protected DataCiteConnector.DataCiteResponse sendMetadataPostRequest(String doi, org.jdom2.Element metadataRoot) throws DOIIdentifierException Send a DataCite metadata document to the registrar.- Parameters:
doi- identify the object.metadataRoot- describe the object. The root element of the document.- Returns:
- the registrar's response.
- Throws:
DOIIdentifierException- passed through.
-
sendMetadataPostRequest
protected DataCiteConnector.DataCiteResponse sendMetadataPostRequest(String doi, String metadata) throws DOIIdentifierException Send a DataCite metadata document to the registrar.- Parameters:
doi- identify the object.metadata- describe the object.- Returns:
- the registrar's response.
- Throws:
DOIIdentifierException- passed through.
-
sendHttpRequest
protected DataCiteConnector.DataCiteResponse sendHttpRequest(org.apache.http.client.methods.HttpUriRequest req, String doi) throws DOIIdentifierException Internal method to send requests prepared by the caller to DataCite.- Parameters:
req- Extended version of the HttpRequest interface that provides convenience methods to access request properties such as request URI and method type.doi- DOI string to operate on- Returns:
- response from DataCite
- Throws:
DOIIdentifierException- if registrar returns an error.
-
extractAlternateIdentifier
protected String extractAlternateIdentifier(Context context, String content) throws SQLException, DOIIdentifierException - Throws:
SQLExceptionDOIIdentifierException
-
extractDOI
-
addDOI
-