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.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if the current user can write in skin directorygetLockOwner
(Path file) Get lock ownergetLockTool
(Path file) Get tool responsible for lockboolean
Determines if the skin directory is lockedlastModified
(Path file) Get the last modified datevoid
service
(ServiceManager smanager) void
Remove lock filevoid
updateLockFile
(Path file, String toolId) Create or update .lock fileMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The Avalon role name
-
-
Constructor Details
-
SkinLockManager
public SkinLockManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
canWrite
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
Create or update .lock file- Parameters:
file
- The skin directorytoolId
- The id of tool responsible for lock.- Throws:
IOException
- If an error occurred
-
unlock
Remove lock file- Parameters:
file
- The skin directory
-
isLocked
Determines if the skin directory is locked- Parameters:
file
- The skin directory- Returns:
true
if the skin directory is locked
-
getLockOwner
Get lock owner- Parameters:
file
- The skin directory- Returns:
- The lock owner or null.
- Throws:
IOException
- if an error occurs while manipulating files
-
getLockTool
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
Get the last modified date- Parameters:
file
- The skin directory- Returns:
- the last modified date
- Throws:
IOException
- if an error occurs while manipulating files
-