Package org.ametys.plugins.skincommons
Class SkinLockManager
- java.lang.Object
- 
- org.apache.avalon.framework.logger.AbstractLogEnabled
- 
- org.ametys.plugins.skincommons.SkinLockManager
 
 
- 
- All Implemented Interfaces:
- Component,- LogEnabled,- Serviceable,- ThreadSafe
 
 public class SkinLockManager extends AbstractLogEnabled implements Component, ThreadSafe, Serviceable Component to manage lock on skin directories.
- 
- 
Constructor SummaryConstructors Constructor Description SkinLockManager()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanWrite(Path file)Determines if the current user can write in skin directoryUserIdentitygetLockOwner(Path file)Get lock ownerStringgetLockTool(Path file)Get tool responsible for lockbooleanisLocked(Path file)Determines if the skin directory is lockedDatelastModified(Path file)Get the last modified datevoidservice(ServiceManager smanager)voidunlock(Path file)Remove lock filevoidupdateLockFile(Path file, String toolId)Create or update .lock file- 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabledenableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
- 
 
- 
- 
- 
Constructor Detail- 
SkinLockManagerpublic SkinLockManager() 
 
- 
 - 
Method Detail- 
servicepublic void service(ServiceManager smanager) throws ServiceException - Specified by:
- servicein interface- Serviceable
- Throws:
- ServiceException
 
 - 
canWritepublic boolean canWrite(Path file) throws IOException Determines if the current user can write in skin directory- Parameters:
- file- The skin directory
- Returns:
- trueif the skin directory is not locked by another user
- Throws:
- IOException- If an error occurred
 
 - 
updateLockFilepublic 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
 
 - 
isLockedpublic boolean isLocked(Path file) Determines if the skin directory is locked- Parameters:
- file- The skin directory
- Returns:
- trueif the skin directory is locked
 
 - 
getLockOwnerpublic 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
 
 - 
getLockToolpublic 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
 
 - 
lastModifiedpublic 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
 
 
- 
 
-