org.alfresco.repo.domain.locks.ibatis
Class LockDAOImpl

java.lang.Object
  extended by org.alfresco.repo.domain.locks.AbstractLockDAOImpl
      extended by org.alfresco.repo.domain.locks.ibatis.LockDAOImpl
All Implemented Interfaces:
LockDAO

public class LockDAOImpl
extends AbstractLockDAOImpl

iBatis-specific implementation of the Locks DAO.

Since:
3.2

Constructor Summary
LockDAOImpl()
           
 
Method Summary
protected  LockEntity createLock(java.lang.Long sharedResourceId, java.lang.Long exclusiveResourceId, java.lang.String lockToken, long timeToLive)
          Create a new lock.
protected  LockResourceEntity createLockResource(java.lang.Long qnameNamespaceId, java.lang.String qnameLocalName)
          Create a unique lock resource
protected  LockEntity getLock(java.lang.Long id)
           
protected  LockEntity getLock(java.lang.Long sharedResourceId, java.lang.Long exclusiveResourceId)
           
protected  LockResourceEntity getLockResource(java.lang.Long qnameNamespaceId, java.lang.String qnameLocalName)
          Override to get the unique, lock resource entity if one exists.
protected  java.util.List getLocksBySharedResourceIds(java.util.List sharedLockResourceIds)
          Get any existing lock data for the shared resources.
 void setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate)
           
protected  LockEntity updateLock(LockEntity lockEntity, java.lang.String lockToken, long timeToLive)
          Update an existing lock
protected  int updateLocks(java.lang.Long exclusiveLockResourceId, java.lang.String oldLockToken, java.lang.String newLockToken, long timeToLive)
           
 
Methods inherited from class org.alfresco.repo.domain.locks.AbstractLockDAOImpl
getLock, getQNameDAO, refreshLock, releaseLock, setQnameDAO, splitLockQName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockDAOImpl

public LockDAOImpl()
Method Detail

setSqlSessionTemplate

public final void setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate)

getLockResource

protected LockResourceEntity getLockResource(java.lang.Long qnameNamespaceId,
                                             java.lang.String qnameLocalName)
Description copied from class: AbstractLockDAOImpl
Override to get the unique, lock resource entity if one exists.

Specified by:
getLockResource in class AbstractLockDAOImpl
Parameters:
qnameNamespaceId - the namespace entity ID
qnameLocalName - the lock localname
Returns:
Returns the lock resource entity, or null if it doesn't exist

createLockResource

protected LockResourceEntity createLockResource(java.lang.Long qnameNamespaceId,
                                                java.lang.String qnameLocalName)
Description copied from class: AbstractLockDAOImpl
Create a unique lock resource

Specified by:
createLockResource in class AbstractLockDAOImpl
Parameters:
qnameNamespaceId - the namespace entity ID
qnameLocalName - the lock localname
Returns:
Returns the newly created lock resource entity

getLocksBySharedResourceIds

protected java.util.List getLocksBySharedResourceIds(java.util.List sharedLockResourceIds)
Description copied from class: AbstractLockDAOImpl
Get any existing lock data for the shared resources. The locks returned are not filtered and may be expired.

Specified by:
getLocksBySharedResourceIds in class AbstractLockDAOImpl
Returns:
Returns a list of locks (expired or not) for the given lock resources

getLock

protected LockEntity getLock(java.lang.Long id)
Specified by:
getLock in class AbstractLockDAOImpl
Parameters:
id - the lock instance ID
Returns:
Returns the lock, if it exists, otherwise null

getLock

protected LockEntity getLock(java.lang.Long sharedResourceId,
                             java.lang.Long exclusiveResourceId)
Specified by:
getLock in class AbstractLockDAOImpl
Parameters:
sharedResourceId - the shared lock resource ID
exclusiveResourceId - the exclusive lock resource ID
Returns:
Returns the lock, if it exists, otherwise null

createLock

protected LockEntity createLock(java.lang.Long sharedResourceId,
                                java.lang.Long exclusiveResourceId,
                                java.lang.String lockToken,
                                long timeToLive)
Description copied from class: AbstractLockDAOImpl
Create a new lock.

Specified by:
createLock in class AbstractLockDAOImpl
Parameters:
sharedResourceId - the specific resource to lock
exclusiveResourceId - the exclusive lock that is being sought
lockToken - the lock token to assign
timeToLive - the time, in milliseconds, for the lock to remain valid
Returns:
Returns the new lock

updateLock

protected LockEntity updateLock(LockEntity lockEntity,
                                java.lang.String lockToken,
                                long timeToLive)
Description copied from class: AbstractLockDAOImpl
Update an existing lock

Specified by:
updateLock in class AbstractLockDAOImpl
Parameters:
lockEntity - the specific lock to update
timeToLive - the new lock time, in milliseconds, for the lock to remain valid
Returns:
Returns the updated lock

updateLocks

protected int updateLocks(java.lang.Long exclusiveLockResourceId,
                          java.lang.String oldLockToken,
                          java.lang.String newLockToken,
                          long timeToLive)
Specified by:
updateLocks in class AbstractLockDAOImpl
Parameters:
exclusiveLockResourceId - the exclusive resource ID being locks
oldLockToken - the lock token to change from
newLockToken - the new lock token
timeToLive - the new time to live (in milliseconds)
Returns:
the number of rows updated


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.