Class SkinLockManager

java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.skincommons.SkinLockManager
All Implemented Interfaces:
Component, LogEnabled, Serviceable, ThreadSafe

Component to manage lock on skin directories.
  • Field Details

    • ROLE

      public static final String ROLE
      The Avalon role name
  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • canWrite

      public boolean canWrite(Path file) throws IOException
      Determines if the current user can write in skin directory
      Parameters:
      file - The skin directory
      Returns:
      true if the skin directory is not locked by another user
      Throws:
      IOException - If an error occurred
    • updateLockFile

      public void updateLockFile(Path file, String toolId) throws IOException
      Create or update .lock file
      Parameters:
      file - The skin directory
      toolId - The id of tool responsible for lock.
      Throws:
      IOException - If an error occurred
    • unlock

      public void unlock(Path file)
      Remove lock file
      Parameters:
      file - The skin directory
    • isLocked

      public boolean isLocked(Path file)
      Determines if the skin directory is locked
      Parameters:
      file - The skin directory
      Returns:
      true if the skin directory is locked
    • getLockOwner

      public UserIdentity getLockOwner(Path file) throws IOException
      Get lock owner
      Parameters:
      file - The skin directory
      Returns:
      The lock owner or null.
      Throws:
      IOException - if an error occurs while manipulating files
    • getLockTool

      public String getLockTool(Path file) throws IOException
      Get tool responsible for lock
      Parameters:
      file - The skin directory
      Returns:
      The tool responsible for lock or null
      Throws:
      IOException - if an error occurs while manipulating files
    • lastModified

      public Date lastModified(Path file) throws IOException
      Get the last modified date
      Parameters:
      file - The skin directory
      Returns:
      the last modified date
      Throws:
      IOException - if an error occurs while manipulating files