org.dspace.identifier
Class VersionedHandleIdentifierProvider

java.lang.Object
  extended by org.dspace.identifier.IdentifierProvider
      extended by org.dspace.identifier.VersionedHandleIdentifierProvider

@Component
public class VersionedHandleIdentifierProvider
extends IdentifierProvider

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 inherited from class org.dspace.identifier.IdentifierProvider
configurationService, parentService
 
Constructor Summary
VersionedHandleIdentifierProvider()
           
 
Method Summary
protected static String createId(int id)
          Create a new handle id.
protected  String createNewIdentifier(Context context, DSpaceObject dso, String handleId)
           
protected  VersionImpl createVersion(Context c, VersionHistory vh, Item item, String summary, Date date, int versionNumber)
           
 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  String getCanonical(Item item)
           
protected  String getCanonical(String identifier)
           
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.
protected  int getNextVersionNumer(Version latest)
           
static String getPrefix()
          Get the configured Handle prefix string, or a default
 String lookup(Context context, DSpaceObject dso)
           
protected  String makeIdentifierBasedOnHistory(Context context, DSpaceObject dso, String handleId, VersionHistory history)
           
 String mint(Context context, DSpaceObject dso)
          Creates a new handle in the database.
protected  void modifyHandleMetadata(Item item, String handle)
           
protected  String modifyHandleRecord(Context context, DSpaceObject dso, TableRow handle, String handleId)
           
protected  void populateHandleMetadata(Item item)
           
 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)
           
protected  VersionHistory retrieveVersionHistory(Context c, Item item)
           
 void setVersionDAO(VersionDAO versionDAO)
           
 void setVersionHistoryDAO(VersionHistoryDAO versionHistoryDAO)
           
 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
 

Constructor Detail

VersionedHandleIdentifierProvider

public VersionedHandleIdentifierProvider()
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

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

makeIdentifierBasedOnHistory

protected String makeIdentifierBasedOnHistory(Context context,
                                              DSpaceObject dso,
                                              String handleId,
                                              VersionHistory history)
                                       throws AuthorizeException,
                                              SQLException
Throws:
AuthorizeException
SQLException

modifyHandleRecord

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

getCanonical

protected String getCanonical(Item item)

getCanonical

protected String getCanonical(String identifier)

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

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

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

retrieveVersionHistory

protected VersionHistory retrieveVersionHistory(Context c,
                                                Item item)

populateHandleMetadata

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

modifyHandleMetadata

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

createVersion

protected VersionImpl createVersion(Context c,
                                    VersionHistory vh,
                                    Item item,
                                    String summary,
                                    Date date,
                                    int versionNumber)

getNextVersionNumer

protected int getNextVersionNumer(Version latest)

setVersionDAO

public void setVersionDAO(VersionDAO versionDAO)

setVersionHistoryDAO

public void setVersionHistoryDAO(VersionHistoryDAO versionHistoryDAO)


Copyright © 2012 DuraSpace. All Rights Reserved.