public class SkinLockManager extends AbstractLogEnabled implements Component, ThreadSafe, Serviceable
Modifier and Type | Field and Description |
---|---|
private CurrentUserProvider |
_userProvider |
static String |
ROLE
The Avalon role name
|
Constructor and Description |
---|
SkinLockManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
canWrite(File file)
Determines if the current user can write in skin directory
|
UserIdentity |
getLockOwner(File file)
Get lock owner
|
String |
getLockTool(File file)
Get tool responsible for lock
|
boolean |
isLocked(File file)
Determines if the skin directory is locked
|
Date |
lastModified(File file)
Get the last modified date
|
void |
service(ServiceManager smanager) |
void |
unlock(File file)
Remove lock file
|
void |
updateLockFile(File file,
String toolId)
Create or update .lock file
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private CurrentUserProvider _userProvider
public SkinLockManager()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
ServiceException
public boolean canWrite(File file) throws IOException
file
- The skin directorytrue
if the skin directory is not locked by another userIOException
- If an error occurredpublic void updateLockFile(File file, String toolId) throws IOException
file
- The skin directorytoolId
- The id of tool responsible for lock.IOException
- If an error occurredpublic boolean isLocked(File file)
file
- The skin directorytrue
if the skin directory is lockedpublic UserIdentity getLockOwner(File file) throws IOException
file
- The skin directoryIOException
- if an error occurs while manipulating filespublic String getLockTool(File file) throws IOException
file
- The skin directorynull
IOException
- if an error occurs while manipulating filespublic Date lastModified(File file) throws IOException
file
- The skin directoryIOException
- if an error occurs while manipulating files