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 onJCRAmetysObjects.
-
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider_currentUserProviderThe current user provider.protected UnlockHelper_unlockHelperThe unlock helper.static StringROLEThe avalon component role.
-
Constructor Summary
Constructors Constructor Description LockComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLockedContent(AmetysObject object)Register a locked content for automatic unlockingUserIdentitygetCurrentUser()Provides the current user.UserIdentitygetLockOwner(JCRAmetysObject object)Get the lock owner of aJCRAmetysObject.protected 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)voidunlock(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:
servicein 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 aJCRAmetysObjectis 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.
-
-