Package org.mycore.pi.doi
Class MCRDOIService
java.lang.Object
org.mycore.pi.MCRPIService<T>
org.mycore.pi.MCRPIJobService<MCRDigitalObjectIdentifier>
org.mycore.pi.doi.MCRDOIBaseService
org.mycore.pi.doi.MCRDOIService
Registers
MCRDigitalObjectIdentifier
at Datacite.
Properties:
- MetadataManager
- A metadata manager which inserts the
MCRDigitalObjectIdentifier
to a object - Generator
- A
MCRPIGenerator
which generatesMCRDigitalObjectIdentifier
- Username
- The username which will be used for authentication
- Password
- The password which will be used for authentication
- RegisterBaseURL
- The BaseURL (everything before /receive/mcr_object_0000000) which will be send to Datacite.
- UseTestPrefix
- Deprecated use UseTestServer instead.
- UseTestServer
- Use the test server of Datacite instead of the production server! (Default is UseTestPrefix or false)
- RegistrationConditionProvider
- Used to detect if the registration should happen. DOI will be created but the real registration will if the Condition is true. The Parameter is optional and the default condition is always true.
- Schema
- The path to the schema. (must be in classpath; default is
DEFAULT_DATACITE_SCHEMA_PATH
) - Namespace
- The namespace for the Datacite version (Default is
KERNEL_3_NAMESPACE_URI
- JobApiUser
- The user which will be used to run the registration/update job
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mycore.pi.MCRPIJobService
MCRPIJobService.PiJobAction
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from class org.mycore.pi.doi.MCRDOIBaseService
CONTEXT_DOI, CONTEXT_OBJ
Fields inherited from class org.mycore.pi.MCRPIJobService
CREATION_PREDICATE, JOB_API_USER_PROPERTY, REGISTRATION_PREDICATE
Fields inherited from class org.mycore.pi.MCRPIService
GENERATOR_CONFIG_PREFIX, GENERATOR_PROPERTY_KEY, METADATA_SERVICE_CONFIG_PREFIX, METADATA_SERVICE_PROPERTY_KEY, PI_FLAG, REGISTRATION_CONFIG_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Checks the service parameters.void
delete
(MCRDigitalObjectIdentifier doi, MCRBase obj, String additional) Should handle deletion of a Object with the PI.void
protected String
protected MCRDigitalObjectIdentifier
getDOIFromJob
(Map<String, String> parameters) Gets theMCRDigitalObjectIdentifier
from the job parameters.getJobInformation
(Map<String, String> contextParameters) Result of this will be passed toMCRJobAction.name()
getMediaList
(MCRObject obj) Builds a list with with right content types and media urls assigned of a specific ObjectgetRegisteredURI
(MCRBase obj) void
registerIdentifier
(MCRBase obj, String additional, MCRDigitalObjectIdentifier newDOI) void
registerJob
(Map<String, String> parameters) protected Document
void
boolean
Deprecated.boolean
void
validateRegistration
(MCRBase obj, String additional) Validates if an object can get an Identifier assigned from this service!Methods inherited from class org.mycore.pi.doi.MCRDOIBaseService
checkJobValid, getPassword, getSchema, getTransformer, getTransformerID, getUsername, initCommonProperties, insertIdentifierToDatabase, provideRegisterDate, resolveSchema, setPassword, setSchema, setTransformerID, setUsername, startRegisterJob, update, validateDocument
Methods inherited from class org.mycore.pi.MCRPIJobService
addDeleteJob, addRegisterJob, addUpdateJob, getAction, getRegistrationCondition, parseIdentifier, rollbackDeleteJob, rollbackRegisterJob, rollbackUpdateJob, runAsJobUser, updateRegistrationDate, updateStartRegistrationDate, validateJobUserRights
Methods inherited from class org.mycore.pi.MCRPIService
addFlagToObject, getCreationPredicate, getGenerator, getGson, getMetadataService, getNewIdentifier, getPredicateInstance, getProperties, getRegistrationPredicate, getServiceID, getTableEntry, getType, hasFlag, hasFlag, hasRegistrationStarted, init, isCreated, isRegistered, onDelete, onUpdate, register, register, register, removeFlagFromObject, requireNotEmptyProperty, setProperties, updateFlag, updateFlagsInDatabase, validateAlreadyCreated, validatePermission, validateRegistration
-
Field Details
-
DATACITE_SCHEMA_V3
- See Also:
-
DATACITE_SCHEMA_V4
- See Also:
-
DATACITE_SCHEMA_V41
- See Also:
-
DATACITE_SCHEMA_V43
- See Also:
-
-
Constructor Details
-
MCRDOIService
public MCRDOIService()
-
-
Method Details
-
getDefaultSchemaPath
- Specified by:
getDefaultSchemaPath
in classMCRDOIBaseService
-
checkConfiguration
Description copied from class:MCRPIService
Checks the service parameters.- Overrides:
checkConfiguration
in classMCRPIJobService<MCRDigitalObjectIdentifier>
- Throws:
MCRConfigurationException
- if parameter is missing or wrong!
-
usesTestPrefix
Deprecated. -
usesTestServer
public boolean usesTestServer() -
getRegisterURL
-
validateRegistration
public void validateRegistration(MCRBase obj, String additional) throws MCRPersistentIdentifierException, MCRAccessException Description copied from class:MCRPIService
Validates if an object can get an Identifier assigned from this service! Better call super when overwrite!- Overrides:
validateRegistration
in classMCRPIService<MCRDigitalObjectIdentifier>
- Throws:
MCRPersistentIdentifierException
- seeorg.mycore.pi.exceptions
MCRAccessException
- if the user does not have the rights to assign a pi to the specific object
-
registerIdentifier
public void registerIdentifier(MCRBase obj, String additional, MCRDigitalObjectIdentifier newDOI) throws MCRPersistentIdentifierException - Specified by:
registerIdentifier
in classMCRPIService<MCRDigitalObjectIdentifier>
- Throws:
MCRPersistentIdentifierException
-
getRegisteredURI
- Throws:
URISyntaxException
-
getMediaList
Builds a list with with right content types and media urls assigned of a specific Object- Parameters:
obj
- the object- Returns:
- a list of entrys Media-Type, URL
-
getDataciteClient
-
transform
- Specified by:
transform
in classMCRDOIBaseService
- Throws:
MCRPersistentIdentifierException
-
delete
public void delete(MCRDigitalObjectIdentifier doi, MCRBase obj, String additional) throws MCRPersistentIdentifierException Description copied from class:MCRPIService
Should handle deletion of a Object with the PI. E.g. TheMCRDOIService
sets the active flag in Datacite datacentre to false.- Specified by:
delete
in classMCRPIService<MCRDigitalObjectIdentifier>
- Parameters:
doi
- the Identifierobj
- the deleted object- Throws:
MCRPersistentIdentifierException
- to abort deletion of the object or if something went wrong, (e.g.MCRDOIService
throws if not a superuser tries to delete the object)
-
deleteJob
- Specified by:
deleteJob
in classMCRPIJobService<MCRDigitalObjectIdentifier>
- Throws:
MCRPersistentIdentifierException
-
updateJob
- Specified by:
updateJob
in classMCRPIJobService<MCRDigitalObjectIdentifier>
- Throws:
MCRPersistentIdentifierException
-
registerJob
- Specified by:
registerJob
in classMCRPIJobService<MCRDigitalObjectIdentifier>
- Throws:
MCRPersistentIdentifierException
-
getDOIFromJob
protected MCRDigitalObjectIdentifier getDOIFromJob(Map<String, String> parameters) throws MCRPersistentIdentifierExceptionGets theMCRDigitalObjectIdentifier
from the job parameters. This method does not ensure that the returnedMCRDigitalObjectIdentifier
object instance is the same as the generated one.- Parameters:
parameters
- the job parameters- Returns:
- the parsed DOI
- Throws:
MCRPersistentIdentifierException
- if the DOI can not be parsed
-
getJobInformation
Description copied from class:MCRPIJobService
Result of this will be passed toMCRJobAction.name()
- Overrides:
getJobInformation
in classMCRDOIBaseService
- Parameters:
contextParameters
- the parameters of the job- Returns:
- Some Information what this job will do or just
Optional.empty()
, then a default message is generated.
-