Interface VFSLockService


  • public interface VFSLockService
    Provides methods to manage locks in UberFire's virtual file system.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.uberfire.backend.vfs.impl.LockResult acquireLock​(org.uberfire.backend.vfs.Path path)
      Creates a lock file for the specified Path, to be held by the currently authenticated user.
      org.uberfire.backend.vfs.impl.LockResult forceReleaseLock​(org.uberfire.backend.vfs.Path path)
      Deletes the lock file for the specified Path even if the requesting user does not own the lock.
      org.uberfire.backend.vfs.impl.LockResult releaseLock​(org.uberfire.backend.vfs.Path path)
      Deletes the lock file for the specified Path.
      org.uberfire.backend.vfs.impl.LockInfo retrieveLockInfo​(org.uberfire.backend.vfs.Path path)
      Retrieves the lock information for the specified Path.
      List<org.uberfire.backend.vfs.impl.LockInfo> retrieveLockInfos​(org.uberfire.backend.vfs.Path path, boolean excludeOwnedLocks)
      Retrieves all locks for children (files or directories) of the provided path.
    • Method Detail

      • acquireLock

        org.uberfire.backend.vfs.impl.LockResult acquireLock​(org.uberfire.backend.vfs.Path path)
                                                      throws IllegalArgumentException,
                                                             org.uberfire.java.nio.IOException
        Creates a lock file for the specified Path, to be held by the currently authenticated user. If successful, this method associates the created lock with the user's HTTP session so locks can automatically be released when the session ends, expires or is destroyed.
        Parameters:
        path - the path of the file or directory to lock.
        Returns:
        the LockResult, indicating success or failure and containing the last read LockInfo.
        Throws:
        IllegalArgumentException - If the provided path is invalid or null.
        org.uberfire.java.nio.IOException - If a lock file can't be written or an existing lock can't be read.
      • releaseLock

        org.uberfire.backend.vfs.impl.LockResult releaseLock​(org.uberfire.backend.vfs.Path path)
                                                      throws IllegalArgumentException,
                                                             org.uberfire.java.nio.IOException
        Deletes the lock file for the specified Path. The requesting user needs to own the lock for this operation to succeed.
        Parameters:
        path - the path of the file or directory currently assumed locked.
        Returns:
        the LockResult, indicating success or failure and containing the last read LockInfo.
        Throws:
        IllegalArgumentException - If the provided path is invalid or null.
        org.uberfire.java.nio.IOException - If a lock file can't be deleted or an existing lock can't be read.
      • forceReleaseLock

        org.uberfire.backend.vfs.impl.LockResult forceReleaseLock​(org.uberfire.backend.vfs.Path path)
                                                           throws IllegalArgumentException,
                                                                  org.uberfire.java.nio.IOException
        Deletes the lock file for the specified Path even if the requesting user does not own the lock.
        Parameters:
        path - the path of the file or directory currently assumed locked.
        Returns:
        the LockResult, indicating success or failure and containing the last read LockInfo.
        Throws:
        IllegalArgumentException - If the provided path is invalid or null.
        org.uberfire.java.nio.IOException - If a lock file can't be deleted or an existing lock can't be read.
      • retrieveLockInfo

        org.uberfire.backend.vfs.impl.LockInfo retrieveLockInfo​(org.uberfire.backend.vfs.Path path)
                                                         throws IllegalArgumentException,
                                                                org.uberfire.java.nio.IOException
        Retrieves the lock information for the specified Path.
        Parameters:
        path - the path of the file or directory.
        Returns:
        the LockInfo for the provided Path.
        Throws:
        IllegalArgumentException - If the provided path is invalid or null.
        org.uberfire.java.nio.IOException - If a lock file can't be read.
      • retrieveLockInfos

        List<org.uberfire.backend.vfs.impl.LockInfo> retrieveLockInfos​(org.uberfire.backend.vfs.Path path,
                                                                       boolean excludeOwnedLocks)
                                                                throws IllegalArgumentException,
                                                                       org.uberfire.java.nio.IOException
        Retrieves all locks for children (files or directories) of the provided path.
        Parameters:
        path - the path of the directory.
        excludeOwnedLocks - filters the resulting list so it doesn't contain locks owned by the currently authenticated user.
        Returns:
        the list of LockInfos for children of the provided path that are currently locked, or an empty list if no such locks exist.
        Throws:
        IllegalArgumentException - If the provided path is invalid or null.
        org.uberfire.java.nio.IOException - If a lock file can't be read.