uk.ac.cisban.rod.data
Class DataManager

java.lang.Object
  extended by uk.ac.cisban.rod.data.DataManager
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener

public class DataManager
extends java.lang.Object
implements javax.swing.event.ChangeListener

Handles all of the data for a particular experiment by juggling submanagers that actually perform all data tasks.

Author:
Morgan Taschuk

Field Summary
static boolean DEBUG
          Sets whether or not to debug the whole program.
protected  java.util.Map<java.lang.Long,java.util.Collection<LogEventMapping>> mappings
          A map of ActionApplication ids to the corresponding data loaded for the current experiment.
protected  java.util.SortedMap<ActionCV,java.util.List<ActionCV>> protocol
          A map of top-level ActionCVs to the ActionCVs that expect logs.
protected  java.util.SortedMap<ActionApplication,java.util.List<ActionApplication>> protocolApplication
          A map of the top-level ActionApplications to the ActionApplications that expect logs.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Adds a ChangeListener to listen for the completion of loading of the experiment, inoculation, spot or image logs.
 void addMapping(java.lang.Long id, java.util.Collection<LogEventMapping> list)
          Creates a mapping from ActionApplication DB id to the corresponding data loaded for that ActionApplication.
 boolean clearExperiment()
          Sets this instance of DataManager to null, incites the creation of a new DataManager, and fires a ChangeEvent to let all interested parties know.
 ExperimentManager getExperimentManager()
          Allows access to the experiment manager.
 ImageManager getImageManager()
          Allows access to the image manager.
 InoculationManager getInocManager()
          Allows access to the inoculation manager.
static DataManager getInstance()
          Return the only active instance of DataManager with all of the loaded data.
 java.util.Map<java.lang.Long,java.util.Collection<LogEventMapping>> getMappings()
          Returns a map of ActionApplication ids to the corresponding data loaded for the current experiment.
 PlateManager getPlateManager()
          Allows access to the plate manager.
 ActionApplication getPreviousApplication(java.lang.Long actionAppId)
          Returns the ActionApplication before the given actionAppId for purposes of checking for completion, etc.
 java.util.SortedMap<ActionCV,java.util.List<ActionCV>> getProtocol()
          Returns a map of top-level ActionCVs to the ActionCVs that expect logs.
 java.util.SortedMap<ActionApplication,java.util.List<ActionApplication>> getProtocolApplication()
          Returns a map of the top-level ActionApplications to the ActionApplications that expect logs.
 SpotManager getSpotManager()
          Allows access to the spot manager.
 void listenToImageManager(java.beans.PropertyChangeListener listener)
          Forwards the given listener on to the ImageManager.
 java.util.List<ActionCV> locateLoggable(ActionCV curr)
          For a top-level ActionCV, finds the ActionCVs further down in the hierarchy that expect LogEvents.
 java.util.List<ActionApplication> locateLogged(ActionApplication curr)
          From a top-level ActionApplication, finds the ActionApplications further down in the hierarchy that have LogEvents attached.
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Removes a ChangeListener to listen for the completion of loading of the experiment, inoculation, spot or image logs.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Fires a change event to registered listeners of DataManager based upon the completion of loading of the experiment, inoculation, spot or image logs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
Sets whether or not to debug the whole program.

See Also:
Constant Field Values

protocol

protected java.util.SortedMap<ActionCV,java.util.List<ActionCV>> protocol
A map of top-level ActionCVs to the ActionCVs that expect logs.


protocolApplication

protected java.util.SortedMap<ActionApplication,java.util.List<ActionApplication>> protocolApplication
A map of the top-level ActionApplications to the ActionApplications that expect logs.


mappings

protected java.util.Map<java.lang.Long,java.util.Collection<LogEventMapping>> mappings
A map of ActionApplication ids to the corresponding data loaded for the current experiment.

Method Detail

getInstance

public static DataManager getInstance()
Return the only active instance of DataManager with all of the loaded data.

Returns:
the lazy singleton instance of DataManager

getExperimentManager

public ExperimentManager getExperimentManager()
Allows access to the experiment manager.

Returns:
ExperimentManager

getImageManager

public ImageManager getImageManager()
Allows access to the image manager.

Returns:
ImageManager

getInocManager

public InoculationManager getInocManager()
Allows access to the inoculation manager.

Returns:
InnoculationManager

getPlateManager

public PlateManager getPlateManager()
Allows access to the plate manager.

Returns:
PlateManager

getSpotManager

public SpotManager getSpotManager()
Allows access to the spot manager.

Returns:
SpotManager

addMapping

public void addMapping(java.lang.Long id,
                       java.util.Collection<LogEventMapping> list)
Creates a mapping from ActionApplication DB id to the corresponding data loaded for that ActionApplication.

Parameters:
id - the DB id of the ActionApplication
list - Collection of data associated with that ActionApplication

clearExperiment

public boolean clearExperiment()
                        throws java.lang.Exception
Sets this instance of DataManager to null, incites the creation of a new DataManager, and fires a ChangeEvent to let all interested parties know.

Returns:
Throws:
java.lang.Exception

getPreviousApplication

public ActionApplication getPreviousApplication(java.lang.Long actionAppId)
Returns the ActionApplication before the given actionAppId for purposes of checking for completion, etc.

Parameters:
actionAppId -
Returns:
the actionApplication before the given actionAppId, null if the given actionAppId isn't found, and the ActionApplication corresponding to the ID if it is first in the list.

locateLoggable

public java.util.List<ActionCV> locateLoggable(ActionCV curr)
For a top-level ActionCV, finds the ActionCVs further down in the hierarchy that expect LogEvents.

Parameters:
curr -
Returns:

locateLogged

public java.util.List<ActionApplication> locateLogged(ActionApplication curr)
From a top-level ActionApplication, finds the ActionApplications further down in the hierarchy that have LogEvents attached.

Parameters:
curr -
Returns:

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Fires a change event to registered listeners of DataManager based upon the completion of loading of the experiment, inoculation, spot or image logs.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e -

getProtocol

public java.util.SortedMap<ActionCV,java.util.List<ActionCV>> getProtocol()
Returns a map of top-level ActionCVs to the ActionCVs that expect logs.

Returns:

getProtocolApplication

public java.util.SortedMap<ActionApplication,java.util.List<ActionApplication>> getProtocolApplication()
Returns a map of the top-level ActionApplications to the ActionApplications that expect logs.

Returns:

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Adds a ChangeListener to listen for the completion of loading of the experiment, inoculation, spot or image logs.

Parameters:
listener - listener interested in the completion of loading of data

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Removes a ChangeListener to listen for the completion of loading of the experiment, inoculation, spot or image logs.

Parameters:
listener - the listener no longer interested

listenToImageManager

public void listenToImageManager(java.beans.PropertyChangeListener listener)
                          throws java.lang.InterruptedException
Forwards the given listener on to the ImageManager.

Parameters:
listener -
Throws:
java.lang.InterruptedException

getMappings

public java.util.Map<java.lang.Long,java.util.Collection<LogEventMapping>> getMappings()
Returns a map of ActionApplication ids to the corresponding data loaded for the current experiment.

Returns:


Copyright © 2010. All Rights Reserved.