public class HandleServiceImpl extends Object implements HandleService
Currently, this class simply maps handles to local facilities; handles which are owned by other sites (including other DSpaces) are treated as non-existent.
| Modifier and Type | Field and Description |
|---|---|
protected ConfigurationService |
configurationService |
protected HandleDAO |
handleDAO |
protected SiteService |
siteService |
| Modifier | Constructor and Description |
|---|---|
protected |
HandleServiceImpl()
Public Constructor
|
| Modifier and Type | Method and Description |
|---|---|
long |
countHandlesByPrefix(Context context,
String prefix) |
int |
countTotal(Context context) |
String |
createHandle(Context context,
DSpaceObject dso)
Creates a new handle in the database.
|
String |
createHandle(Context context,
DSpaceObject dso,
String suppliedHandle)
Creates a handle entry, but with a handle supplied by the caller (new
Handle not generated)
|
String |
createHandle(Context context,
DSpaceObject dso,
String suppliedHandle,
boolean force)
Creates a handle entry, but with a handle supplied by the caller (new
Handle not generated)
|
protected String |
createId(Context context)
Create/mint a new handle id.
|
String |
findHandle(Context context,
DSpaceObject dso)
Return the handle for an Object, or null if the Object has no handle.
|
protected Handle |
findHandleInternal(Context context,
String handle)
Find the database row corresponding to handle.
|
String |
getCanonicalForm(String handle)
Transforms handle into a URI 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.
|
protected List<Handle> |
getInternalHandles(Context context,
DSpaceObject dso)
Return the handle for an Object, or null if the Object has no handle.
|
String |
getPrefix()
Get the configured Handle prefix string, or a default
|
void |
modifyHandleDSpaceObject(Context context,
String handle,
DSpaceObject newOwner) |
DSpaceObject |
resolveToObject(Context context,
String handle)
Return the object which handle maps to, or null.
|
String |
resolveToURL(Context context,
String handle)
Return the local URL for handle, or null if handle cannot be found.
|
String |
resolveUrlToHandle(Context context,
String url)
Try to detect a handle in a URL.
|
void |
unbindHandle(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.
|
int |
updateHandlesWithNewPrefix(Context context,
String newPrefix,
String oldPrefix) |
@Autowired(required=true) protected HandleDAO handleDAO
@Autowired(required=true) protected ConfigurationService configurationService
@Autowired protected SiteService siteService
public String resolveToURL(Context context, String handle) throws SQLException
HandleServiceresolveToURL in interface HandleServicecontext - DSpace contexthandle - The handleSQLException - If a database error occurspublic String resolveUrlToHandle(Context context, String url) throws SQLException
HandleServiceresolveUrlToHandle in interface HandleServicecontext - DSpace contexturl - The URLSQLException - If a database error occurspublic String getCanonicalForm(String handle)
HandleServicegetCanonicalForm in interface HandleServicehandle - The handlepublic String createHandle(Context context, DSpaceObject dso) throws SQLException
HandleServicecreateHandle in interface HandleServicecontext - DSpace contextdso - The DSpaceObject to create a handle forSQLException - If a database error occurspublic String createHandle(Context context, DSpaceObject dso, String suppliedHandle) throws SQLException, IllegalStateException
HandleServicecreateHandle in interface HandleServicecontext - DSpace contextdso - DSpaceObjectsuppliedHandle - existing handle valueIllegalStateException - if specified handle is already in use by another objectSQLExceptionpublic String createHandle(Context context, DSpaceObject dso, String suppliedHandle, boolean force) throws SQLException, IllegalStateException
HandleServicecreateHandle in interface HandleServicecontext - DSpace contextdso - DSpaceObjectsuppliedHandle - existing handle valueIllegalStateException - if specified handle is already in use by another objectSQLExceptionpublic void unbindHandle(Context context, DSpaceObject dso) throws SQLException
HandleServiceunbindHandle in interface HandleServicecontext - DSpace contextdso - DSpaceObject whose Handle to unbind.SQLExceptionpublic DSpaceObject resolveToObject(Context context, String handle) throws IllegalStateException, SQLException
HandleServiceresolveToObject in interface HandleServicecontext - DSpace contexthandle - The handle to resolveIllegalStateException - If handle was found but is not bound to an objectSQLException - If a database error occurspublic String findHandle(Context context, DSpaceObject dso) throws SQLException
HandleServicefindHandle in interface HandleServicecontext - DSpace contextdso - The object to obtain a handle forSQLException - If a database error occurspublic List<String> getHandlesForPrefix(Context context, String prefix) throws SQLException
HandleServicegetHandlesForPrefix in interface HandleServicecontext - DSpace contextprefix - The handle prefixSQLException - If a database error occurspublic String getPrefix()
HandleServicegetPrefix in interface HandleServicepublic long countHandlesByPrefix(Context context, String prefix) throws SQLException
countHandlesByPrefix in interface HandleServiceSQLExceptionpublic int updateHandlesWithNewPrefix(Context context, String newPrefix, String oldPrefix) throws SQLException
updateHandlesWithNewPrefix in interface HandleServiceSQLExceptionpublic void modifyHandleDSpaceObject(Context context, String handle, DSpaceObject newOwner) throws SQLException
modifyHandleDSpaceObject in interface HandleServiceSQLExceptionprotected List<Handle> getInternalHandles(Context context, DSpaceObject dso) throws SQLException
context - DSpace contextdso - DSpaceObject for which we require our handlesSQLException - If a database error occursprotected Handle findHandleInternal(Context context, String handle) throws SQLException
context - DSpace contexthandle - The handle to resolveSQLException - If a database error occursprotected String createId(Context context) throws SQLException
context - DSpace ContextSQLException - If a database error occurspublic int countTotal(Context context) throws SQLException
countTotal in interface HandleServiceSQLExceptionCopyright © 2016 DuraSpace. All rights reserved.