Interface ILockHelper
-
- All Known Implementing Classes:
DefaultLockHelper
public interface ILockHelper
Helper class that stores, retrieves, and removes lock tokens. In section 8.4.7 of the JSR-170 specification, it states, "the user must additionally ensure that a reference to the lock token is preserved separately so that it can later be attached to another session." This manual step is necessary when using open-scoped locks and this implementation uses open-scoped locks exclusively.- Author:
- mlowery
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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)
Returnstrue
if user represented by session can potentially unlock the given lock.Date
getLockDate(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock)
String
getLockMessage(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock)
String
getLockOwner(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock)
void
lockFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, String lockMessage)
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 idvoid
unlockFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId)
Unlocks a file.
-
-
-
Method Detail
-
removeLockToken
void removeLockToken(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock) throws javax.jcr.RepositoryException
Removes a lock token so that it can never be associated with anyone's session again. (To be called after the file has been unlocked (or the file is deleted) and therefore the token associated with the lock is unnecessary.)- Parameters:
session
- sessionpentahoJcrConstants
- constantslock
- lock- Throws:
javax.jcr.RepositoryException
- if anything goes wrong
-
canUnlock
boolean canUnlock(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock) throws javax.jcr.RepositoryException
Returnstrue
if user represented by session can potentially unlock the given lock. This can be a function of access control or some other mechanism.- Parameters:
session
- sessionpentahoJcrConstants
- constantslock
- lock- Throws:
javax.jcr.RepositoryException
- if anything goes wrong
-
lockFile
void lockFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, String lockMessage) throws javax.jcr.RepositoryException
Locks a file.- Parameters:
session
- sessionpentahoJcrConstants
- constantsfileId
- file idlockMessage
- lock message- Throws:
javax.jcr.RepositoryException
- if anything goes wrong
-
unlockFile
void unlockFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
Unlocks a file.- Parameters:
session
- sessionpentahoJcrConstants
- constantsfileId
- file id- Throws:
javax.jcr.RepositoryException
- if anything goes wrong
-
addLockTokenToSessionIfNecessary
void addLockTokenToSessionIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
Adds the lock token associated with the file with the given file id if the file is locked.- Parameters:
session
- sessionpentahoJcrConstants
- constantsfileId
- file id- Throws:
javax.jcr.RepositoryException
- if anything goes wrong
-
removeLockTokenFromSessionIfNecessary
void removeLockTokenFromSessionIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
Removes the lock token associated with the file with the given file id- Parameters:
session
- sessionpentahoJcrConstants
- constantsfileId
- file id- Throws:
javax.jcr.RepositoryException
- if anything goes wrong
-
getLockDate
Date getLockDate(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getLockMessage
String getLockMessage(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getLockOwner
String getLockOwner(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.lock.Lock lock) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
-