Package org.dspace.identifier
Class HandleIdentifierProvider
- java.lang.Object
-
- org.dspace.identifier.IdentifierProvider
-
- org.dspace.identifier.HandleIdentifierProvider
-
@Component public class HandleIdentifierProvider extends IdentifierProvider
The old DSpace handle identifier service, used to create handles or retrieve objects based on their handle- Author:
- Fabio Bolognesi (fabio at atmire dot com), Mark Diggory (markd at atmire dot com), Ben Bosman (ben at atmire dot com)
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringEXAMPLE_PREFIXPrefix registered to no oneprotected HandleServicehandleServiceprotected ItemServiceitemService-
Fields inherited from class org.dspace.identifier.IdentifierProvider
configurationService, parentService
-
-
Constructor Summary
Constructors Constructor Description HandleIdentifierProvider()
-
Method Summary
All Methods Static 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.static StringgetPrefix()Get the configured Handle prefix string, or a defaultStringlookup(Context context, DSpaceObject dso)Return the identifier for a DSpaceObject.Stringmint(Context context, DSpaceObject dso)Creates a new handle in the database.protected voidpopulateHandleMetadata(Context context, Item item, String handle)Stringregister(Context context, DSpaceObject dso)Create and apply an identifier to a DSpaceObject.voidregister(Context context, DSpaceObject dso, 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.static StringretrieveHandleOutOfUrl(String url)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
-
EXAMPLE_PREFIX
protected static final String EXAMPLE_PREFIX
Prefix registered to no one- See Also:
- Constant Field Values
-
handleService
@Autowired(required=true) protected HandleService handleService
-
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)
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.
-
register
public void register(Context context, DSpaceObject dso, 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.dso- to be identified.identifier- to be created.
-
reserve
public void reserve(Context context, DSpaceObject dso, String identifier)
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.
-
mint
public String mint(Context context, DSpaceObject dso)
Creates a new handle in the database.- Specified by:
mintin classIdentifierProvider- Parameters:
context- DSpace contextdso- The DSpaceObject to create a handle for- Returns:
- The newly created handle
-
resolve
public DSpaceObject resolve(Context context, String identifier, String... attributes)
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.
-
lookup
public String lookup(Context context, DSpaceObject dso) throws IdentifierNotFoundException, IdentifierNotResolvableException
Description copied from class:IdentifierProviderReturn the identifier for a DSpaceObject.- Specified by:
lookupin classIdentifierProvider- Parameters:
context- The relevant DSpace Context.dso- 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, 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
-
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
-
retrieveHandleOutOfUrl
public static String retrieveHandleOutOfUrl(String url) throws SQLException
- Throws:
SQLException
-
getPrefix
public static String getPrefix()
Get the configured Handle prefix string, or a default- Returns:
- configured prefix or "123456789"
-
populateHandleMetadata
protected void populateHandleMetadata(Context context, Item item, String handle) throws SQLException, IOException, AuthorizeException
-
-