Package org.dspace.handle.service
Interface HandleService
-
- All Known Implementing Classes:
HandleServiceImpl
public interface HandleServiceInterface to the CNRI Handle System .Currently, this class simply maps handles to local facilities; handles which are owned by other sites (including other DSpaces) are treated as non-existent.
- Version:
- $Revision$
- Author:
- Peter Breton
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longcountHandlesByPrefix(Context context, String prefix)intcountTotal(Context context)StringcreateHandle(Context context, DSpaceObject dso)Creates a new handle in the database.StringcreateHandle(Context context, DSpaceObject dso, String suppliedHandle)Creates a handle entry, but with a handle supplied by the caller (new Handle not generated)StringcreateHandle(Context context, DSpaceObject dso, String suppliedHandle, boolean force)Creates a handle entry, but with a handle supplied by the caller (new Handle not generated)StringfindHandle(Context context, DSpaceObject dso)Return the handle for an Object, or null if the Object has no handle.StringgetCanonicalForm(String handle)Transforms handle into a URI using http://hdl.handle.net if not overridden by the configuration property handle.canonical.prefix.StringgetCanonicalPrefix()Provides handle canonical prefix using http://hdl.handle.net if not overridden by the configuration property handle.canonical.prefix.List<String>getHandlesForPrefix(Context context, String prefix)Return all the handles which start with prefix.StringgetPrefix()Get the configured Handle prefix string, or a defaultvoidmodifyHandleDSpaceObject(Context context, String handle, DSpaceObject newOwner)DSpaceObjectresolveToObject(Context context, String handle)Return the object which handle maps to, or null.StringresolveToURL(Context context, String handle)Return the local URL for handle, or null if handle cannot be found.StringresolveUrlToHandle(Context context, String url)Try to detect a handle in a URL.voidunbindHandle(Context context, DSpaceObject dso)Removes binding of Handle to a DSpace object, while leaving the Handle in the table so it doesn't get reallocated.intupdateHandlesWithNewPrefix(Context context, String newPrefix, String oldPrefix)
-
-
-
Method Detail
-
resolveToURL
String resolveToURL(Context context, String handle) throws SQLException
Return the local URL for handle, or null if handle cannot be found. The returned URL is a (non-handle-based) location where a dissemination of the object referred to by handle can be obtained.- Parameters:
context- DSpace contexthandle- The handle- Returns:
- The local URL
- Throws:
SQLException- If a database error occurs
-
resolveUrlToHandle
String resolveUrlToHandle(Context context, String url) throws SQLException
Try to detect a handle in a URL.- Parameters:
context- DSpace contexturl- The URL- Returns:
- The handle or null if the handle couldn't be extracted of a URL or if the extracted handle couldn't be found.
- Throws:
SQLException- If a database error occurs
-
getCanonicalPrefix
String getCanonicalPrefix()
Provides handle canonical prefix using http://hdl.handle.net if not overridden by the configuration property handle.canonical.prefix. No attempt is made to verify that handle is in fact valid.- Parameters:
handle- The handle- Returns:
- The canonical form
-
getCanonicalForm
String getCanonicalForm(String handle)
Transforms handle into a URI using http://hdl.handle.net if not overridden by the configuration property handle.canonical.prefix. No attempt is made to verify that handle is in fact valid.- Parameters:
handle- The handle- Returns:
- The canonical form
-
createHandle
String createHandle(Context context, DSpaceObject dso) throws SQLException
Creates a new handle in the database.- Parameters:
context- DSpace contextdso- The DSpaceObject to create a handle for- Returns:
- The newly created handle
- Throws:
SQLException- If a database error occurs
-
createHandle
String createHandle(Context context, DSpaceObject dso, String suppliedHandle) throws SQLException, IllegalStateException
Creates a handle entry, but with a handle supplied by the caller (new Handle not generated)- Parameters:
context- DSpace contextdso- DSpaceObjectsuppliedHandle- existing handle value- Returns:
- the Handle
- Throws:
SQLException- An exception that provides information on a database access error or other errors.IllegalStateException- if specified handle is already in use by another object
-
createHandle
String createHandle(Context context, DSpaceObject dso, String suppliedHandle, boolean force) throws SQLException, IllegalStateException
Creates a handle entry, but with a handle supplied by the caller (new Handle not generated)- Parameters:
context- DSpace contextdso- DSpaceObjectsuppliedHandle- existing handle valueforce- FIXME: currently unused- Returns:
- the Handle
- Throws:
SQLException- An exception that provides information on a database access error or other errors.IllegalStateException- if specified handle is already in use by another object
-
unbindHandle
void unbindHandle(Context context, DSpaceObject dso) throws SQLException
Removes binding of Handle to a DSpace object, while leaving the Handle in the table so it doesn't get reallocated. The AIP implementation also needs it there for foreign key references.- Parameters:
context- DSpace contextdso- DSpaceObject whose Handle to unbind.- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
resolveToObject
DSpaceObject resolveToObject(Context context, String handle) throws IllegalStateException, SQLException
Return the object which handle maps to, or null. This is the object itself, not a URL which points to it.- Parameters:
context- DSpace contexthandle- The handle to resolve- Returns:
- The object which handle maps to, or null if handle is not mapped to any object.
- Throws:
IllegalStateException- If handle was found but is not bound to an objectSQLException- If a database error occurs
-
findHandle
String findHandle(Context context, DSpaceObject dso) throws SQLException
Return the handle for an Object, or null if the Object has no handle.- Parameters:
context- DSpace contextdso- The object to obtain a handle for- Returns:
- The handle for object, or null if the object has no handle.
- Throws:
SQLException- If a database error occurs
-
getHandlesForPrefix
List<String> getHandlesForPrefix(Context context, String prefix) throws SQLException
Return all the handles which start with prefix.- Parameters:
context- DSpace contextprefix- The handle prefix- Returns:
- A list of the handles starting with prefix. The list is guaranteed to be non-null. Each element of the list is a String.
- Throws:
SQLException- If a database error occurs
-
getPrefix
String getPrefix()
Get the configured Handle prefix string, or a default- Returns:
- configured prefix or "123456789"
-
countHandlesByPrefix
long countHandlesByPrefix(Context context, String prefix) throws SQLException
- Throws:
SQLException
-
updateHandlesWithNewPrefix
int updateHandlesWithNewPrefix(Context context, String newPrefix, String oldPrefix) throws SQLException
- Throws:
SQLException
-
modifyHandleDSpaceObject
void modifyHandleDSpaceObject(Context context, String handle, DSpaceObject newOwner) throws SQLException
- Throws:
SQLException
-
countTotal
int countTotal(Context context) throws SQLException
- Throws:
SQLException
-
-