Package org.dspace.identifier
Class EZIDIdentifierProvider
- java.lang.Object
-
- org.dspace.identifier.IdentifierProvider
-
- org.dspace.identifier.EZIDIdentifierProvider
-
public class EZIDIdentifierProvider extends IdentifierProvider
Provide service for DOIs through DataCite using the EZID service.Configuration of this class is is in two parts.
Installation-specific configuration (credentials and the "shoulder" value which forms a prefix of the site's DOIs) is supplied from property files in [DSpace]/config**.
- identifier.doi.ezid.shoulder
- base of the site's DOIs. Example: 10.5072/FK2
- identifier.doi.ezid.user
- EZID username.
- identifier.doi.ezid.password
- EZID password.
- identifier.doi.ezid.publisher
- A default publisher, for Items not previously published. EZID requires a publisher.
Then there are properties injected using Spring:
- There is a Map (with the property name "crosswalk") from EZID metadata field names into DSpace field names, injected by Spring. Specify the fully-qualified names of all metadata fields to be looked up on a DSpace object and their values set on mapped fully-qualified names in the object's DataCite metadata.
- A second map ("crosswalkTransform") provides Transform instances mapped from EZID metadata field names. This allows the crosswalk to rewrite field values where the form maintained by DSpace is not directly usable in EZID metadata.
- Optional: A boolean property ("generateDataciteXML") that controls the creation and inclusion of DataCite xml schema during the metadata crosswalking. The default "DataCite" dissemination plugin uses DIM2DataCite.xsl for crosswalking. Default value: false.
- Optional: A string property ("disseminationCrosswalkName") that can be used to set the name of the dissemination crosswalk plugin for metadata crosswalking. Default value: "DataCite".
- Author:
- mwood
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentServiceFactorycontentServiceFactoryprotected StringDATACITE_XML_CROSSWALKstatic StringDOI_ELEMENTstatic StringDOI_QUALIFIERprotected booleanGENERATE_DATACITE_XMLprotected ItemServiceitemServicestatic StringMD_SCHEMA-
Fields inherited from class org.dspace.identifier.IdentifierProvider
configurationService, parentService
-
-
Constructor Summary
Constructors Constructor Description EZIDIdentifierProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(Context context, DSpaceObject dso)Unbind this type of identifier(s) from an object.voiddelete(Context context, DSpaceObject dso, String identifier)Unbind the given identifier from an object.Map<String,String>getCrosswalk()EZIDRequestFactorygetRequestFactory()Stringlookup(Context context, DSpaceObject object)Return the identifier for a DSpaceObject.Stringmint(Context context, DSpaceObject dso)Create an identifier for a DSpaceObject.Stringregister(Context context, DSpaceObject dso)Create and apply an identifier to a DSpaceObject.voidregister(Context context, DSpaceObject object, String identifier)Create a specific identifier and apply it to an object.voidreserve(Context context, DSpaceObject dso, String identifier)Set an object's identifier.DSpaceObjectresolve(Context context, String identifier, String... attributes)Find the object named by a given identifier.voidsetCrosswalk(Map<String,String> aCrosswalk)Provide a map from DSO metadata keys to EZID keys.voidsetCrosswalkTransform(Map<String,Transform> transformMap)Provide a map from DSO metadata keys to classes which can transform their values to something acceptable to EZID.voidsetDisseminationCrosswalkName(String DATACITE_XML_CROSSWALK)voidsetGenerateDataciteXML(boolean GENERATE_DATACITE_XML)protected voidsetItemService(ItemService itemService)Method should never be used aside from the unit tests where we can cannot autowire this class.voidsetRequestFactory(EZIDRequestFactory aRequestFactory)booleansupports(Class<? extends Identifier> identifier)Can this provider provide identifiers of a given type?booleansupports(String identifier)Can this provider provide identifiers of a given type?-
Methods inherited from class org.dspace.identifier.IdentifierProvider
setConfigurationService, setParentService
-
-
-
-
Field Detail
-
MD_SCHEMA
public static final String MD_SCHEMA
- See Also:
- Constant Field Values
-
DOI_ELEMENT
public static final String DOI_ELEMENT
- See Also:
- Constant Field Values
-
DOI_QUALIFIER
public static final String DOI_QUALIFIER
-
GENERATE_DATACITE_XML
protected boolean GENERATE_DATACITE_XML
-
DATACITE_XML_CROSSWALK
protected String DATACITE_XML_CROSSWALK
-
contentServiceFactory
@Autowired(required=true) protected ContentServiceFactory contentServiceFactory
-
itemService
@Autowired(required=true) protected ItemService itemService
-
-
Method Detail
-
supports
public boolean supports(Class<? extends Identifier> identifier)
Description copied from class:IdentifierProviderCan this provider provide identifiers of a given type?- Specified by:
supportsin classIdentifierProvider- Parameters:
identifier- requested type.- Returns:
- true if the given type is assignable from this provider's type.
-
supports
public boolean supports(String identifier)
Description copied from class:IdentifierProviderCan this provider provide identifiers of a given type?- Specified by:
supportsin classIdentifierProvider- Parameters:
identifier- requested type.- Returns:
- true if this provider can provide the named type of identifier.
-
register
public String register(Context context, DSpaceObject dso) throws IdentifierException
Description copied from class:IdentifierProviderCreate and apply an identifier to a DSpaceObject.- Specified by:
registerin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to be named.- Returns:
- existing identifier of
itemif it has one, else a new identifier. - Throws:
IdentifierException- if identifier error
-
register
public void register(Context context, DSpaceObject object, String identifier)
Description copied from class:IdentifierProviderCreate a specific identifier and apply it to an object.- Specified by:
registerin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.object- to be identified.identifier- to be created.
-
reserve
public void reserve(Context context, DSpaceObject dso, String identifier) throws IdentifierException
Description copied from class:IdentifierProviderSet an object's identifier.- Specified by:
reservein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to be identified.identifier- to be set on the object.- Throws:
IdentifierException- if identifier error
-
mint
public String mint(Context context, DSpaceObject dso) throws IdentifierException
Description copied from class:IdentifierProviderCreate an identifier for a DSpaceObject.- Specified by:
mintin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to be named.- Returns:
- existing identifier of
dsoif it has one, else a new identifier. - Throws:
IdentifierException- if identifier error
-
resolve
public DSpaceObject resolve(Context context, String identifier, String... attributes) throws IdentifierNotFoundException, IdentifierNotResolvableException
Description copied from class:IdentifierProviderFind the object named by a given identifier.- Specified by:
resolvein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.identifier- to be resolved.attributes- additional information for resolvingidentifier.- Returns:
- the named object.
- Throws:
IdentifierNotFoundException- if identifier not foundIdentifierNotResolvableException- if identifier not resolvable
-
lookup
public String lookup(Context context, DSpaceObject object) throws IdentifierNotFoundException, IdentifierNotResolvableException
Description copied from class:IdentifierProviderReturn the identifier for a DSpaceObject.- Specified by:
lookupin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.object- The object to be looked up.- Returns:
- identifier for
object. - Throws:
IdentifierNotFoundException- if identifier not foundIdentifierNotResolvableException- if identifier not resolvable
-
delete
public void delete(Context context, DSpaceObject dso) throws IdentifierException
Description copied from class:IdentifierProviderUnbind this type of identifier(s) from an object.- Specified by:
deletein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to lose its identity.- Throws:
IdentifierException- if identifier error
-
delete
public void delete(Context context, DSpaceObject dso, String identifier) throws IdentifierException
Description copied from class:IdentifierProviderUnbind the given identifier from an object.- Specified by:
deletein classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- object to be de-identified.identifier- to be removed.- Throws:
IdentifierException- if identifier error
-
setCrosswalk
@Autowired(required=true) public void setCrosswalk(Map<String,String> aCrosswalk)
Provide a map from DSO metadata keys to EZID keys. This will drive the generation of EZID metadata for the minting of new identifiers.- Parameters:
aCrosswalk- map of metadata fields to EZID keys
-
setCrosswalkTransform
public void setCrosswalkTransform(Map<String,Transform> transformMap)
Provide a map from DSO metadata keys to classes which can transform their values to something acceptable to EZID.- Parameters:
transformMap- map of metadata fields to EZID transformation classes
-
setGenerateDataciteXML
public void setGenerateDataciteXML(boolean GENERATE_DATACITE_XML)
-
setDisseminationCrosswalkName
public void setDisseminationCrosswalkName(String DATACITE_XML_CROSSWALK)
-
setRequestFactory
@Autowired(required=true) public void setRequestFactory(EZIDRequestFactory aRequestFactory)
-
getRequestFactory
public EZIDRequestFactory getRequestFactory()
-
setItemService
protected void setItemService(ItemService itemService)
Method should never be used aside from the unit tests where we can cannot autowire this class.- Parameters:
itemService- itemService instance
-
-