Class LockComponent
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.repository.jcr.LockComponent
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class LockComponent extends AbstractLogEnabled implements Serviceable, Component
Component that provides methods for lock management onJCRAmetysObject
s.
-
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user provider.protected UnlockHelper
_unlockHelper
The unlock helper.static String
ROLE
The avalon component role.
-
Constructor Summary
Constructors Constructor Description LockComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLockedContent(AmetysObject object)
Register a locked content for automatic unlockingUserIdentity
getCurrentUser()
Provides the current user.UserIdentity
getLockOwner(JCRAmetysObject object)
Get the lock owner of aJCRAmetysObject
.protected 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 Detail
-
_unlockHelper
protected UnlockHelper _unlockHelper
The unlock helper.
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
-
Constructor Detail
-
LockComponent
public LockComponent()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
addLockedContent
public void addLockedContent(AmetysObject object)
Register a locked content for automatic unlocking- Parameters:
object
- the lockedAmetysObject
-
removeLockedContent
public void removeLockedContent(AmetysObject object)
Unregister a locked content for automatic unlocking- Parameters:
object
- the lockedAmetysObject
-
getCurrentUser
public UserIdentity getCurrentUser()
Provides the current user.- Returns:
- the current user.
-
lock
public void lock(JCRAmetysObject object) throws AmetysRepositoryException
Lock aJCRAmetysObject
.- Parameters:
object
- the object to lock.- Throws:
AmetysRepositoryException
- if an error occurs.
-
unlock
public void unlock(JCRAmetysObject object) throws AmetysRepositoryException
Unlock aJCRAmetysObject
.- Parameters:
object
- the object to unlock.- Throws:
AmetysRepositoryException
- if an error occurs.
-
isLocked
public boolean isLocked(JCRAmetysObject object) throws AmetysRepositoryException
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
public UserIdentity getLockOwner(JCRAmetysObject object) throws AmetysRepositoryException
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
protected Node getNode(JCRAmetysObject object)
Get an object's base node.- Parameters:
object
- the object which node to get.- Returns:
- the object's base node.
-
-