org.dspace.identifier
Class HandleIdentifierProvider

java.lang.Object
  extended by org.dspace.identifier.IdentifierProvider
      extended by 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
protected static String EXAMPLE_PREFIX
          Prefix registered to no one
protected  String[] supportedPrefixes
           
 
Fields inherited from class org.dspace.identifier.IdentifierProvider
configurationService, parentService
 
Constructor Summary
HandleIdentifierProvider()
           
 
Method Summary
protected static String createId(int id)
          Create a new handle id.
protected  String createNewIdentifier(Context context, DSpaceObject dso, String handleId)
           
 void delete(Context context, DSpaceObject dso)
           
 void delete(Context context, DSpaceObject dso, String identifier)
           
protected static TableRow findHandleInternal(Context context, String handle)
          Find the database row corresponding to handle.
protected static String getCanonicalForm(String handle)
           
protected static TableRow getHandleInternal(Context context, int type, int id)
          Return the handle for an Object, or null if the Object has no handle.
static String getPrefix()
          Get the configured Handle prefix string, or a default
 String lookup(Context context, DSpaceObject dso)
           
 String mint(Context context, DSpaceObject dso)
          Creates a new handle in the database.
protected  String modifyHandleRecord(Context context, DSpaceObject dso, TableRow handle, String handleId)
           
protected  void populateHandleMetadata(Item item, String handle)
           
 String register(Context context, DSpaceObject dso)
           
 void register(Context context, DSpaceObject dso, String identifier)
           
 void reserve(Context context, DSpaceObject dso, String identifier)
           
 DSpaceObject resolve(Context context, String identifier, String... attributes)
           
static String retrieveHandleOutOfUrl(String url)
           
 boolean supports(Class<? extends Identifier> identifier)
           
 boolean supports(String identifier)
           
 
Methods inherited from class org.dspace.identifier.IdentifierProvider
setConfigurationService, setParentService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXAMPLE_PREFIX

protected static final String EXAMPLE_PREFIX
Prefix registered to no one

See Also:
Constant Field Values

supportedPrefixes

protected String[] supportedPrefixes
Constructor Detail

HandleIdentifierProvider

public HandleIdentifierProvider()
Method Detail

supports

public boolean supports(Class<? extends Identifier> identifier)
Specified by:
supports in class IdentifierProvider

supports

public boolean supports(String identifier)
Specified by:
supports in class IdentifierProvider

register

public String register(Context context,
                       DSpaceObject dso)
Specified by:
register in class IdentifierProvider

register

public void register(Context context,
                     DSpaceObject dso,
                     String identifier)
Specified by:
register in class IdentifierProvider

reserve

public void reserve(Context context,
                    DSpaceObject dso,
                    String identifier)
Specified by:
reserve in class IdentifierProvider

mint

public String mint(Context context,
                   DSpaceObject dso)
Creates a new handle in the database.

Specified by:
mint in class IdentifierProvider
Parameters:
context - DSpace context
dso - The DSpaceObject to create a handle for
Returns:
The newly created handle
Throws:
SQLException - If a database error occurs

resolve

public DSpaceObject resolve(Context context,
                            String identifier,
                            String... attributes)
Specified by:
resolve in class IdentifierProvider

lookup

public String lookup(Context context,
                     DSpaceObject dso)
              throws IdentifierNotFoundException,
                     IdentifierNotResolvableException
Specified by:
lookup in class IdentifierProvider
Throws:
IdentifierNotFoundException
IdentifierNotResolvableException

delete

public void delete(Context context,
                   DSpaceObject dso,
                   String identifier)
            throws IdentifierException
Specified by:
delete in class IdentifierProvider
Throws:
IdentifierException

delete

public void delete(Context context,
                   DSpaceObject dso)
            throws IdentifierException
Specified by:
delete in class IdentifierProvider
Throws:
IdentifierException

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"

getCanonicalForm

protected static String getCanonicalForm(String handle)

createNewIdentifier

protected String createNewIdentifier(Context context,
                                     DSpaceObject dso,
                                     String handleId)
                              throws SQLException
Throws:
SQLException

modifyHandleRecord

protected String modifyHandleRecord(Context context,
                                    DSpaceObject dso,
                                    TableRow handle,
                                    String handleId)
                             throws SQLException
Throws:
SQLException

getHandleInternal

protected static TableRow getHandleInternal(Context context,
                                            int type,
                                            int id)
                                     throws SQLException
Return the handle for an Object, or null if the Object has no handle.

Parameters:
context - DSpace context
type - The type of object
id - The id of object
Returns:
The handle for object, or null if the object has no handle.
Throws:
SQLException - If a database error occurs

findHandleInternal

protected static TableRow findHandleInternal(Context context,
                                             String handle)
                                      throws SQLException
Find the database row corresponding to handle.

Parameters:
context - DSpace context
handle - The handle to resolve
Returns:
The database row corresponding to the handle
Throws:
SQLException - If a database error occurs

createId

protected static String createId(int id)
                          throws SQLException
Create a new handle id. The implementation uses the PK of the RDBMS Handle table.

Returns:
A new handle id
Throws:
SQLException - If a database error occurs

populateHandleMetadata

protected void populateHandleMetadata(Item item,
                                      String handle)
                               throws SQLException,
                                      IOException,
                                      AuthorizeException
Throws:
SQLException
IOException
AuthorizeException


Copyright © 2012 DuraSpace. All Rights Reserved.