org.grinvin.workspace

Class Workspace


public class Workspace
extends java.lang.Object

Handles session persistence. The singleton object of this type allows sessions to be persisted to a workspace directory on disk.

Method Summary

static Workspace
getInstance()
Get the singleton instance of this class
void
load(File directory)
Load the workspace from the given workspace directory.
void
newWorkspace(File directory)
Initialize all subsystems and perform an initial save into the given workspace directory.
void
save()
Save the workspace into the current workspace directory.
void
saveAs(File directory)
Save the workspace into a new workspace directory.

Method Details

getInstance

public static Workspace getInstance()
Get the singleton instance of this class
Returns:
the single instance of this class

load

public void load(File directory)
            throws WorkspaceException
Load the workspace from the given workspace directory. If there is an active workspace already, it is first saved and then disposed of.

newWorkspace

public void newWorkspace(File directory)
            throws WorkspaceException
Initialize all subsystems and perform an initial save into the given workspace directory. If there is an active workspace already, it is disposed of first. If the new directory already exists, all its contents are removed.

save

public void save()
            throws WorkspaceException
Save the workspace into the current workspace directory.

saveAs

public void saveAs(File directory)
            throws WorkspaceException
Save the workspace into a new workspace directory. If the new directory already exists, all its contents are removed.