Package org.nuxeo.wopi.lock
Class LockHelper
java.lang.Object
org.nuxeo.wopi.lock.LockHelper
- Since:
- 10.3
-
Field Summary
Modifier and TypeFieldDescriptionprotected static ThreadLocal<Boolean>
Flag to know if the request originated from a WOPI client. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Stores the given WOPI lock for the given file id with a timestamp for expiration purpose.static void
static void
doPrivilegedOnLockDirectory
(Consumer<Session> consumer) Performs the given consumer with a privileged session on the lock directory.static <R> R
doPrivilegedOnLockDirectory
(Function<Session, R> function) Applies the given function with a privileged session on the lock directory.static void
Flags the request as originating from a WOPI client.protected static Map<String,
List<DocumentModel>> getExpiredLocks
(Session session, String repository) static Map<String,
List<DocumentModel>> getExpiredLocksByRepository
(Session session) Returns the list of expired stored WOPI locks according to theConstants.LOCK_TTL
for each repository.static String
Gets the WOPI lock stored for the given file id if it exists, returnsnull
otherwise.static boolean
Checks if a WOPI lock is stored for the given file id.static boolean
Checks if a WOPI lock is stored for the given repository and doc id, no matter the xpath.static boolean
Returnstrue
if the request originated from a WOPI client.protected static Session
static void
refreshLock
(String fileId) Updates the WOPI lock stored for the given file id with a fresh timestamp.static void
removeLock
(String fileId) Removes the WOPI lock stored for the given file id.static void
removeLocks
(String repository, String docId) Removes all the WOPI locks stored for the given repository and doc id.static void
Unflags the request as originating from a WOPI client.static void
updateLock
(String fileId, String lock) Updates the WOPI lock stored for the given file id with the given lock and a fresh timestamp.
-
Field Details
-
isWOPIRequest
Flag to know if the request originated from a WOPI client.
-
-
Method Details
-
addLock
Stores the given WOPI lock for the given file id with a timestamp for expiration purpose. -
addLock
- See Also:
-
getLock
Gets the WOPI lock stored for the given file id if it exists, returnsnull
otherwise. -
isLocked
Checks if a WOPI lock is stored for the given repository and doc id, no matter the xpath. -
isLocked
Checks if a WOPI lock is stored for the given file id. -
updateLock
Updates the WOPI lock stored for the given file id with the given lock and a fresh timestamp. -
refreshLock
Updates the WOPI lock stored for the given file id with a fresh timestamp. -
removeLock
Removes the WOPI lock stored for the given file id. -
removeLocks
Removes all the WOPI locks stored for the given repository and doc id. -
doPrivilegedOnLockDirectory
Performs the given consumer with a privileged session on the lock directory. -
doPrivilegedOnLockDirectory
Applies the given function with a privileged session on the lock directory. -
getExpiredLocksByRepository
Returns the list of expired stored WOPI locks according to theConstants.LOCK_TTL
for each repository.The given session must be privileged.
-
isWOPIRequest
public static boolean isWOPIRequest()Returnstrue
if the request originated from a WOPI client. -
flagWOPIRequest
public static void flagWOPIRequest()Flags the request as originating from a WOPI client. -
unflagWOPIRequest
public static void unflagWOPIRequest()Unflags the request as originating from a WOPI client. -
getExpiredLocks
-
openLockDirectorySession
-