public abstract class AbstractLockDAOImpl extends Object implements LockDAO
Constructor and Description |
---|
AbstractLockDAOImpl() |
Modifier and Type | Method and Description |
---|---|
protected abstract LockEntity |
createLock(Long sharedResourceId,
Long exclusiveResourceId,
String lockToken,
long timeToLive)
Create a new lock.
|
protected abstract LockResourceEntity |
createLockResource(Long qnameNamespaceId,
String qnameLocalName)
Create a unique lock resource
|
protected abstract LockEntity |
getLock(Long id) |
protected abstract LockEntity |
getLock(Long sharedResourceId,
Long exclusiveResourceId) |
void |
getLock(org.alfresco.service.namespace.QName lockQName,
String lockToken,
long timeToLive)
Acquire a given exclusive lock, assigning it (and any implicitly shared locks) a
timeout.
|
protected abstract LockResourceEntity |
getLockResource(Long qnameNamespaceId,
String qnameLocalName)
Override to get the unique, lock resource entity if one exists.
|
protected abstract List<LockEntity> |
getLocksBySharedResourceIds(List<Long> sharedLockResourceIds)
Get any existing lock data for the shared resources.
|
protected QNameDAO |
getQNameDAO() |
void |
refreshLock(org.alfresco.service.namespace.QName lockQName,
String lockToken,
long timeToLive)
Refresh a held lock.
|
boolean |
releaseLock(org.alfresco.service.namespace.QName lockQName,
String lockToken,
boolean optimistic)
Release a lock.
|
void |
setQnameDAO(QNameDAO qnameDAO) |
protected List<org.alfresco.service.namespace.QName> |
splitLockQName(org.alfresco.service.namespace.QName lockQName)
Split a lock's qualified name into the component parts using the '.' (period) as a
separator on the localname.
|
protected abstract LockEntity |
updateLock(LockEntity lockEntity,
String lockToken,
long timeToLive)
Update an existing lock
|
protected abstract int |
updateLocks(Long exclusiveLockResourceId,
String oldLockToken,
String newLockToken,
long timeToLive) |
protected QNameDAO getQNameDAO()
public void setQnameDAO(QNameDAO qnameDAO)
qnameDAO
- DAO for namespace ID resolutionpublic void getLock(org.alfresco.service.namespace.QName lockQName, String lockToken, long timeToLive)
LockDAO
A lock can be re-taken if it has expired and if the lock token has not changed
public void refreshLock(org.alfresco.service.namespace.QName lockQName, String lockToken, long timeToLive)
LockDAO
refreshLock
in interface LockDAO
lockQName
- the unique name of the lock to updatelockToken
- the lock token for the lock heldtimeToLive
- the new time to live (in milliseconds)public boolean releaseLock(org.alfresco.service.namespace.QName lockQName, String lockToken, boolean optimistic)
LockDAO
releaseLock
in interface LockDAO
lockQName
- the unique name of the lock to releaselockToken
- the current lock tokenoptimistic
- true if the release attempt is enough even
if the number of released locks was incorrect.protected abstract LockResourceEntity getLockResource(Long qnameNamespaceId, String qnameLocalName)
qnameNamespaceId
- the namespace entity IDqnameLocalName
- the lock localnameprotected abstract LockResourceEntity createLockResource(Long qnameNamespaceId, String qnameLocalName)
qnameNamespaceId
- the namespace entity IDqnameLocalName
- the lock localnameprotected abstract LockEntity getLock(Long id)
id
- the lock instance IDprotected abstract LockEntity getLock(Long sharedResourceId, Long exclusiveResourceId)
sharedResourceId
- the shared lock resource IDexclusiveResourceId
- the exclusive lock resource IDprotected abstract List<LockEntity> getLocksBySharedResourceIds(List<Long> sharedLockResourceIds)
sharedLockResourceIds
- a list of shared resource IDs for which to retrieve the current locksprotected abstract LockEntity createLock(Long sharedResourceId, Long exclusiveResourceId, String lockToken, long timeToLive)
sharedResourceId
- the specific resource to lockexclusiveResourceId
- the exclusive lock that is being soughtlockToken
- the lock token to assigntimeToLive
- the time, in milliseconds, for the lock to remain validorg.springframework.dao.ConcurrencyFailureException
- if the lock was already taken at the time of creationprotected abstract LockEntity updateLock(LockEntity lockEntity, String lockToken, long timeToLive)
lockEntity
- the specific lock to updatelockToken
- the new lock tokentimeToLive
- the new lock time, in milliseconds, for the lock to remain validorg.springframework.dao.ConcurrencyFailureException
- if the entity was not updatedprotected abstract int updateLocks(Long exclusiveLockResourceId, String oldLockToken, String newLockToken, long timeToLive)
exclusiveLockResourceId
- the exclusive resource ID being locksoldLockToken
- the lock token to change fromnewLockToken
- the new lock tokentimeToLive
- the new time to live (in milliseconds)protected List<org.alfresco.service.namespace.QName> splitLockQName(org.alfresco.service.namespace.QName lockQName)
lockQName
- the lock name to split into it's higher-level pathsCopyright © 2005–2017 Alfresco Software. All rights reserved.