Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.headless.impl
Class WorkspaceServiceImpl

java.lang.Object
  extended by eu.esdihumboldt.hale.common.headless.impl.WorkspaceServiceImpl
All Implemented Interfaces:
WorkspaceService

public class WorkspaceServiceImpl
extends Object
implements WorkspaceService

Default implementation of the WorkspaceService.

Author:
Simon Templer

Constructor Summary
WorkspaceServiceImpl(File workspacesDir)
          Create a workspace service instance.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspaceServiceImpl

public WorkspaceServiceImpl(File workspacesDir)
Create a workspace service instance.

Parameters:
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 used
Method Detail

leaseWorkspace

public String leaseWorkspace(org.joda.time.ReadableDuration duration)
Description copied from interface: WorkspaceService
Lease a workspace folder for the given duration. After the duration has passed, the folder is deleted by the service (the exact point in time depending on when the service is triggered).

Specified by:
leaseWorkspace in interface WorkspaceService
Parameters:
duration - the lease duration
Returns:
the workspace identifier
See Also:
WorkspaceService.leaseWorkspace(ReadableDuration)

getWorkspaceFolder

public File getWorkspaceFolder(String id)
                        throws FileNotFoundException
Description copied from interface: WorkspaceService
Get the workspace folder for the given workspace identifier.

Specified by:
getWorkspaceFolder in interface WorkspaceService
Parameters:
id - the workspace identifier
Returns:
the workspace folder
Throws:
FileNotFoundException - if the workspace does not exist
See Also:
WorkspaceService.getWorkspaceFolder(String)

getLeaseEnd

public org.joda.time.DateTime getLeaseEnd(String workspaceId)
                                   throws IOException
Description copied from interface: WorkspaceService
Get the lease end date and time of the workspace with the given identifier.

Specified by:
getLeaseEnd in interface WorkspaceService
Parameters:
workspaceId - the workspace identifier
Returns:
the lease end, if the workspace exists
Throws:
FileNotFoundException - if the workspace does not exist
IOException - if the workspace configuration file cannot be read
See Also:
WorkspaceService.getLeaseEnd(String)

getSettings

public Map<String,String> getSettings(String workspaceId)
                               throws IOException
Description copied from interface: WorkspaceService
Get the workspace settings.

Specified by:
getSettings in interface WorkspaceService
Parameters:
workspaceId - the workspace identifier
Returns:
the current workspace settings, changes to the map will not be reflected in the settings
Throws:
FileNotFoundException - if the workspace does not exist
IOException - if the workspace configuration file cannot be read
See Also:
WorkspaceService.getSettings(String)

set

public void set(String workspaceId,
                String setting,
                String value)
         throws IOException
Description copied from interface: WorkspaceService
Change a workspace setting.

Specified by:
set in interface WorkspaceService
Parameters:
workspaceId - the workspace identifier
setting - the name of the setting
value - the value, null to remove the setting
Throws:
FileNotFoundException - if the workspace does not exist
IOException - if the workspace configuration file cannot be read or written
See Also:
WorkspaceService.set(String, String, String)

deleteWorkspace

public void deleteWorkspace(String id)
Description copied from interface: WorkspaceService
Delete the workspace with the given identifier.

Specified by:
deleteWorkspace in interface WorkspaceService
Parameters:
id - the workspace identifier
See Also:
WorkspaceService.deleteWorkspace(String)

trigger

public void trigger()
Triggers the service scanning for workspace folders where the lease time has ended and deletes them.


Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d