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
JCRAmetysObject
s.-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user provider.protected UnlockHelper
The unlock helper.static final String
The avalon component role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLockedContent
(AmetysObject object) Register a locked content for automatic unlockingProvides the current user.getLockOwner
(JCRAmetysObject object) Get the lock owner of aJCRAmetysObject
.protected javax.jcr.Node
getNode
(JCRAmetysObject object) Get an object's base node.boolean
isLocked
(JCRAmetysObject object) Test if aJCRAmetysObject
is locked.void
lock
(JCRAmetysObject object) Lock aJCRAmetysObject
.void
removeLockedContent
(AmetysObject object) Unregister a locked content for automatic unlockingvoid
service
(ServiceManager manager) void
unlock
(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:
service
in 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.
-
isLocked
Test if aJCRAmetysObject
is 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.
-