Class LockComponent
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.repository.jcr.LockComponent
- All Implemented Interfaces:
Component,LogEnabled,Serviceable
Component that provides methods for lock management on
JCRAmetysObjects.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user provider.protected UnlockHelperThe unlock helper.static final StringThe avalon component role. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLockedContent(AmetysObject object) Register a locked content for automatic unlockingProvides the current user.getLockOwner(JCRAmetysObject object) Get the lock owner of aJCRAmetysObject.protected javax.jcr.NodegetNode(JCRAmetysObject object) Get an object's base node.booleanisLocked(JCRAmetysObject object) Test if aJCRAmetysObjectis locked.voidlock(JCRAmetysObject object) Lock aJCRAmetysObject.voidremoveLockedContent(AmetysObject object) Unregister a locked content for automatic unlockingvoidservice(ServiceManager manager) voidSets a lock token on the current session for the givenJCRAmetysObjectvoidunlock(JCRAmetysObject object) Unlock aJCRAmetysObject.Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The avalon component role. -
_unlockHelper
The unlock helper. -
_currentUserProvider
The current user provider.
-
-
Constructor Details
-
LockComponent
public LockComponent()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
addLockedContent
Register a locked content for automatic unlocking- Parameters:
object- the lockedAmetysObject
-
removeLockedContent
Unregister a locked content for automatic unlocking- Parameters:
object- the lockedAmetysObject
-
getCurrentUser
Provides the current user.- Returns:
- the current user.
-
lock
Lock aJCRAmetysObject.- Parameters:
object- the object to lock.- Throws:
AmetysRepositoryException- if an error occurs.
-
unlock
Unlock aJCRAmetysObject.- Parameters:
object- the object to unlock.- Throws:
AmetysRepositoryException- if an error occurs.
-
setLockTokenOnCurrentSession
Sets a lock token on the current session for the givenJCRAmetysObject- Parameters:
object- the object for which the lock token is set.- Throws:
AmetysRepositoryException- if an error occurs
-
isLocked
Test if aJCRAmetysObjectis locked.- Parameters:
object- the object to test.- Returns:
- true if the object is locked, false otherwise.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getLockOwner
Get the lock owner of aJCRAmetysObject.- Parameters:
object- the object of which to get the lock owner.- Returns:
- the lock owner or null if there is no lock owner.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getNode
Get an object's base node.- Parameters:
object- the object which node to get.- Returns:
- the object's base node.
-