|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.workspace.Workspace
public class Workspace
The top-level Workspace class that stores and manages all the data associated with a PEACE Workspace. Note that the purpose of the Workspace class is to encapsulate and manage the data associated with the workspace and not to display it. Display of Workspace data is delegated to other classes that focus on presenting a suitable "view" of the data. This design follows the Model-View-Controller (MVC) design pattern.
Currently, each PEACE GUI instance operates only with a single Workspace. Consequently to enfore the use of a single, unique Workspace object, this class has been designed using the Singleton design pattern.
Field Summary | |
---|---|
private ClassifierList |
classifierList
The list of data base classifiers that are used to classify and group ESTs obtained from different data bases. |
private javax.xml.datatype.XMLGregorianCalendar |
creationTimestamp
The time stamp when this workspace was created. |
private java.util.ArrayList<DataSet> |
dataSetList
The list of data sets that have been configured for use in this work space. |
private JobList |
jobList
The list of Job classes that have been configured for use in this work space. |
private java.util.ArrayList<WorkspaceListener> |
listeners
The list of listeners that are currently registered to receive notifications on changes that have occured to various entries in the workspace. |
private long |
seqCounter
Sequence counter that is maintained on a per-work space basis to generate unique/valid IDs for each new entry that is added to this workspace. |
private ServerList |
serverList
The list of Server classes that have been configured for use in this work space. |
private static Workspace |
workspace
The process-wide, unique instance of the workspace object. |
private java.lang.String |
workspaceDirectory
The directory where all the files associated with this workpsace are stored. |
Constructor Summary | |
---|---|
private |
Workspace()
The default constructor. |
Method Summary | |
---|---|
void |
addDataSet(DataSet dataSet)
Method to add a new data set to the workspace. |
void |
addWorkspaceListener(WorkspaceListener listener)
Add a workspace listener to receive change notification events from this workspace. |
static Workspace |
createDefault(java.lang.String directory)
Method to create default work space met data in a given directory. |
void |
fireWorkspaceChanged(WorkspaceEvent event)
Utility method to notify all the listeners about a change to the Workspace. |
static Workspace |
get()
Method to get a reference to the process-wide, unique instance of the PEACE workspace. |
ClassifierList |
getClassifierList()
Obtain the classifier list set for this work space. |
MSTClusterData |
getClusterData(java.lang.String jobID)
Obtain the MSTClusterData entry for a given job ID. |
java.util.ArrayList<DataSet> |
getDataSets()
Obtain the list of data sets associated with this workspace. |
java.lang.String |
getDirectory()
Obtain the directory where all the files pertaining to this workspace are stored by default. |
JobList |
getJobList()
Obtain the JobList that encapsulates the list of Jobs that have been configured in this workspace. |
MSTData |
getMSTData(java.lang.String jobID)
Obtain the MSTData entry for a given job ID. |
ServerList |
getServerList()
Obtain the ServerList that encapsulates the list of Servers that have been configured in this workspace. |
static java.lang.String |
getWorkspaceFile(java.lang.String directory)
Method to provide consistent name for the PEACE workspace file name so that the file names are consistently used throughout. |
private static Workspace |
loadCoreWorkspaceData(org.w3c.dom.Document workspaceData,
java.lang.String directory)
Helper method to simply load the top-level Directory for the Workspace and the creation time stamp for this workspace from a DOM document. |
org.w3c.dom.Document |
marshall()
Obtain a new DOM document representing the data associated with the current work space configuration information. |
void |
marshall(java.io.PrintWriter out)
Method to marshall the data stored in this object directly to a XML fragment. |
void |
removeDataSet(DataSet dataSet)
Method to add a new data set to the workspace. |
void |
removeWorkspaceListener(WorkspaceListener listener)
Remove a workspace listener from the listeners to receive notification events from this workspace. |
java.lang.String |
reserveID()
Reserves the next sequence number for use in a data set. |
void |
saveWorkspace()
Save the current work space configuration information. |
void |
saveWorkspaceViaDOM()
This method can be used to save the work space configuration to disk. |
java.lang.String |
toString()
Provides a string of the form Workspace (../path) to display some workspace related information to the user. |
static Workspace |
useWorkspace(java.lang.String directory)
Method to load workspace data from a given directory. |
protected static void |
validate(org.w3c.dom.Document workspace)
This is a helper method that can be used to validate a Workspace DOM tree against the PEACE schema. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static Workspace workspace
private java.lang.String workspaceDirectory
private javax.xml.datatype.XMLGregorianCalendar creationTimestamp
private java.util.ArrayList<DataSet> dataSetList
private ServerList serverList
private JobList jobList
private ClassifierList classifierList
private transient java.util.ArrayList<WorkspaceListener> listeners
private long seqCounter
Constructor Detail |
---|
private Workspace()
Method Detail |
---|
public static Workspace get()
useWorkspace(String)
,
createDefault(String)
public static Workspace createDefault(java.lang.String directory) throws java.lang.Exception
directory
- The new workspace directory where an empty work space
needs to be created.
java.lang.Exception
- This method generates exception if the workspace file could
not be created.public static Workspace useWorkspace(java.lang.String directory) throws java.lang.Exception
directory
- The new workspace directory from where the necessary data is
to be loaded.
java.lang.Exception
- This method generates exception if the workspace file does
not exist or the data in the workspace file is
corrupted/inconsistent with expectationspublic static java.lang.String getWorkspaceFile(java.lang.String directory)
directory
- The workspace directory from where the necessary data is
to be loaded.protected static void validate(org.w3c.dom.Document workspace) throws java.lang.Exception
workspace
- The DOM document to be verified.
java.lang.Exception
- This method generates exceptions if the PEACE.xsd
file could not be loaded or if the DOM document is invalid.public org.w3c.dom.Document marshall() throws java.lang.Exception
java.lang.Exception
- This method throws a suitable exception if errors
occur during the DOM creation process.public final void marshall(java.io.PrintWriter out)
out
- The stream to which the XML must be serialized.public void saveWorkspaceViaDOM() throws java.lang.Exception
java.lang.Exception
- This method throws a suitable exception if errors
occur during the file saving process.public void saveWorkspace() throws java.lang.Exception
java.lang.Exception
- This method throws a suitable exception if errors
occur during the file saving process.private static Workspace loadCoreWorkspaceData(org.w3c.dom.Document workspaceData, java.lang.String directory) throws java.lang.Exception
workspaceData
- The DOM document from where the workspace information is to be
retrieved and stored in this class.
java.lang.Exception
- This method generates exceptions if errors occur when reading
the workspace data.public java.lang.String getDirectory()
public ServerList getServerList()
public JobList getJobList()
public java.util.ArrayList<DataSet> getDataSets()
public MSTData getMSTData(java.lang.String jobID)
jobID
- The ID of the job for which the MST data is to be
searched and retrieved.
public MSTClusterData getClusterData(java.lang.String jobID)
jobID
- The ID of the job for which the cluster entry
is to be searched and retrieved.
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String reserveID()
public void addWorkspaceListener(WorkspaceListener listener)
listener
- The listener to be added to the list of listeners to
receive notifications.public void removeWorkspaceListener(WorkspaceListener listener)
listener
- The listener to removed from the list of listeners to
receive notifications.public void fireWorkspaceChanged(WorkspaceEvent event)
event
- The event to be dispatched to various listeners informing them
about the change to the workspace.public void addDataSet(DataSet dataSet)
dataSet
- The data set to be added to the workspace.public void removeDataSet(DataSet dataSet)
dataSet
- The data set to be added to the workspace.public ClassifierList getClassifierList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |