public class WorkspaceServiceImpl extends Object implements WorkspaceService
WorkspaceService
.Constructor and Description |
---|
WorkspaceServiceImpl(File workspacesDir)
Create a workspace service instance.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteWorkspace(String id)
Delete the workspace with the given identifier.
|
org.joda.time.DateTime |
getLeaseEnd(String workspaceId)
Get the lease end date and time of the workspace with the given
identifier.
|
Map<String,String> |
getSettings(String workspaceId)
Get the workspace settings.
|
File |
getWorkspaceFolder(String id)
Get the workspace folder for the given workspace identifier.
|
String |
leaseWorkspace(org.joda.time.ReadableDuration duration)
Lease a workspace folder for the given duration.
|
void |
set(String workspaceId,
String setting,
String value)
Change a workspace setting.
|
void |
trigger()
Triggers the service scanning for workspace folders where the lease time
has ended and deletes them.
|
public WorkspaceServiceImpl(File workspacesDir)
workspacesDir
- the base directory for workspaces, if the location
does not exist or is not accessible, a default location inside
the platform instance location is usedpublic String leaseWorkspace(org.joda.time.ReadableDuration duration)
WorkspaceService
leaseWorkspace
in interface WorkspaceService
duration
- the lease durationWorkspaceService.leaseWorkspace(ReadableDuration)
public File getWorkspaceFolder(String id) throws FileNotFoundException
WorkspaceService
getWorkspaceFolder
in interface WorkspaceService
id
- the workspace identifierFileNotFoundException
- if the workspace does not existWorkspaceService.getWorkspaceFolder(String)
public org.joda.time.DateTime getLeaseEnd(String workspaceId) throws IOException
WorkspaceService
getLeaseEnd
in interface WorkspaceService
workspaceId
- the workspace identifierFileNotFoundException
- if the workspace does not existIOException
- if the workspace configuration file cannot be readWorkspaceService.getLeaseEnd(String)
public Map<String,String> getSettings(String workspaceId) throws IOException
WorkspaceService
getSettings
in interface WorkspaceService
workspaceId
- the workspace identifierFileNotFoundException
- if the workspace does not existIOException
- if the workspace configuration file cannot be readWorkspaceService.getSettings(String)
public void set(String workspaceId, String setting, String value) throws IOException
WorkspaceService
set
in interface WorkspaceService
workspaceId
- the workspace identifiersetting
- the name of the settingvalue
- the value, null
to remove the settingFileNotFoundException
- if the workspace does not existIOException
- if the workspace configuration file cannot be read or
writtenWorkspaceService.set(String, String, String)
public void deleteWorkspace(String id)
WorkspaceService
deleteWorkspace
in interface WorkspaceService
id
- the workspace identifierWorkspaceService.deleteWorkspace(String)
public void trigger()
Build 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a