Class DBControlUnit

All Implemented Interfaces:
DataOutputStore, OfflineDataStore, PamSettings, PamSettingsSource, SettingsNameProvider

public class DBControlUnit extends DBControl implements DataOutputStore
Version of DBControl for normal use while PAMGUARD is running - reading and writing of data
Author:
Doug Gillespie
See Also:
  • Constructor Details

    • DBControlUnit

      public DBControlUnit(String unitName)
    • DBControlUnit

      public DBControlUnit(PamConfiguration pamConfiguration, String unitName)
  • Method Details

    • selectSystem

      public boolean selectSystem(int systemNumber, boolean openDatabase)
      Description copied from class: DBControl
      Select a database system
      Overrides:
      selectSystem in class DBControl
      Parameters:
      systemNumber - index of the database system
      openDatabase - flag to immediately open the database
      Returns:
      true if all ok
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
      Description copied from class: PamControlledUnit
      General notification when the PAMGAURD model changes.
      Overrides:
      notifyModelChanged in class DBControl
      Parameters:
      changeType - type of change
    • updateDataMap

      public void updateDataMap(PamDataBlock pamDataBlock)
      update the datamap for a single data block.
      Parameters:
      pamDataBlock -
    • updateDataMap

      public void updateDataMap(ArrayList<PamDataBlock> pamDataBlocks)
      Update the data map for an array list of data blocks.
      Parameters:
      pamDataBlock -
    • createOfflineDataMap

      public void createOfflineDataMap(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
    • createOfflineDataMap

      public void createOfflineDataMap(Window parentFrame, PamControlledUnit pamControlledUnit)
      1 Create offline datamap when modules are added in viewer mode AFTER initialisation.
      Parameters:
      parentFrame - not used
      pamControlledUnit - unit added.
    • mapNewDataBlock

      public void mapNewDataBlock(Window parentFrame, PamDataBlock dataBlock)
      Function to map a single new datablock.
      Parameters:
      parentFrame - parent frame for dialog
      dataBlock - datablock to map.
    • mapNewDataBlock

      public void mapNewDataBlock(Window parentFrame, ArrayList<PamDataBlock> dataBlocks)
      Map a list of data blocks.
      Parameters:
      parentFrame - parent frame for dialog
      dataBlocks - Array list of datablocks.
    • getDataSourceName

      public String getDataSourceName()
      Description copied from interface: OfflineDataStore
      Get the data source name
      Specified by:
      getDataSourceName in interface OfflineDataStore
      Returns:
      data source name
    • getDataLocation

      public String getDataLocation()
      Description copied from interface: OfflineDataStore
      Get the data location. This may be a specific file, or might be a folder if data are in many files, a URI, etc.
      Specified by:
      getDataLocation in interface OfflineDataStore
      Returns:
      store locations
    • loadData

      public boolean loadData(PamDataBlock dataBlock, OfflineDataLoadInfo offlineDataLoadInfo, ViewLoadObserver loadObserver)
      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
      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 PamConnection 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.
    • rewriteIndexFile

      public boolean rewriteIndexFile(PamDataBlock dataBlock, OfflineDataMapPoint dmp)
      Description copied from interface: OfflineDataStore
      Moved this function over from binary data store. Many storage systems may not be able to do this, but some might !
      Specified by:
      rewriteIndexFile in interface OfflineDataStore
      Returns:
    • getDatagramManager

      public DatagramManager getDatagramManager()
      Specified by:
      getDatagramManager in interface OfflineDataStore
      Returns:
      the datagramManager
    • getModuleStatus

      public ModuleStatus getModuleStatus()
      Description copied from class: PamControlledUnit
      Quick convenient way of getting the module status.
      Overrides:
      getModuleStatus in class PamControlledUnit
      Returns:
      Module Status or null if no status manager present.
    • getBackupInformation

      public BackupInformation getBackupInformation()
      Overrides:
      getBackupInformation in class PamControlledUnit
    • getStoreStatus

      public StoreStatus getStoreStatus(boolean getDetail)
      Description copied from interface: DataOutputStore
      Get the store status, i.e. does it exist, does it contain data, if so over what date range, etc.
      Specified by:
      getStoreStatus in interface DataOutputStore
      Returns:
    • deleteDataFrom

      public boolean deleteDataFrom(long timeMillis)
      Description copied from interface: DataOutputStore
      Delete all data from a given time, in all data streams.
      Specified by:
      deleteDataFrom in interface DataOutputStore
      Parameters:
      timeMillis - time to delete from (anything >= this time)
      Returns:
      true if it seems to have worked OK. False if any errors (e.g. database or file system error).
    • getOfflineState

      public int getOfflineState()
      Description copied from class: PamControlledUnit
      Get the offline state of this module. This can generally be idle, but can be a higher state when map making at startup and when running an offline task.
      Overrides:
      getOfflineState in class PamControlledUnit
      Returns:
    • getInegrityChecker

      public DataIntegrityChecker getInegrityChecker()
      Description copied from interface: DataOutputStore
      Get a data integrity checker. This can be called at startup to see if there is a problem.
      Specified by:
      getInegrityChecker in interface DataOutputStore
      Returns: