generalDatabase
Class DBControlUnit

java.lang.Object
  extended by PamController.PamControlledUnit
      extended by generalDatabase.DBControl
          extended by generalDatabase.DBControlUnit
All Implemented Interfaces:
OfflineDataStore, PamSettings, PamSettingsSource

public class DBControlUnit
extends DBControl
implements OfflineDataStore

Version of DBControl for normal use while PAMGUARD is running - reading and writing of data

Author:
Doug Gillespie
See Also:
DBControl

Nested Class Summary
(package private)  class DBControlUnit.CreateDataMap
           
 
Nested classes/interfaces inherited from class generalDatabase.DBControl
DBControl.DatabaseFileMenuAction
 
Field Summary
private  DBControlUnit THIS
           
 
Fields inherited from class generalDatabase.DBControl
databaseSystem, databaseSystems, dbParameters, dbSidePanel
 
Fields inherited from class PamController.PamControlledUnit
isViewer
 
Constructor Summary
DBControlUnit(java.lang.String unitName)
           
 
Method Summary
 void createOfflineDataMap(java.awt.Window parentFrame)
          Create a basic map of the data including first and last times and some kind of data/unit time count plus ideally some kind of start and stop time list of where there are gaps in the data.
static java.sql.Connection findConnection()
          Find the database connection
static DBControlUnit findDatabaseControl()
          Find the database controller
 java.lang.String getDataSourceName()
          Get the data source name
 boolean loadData(PamDataBlock dataBlock, long dataStart, long dataEnd)
          Load data for a given datablock between two time limits.
 boolean saveData(PamDataBlock dataBlock)
          Save data previously loaded from the store during offline viewing.
 boolean selectSystem(int systemNumber, boolean openDatabase)
           
private static int whichStore()
           
 
Methods inherited from class generalDatabase.DBControl
browseDatabases, createDBControl, createFileMenu, createPamCursor, getConnection, getDatabaseName, getDbProcess, getDbUnitType, getLoggingDataBlocks, getNumSettings, getSettings, getSettingsReference, getSettingsSourceName, getSettingsVersion, getSidePanel, getSystem, isFullTablesCheck, notifyModelChanged, restoreSettings, saveSettingsToDB, saveStartSettings, selectDatabase, setFullTablesCheck, setWriteCount
 
Methods inherited from class PamController.PamControlledUnit
addOtherRelatedMenuItems, addPamProcess, addRelatedMenuItems, canClose, createDetectionMenu, createDisplayMenu, createHelpMenu, fillXMLElement, fillXMLParameters, getFrameNumber, getNumPamProcesses, getPamController, getPamModuleInfo, getPamProcess, getPamView, getTabClipCopier, getTabPanel, getTabSpecificMenuBar, getUnitName, getUnitType, gotoTab, notifyArrayChanged, pamHasStopped, pamToStart, removePamProcess, removeUnit, rename, saveViewerData, setFrameNumber, setPamController, setPamModuleInfo, setPamView, setSidePanel, setTabPanel, setupControlledUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface PamController.PamSettings
getUnitName, getUnitType
 

Field Detail

THIS

private DBControlUnit THIS
Constructor Detail

DBControlUnit

public DBControlUnit(java.lang.String unitName)
Method Detail

whichStore

private static int whichStore()

selectSystem

public boolean selectSystem(int systemNumber,
                            boolean openDatabase)
Overrides:
selectSystem in class DBControl

createOfflineDataMap

public void createOfflineDataMap(java.awt.Window parentFrame)
Description copied from interface: OfflineDataStore
Create a basic map of the data including first and last times and some kind of data/unit time count plus ideally some kind of start and stop time list of where there are gaps in the data.

Specified by:
createOfflineDataMap in interface OfflineDataStore

getDataSourceName

public java.lang.String getDataSourceName()
Description copied from interface: OfflineDataStore
Get the data source name

Specified by:
getDataSourceName in interface OfflineDataStore
Returns:
data source name

loadData

public boolean loadData(PamDataBlock dataBlock,
                        long dataStart,
                        long dataEnd)
Description copied from interface: OfflineDataStore
Load data for a given datablock between two time limits.

Specified by:
loadData in interface OfflineDataStore
Parameters:
dataBlock - datablock owner of the data
dataStart - start time in milliseconds
dataEnd - end time in milliseconds
Returns:
true if load successful.

saveData

public boolean saveData(PamDataBlock dataBlock)
Description copied from interface: OfflineDataStore
Save data previously loaded from the store during offline viewing.

Specified by:
saveData in interface OfflineDataStore
Parameters:
dataBlock - datablock owner of the data
Returns:
true if saved or save not needed. False if an error prevents saving.

findConnection

public static java.sql.Connection findConnection()
Find the database connection

Returns:
the database connection or null if there is either no database module loaded or no open database.

findDatabaseControl

public static DBControlUnit findDatabaseControl()
Find the database controller

Returns:
database controller, or null if no database module loaded.