|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pentaho.platform.repository2.unified.jcr.jackrabbit.DefaultLockHelper
public class DefaultLockHelper
Default implementation of ILockHelper
. If user suzy
in tenant acme
locks a file with
UUID abc
then this implementation will store the lock token xyz
as
/pentaho/acme/home/suzy/.lockTokens/abc/xyz
. It is assumed that /pentaho/acme/home/suzy
is never
versioned! Putting lock token storage beneath the user's home folder provides access control.
Constructor Summary | |
---|---|
DefaultLockHelper()
|
Method Summary | |
---|---|
void |
addLockTokenToSessionIfNecessary(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId)
Adds the lock token associated with the file with the given file id if the file is locked. |
boolean |
canUnlock(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
javax.jcr.lock.Lock lock)
Returns true if user represented by session can potentially unlock the given lock. |
void |
lockFile(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId,
String message)
Locks a file. |
void |
removeLockToken(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
javax.jcr.lock.Lock lock)
Removes a lock token so that it can never be associated with anyone's session again. |
void |
removeLockTokenFromSessionIfNecessary(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId)
Removes the lock token associated with the file with the given file id |
void |
unlockFile(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId)
Unlocks a file. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultLockHelper()
Method Detail |
---|
public void removeLockToken(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock) throws javax.jcr.RepositoryException
removeLockToken
in interface ILockHelper
session
- sessionpentahoJcrConstants
- constantslock
- lock
javax.jcr.RepositoryException
- if anything goes wrongpublic boolean canUnlock(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock) throws javax.jcr.RepositoryException
true
if user represented by session can potentially unlock the given lock. This can be a function
of access control or some other mechanism.
canUnlock
in interface ILockHelper
session
- sessionpentahoJcrConstants
- constantslock
- lock
javax.jcr.RepositoryException
- if anything goes wrongpublic void addLockTokenToSessionIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
addLockTokenToSessionIfNecessary
in interface ILockHelper
session
- sessionpentahoJcrConstants
- constantsfileId
- file id
javax.jcr.RepositoryException
- if anything goes wrongpublic void removeLockTokenFromSessionIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
removeLockTokenFromSessionIfNecessary
in interface ILockHelper
session
- sessionpentahoJcrConstants
- constantsfileId
- file id
javax.jcr.RepositoryException
- if anything goes wrongpublic void unlockFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
unlockFile
in interface ILockHelper
session
- sessionpentahoJcrConstants
- constantsfileId
- file id
javax.jcr.RepositoryException
- if anything goes wrongpublic void lockFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, String message) throws javax.jcr.RepositoryException
lockFile
in interface ILockHelper
session
- sessionpentahoJcrConstants
- constantsfileId
- file idmessage
- lock message
javax.jcr.RepositoryException
- if anything goes wrong
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |