Package PamController

Class PamConfiguration

java.lang.Object
PamController.PamConfiguration

public class PamConfiguration extends Object
Class to take all of the configuration information out of PamController. This is because PamController is a singleton class, so there can only every be one of them, but for some of the batch processing control, we need to be able to load and manipulate a second set of modules, which do nothing within the running configuration, but are there to allow us to set up a configuration to send to other batch processes in viewer mode. This is also being used in an improved module import system.
Author:
dg50
  • Constructor Details

    • PamConfiguration

      public PamConfiguration()
  • Method Details

    • setupProcesses

      public void setupProcesses()
      Call setupControlledUnit() on all modules.
    • canClose

      public boolean canClose()
      Can PAMGUARD shut down. This question is asked in turn to every module. Each module should attempt to make sure it can answer true, e.g. by closing files, but if any module returns false, then canClose() will return false;
      Returns:
      whether it's possible to close PAMGUARD without corrupting or losing data.
    • pamClose

      public void pamClose()
      Called after canClose has returned true to finally tell all modules that PAMGUARD is definitely closing down.so they can free any resources, etc.
    • getPamControlledUnits

      public ArrayList<PamControlledUnit> getPamControlledUnits()
      Returns:
      the pamControlledUnits
    • addControlledUnit

      public void addControlledUnit(PamControlledUnit controlledUnit)
      Add a PamControlledUnit to the main list.
      Parameters:
      controlledUnit -
    • removeControlledUnt

      public boolean removeControlledUnt(PamControlledUnit controlledUnit)
    • reOrderModules

      public boolean reOrderModules(int[] newOrder)
      re-order the modules according to the given list.
      Parameters:
      newOrder -
      Returns:
    • getControlledUnit

      public PamControlledUnit getControlledUnit(int iUnit)
    • findControlledUnit

      public PamControlledUnit findControlledUnit(String unitType)
    • getNumControlledUnits

      public int getNumControlledUnits()
    • getRawDataBlock

      public PamRawDataBlock getRawDataBlock(int id)
    • getRawDataBlock

      public PamRawDataBlock getRawDataBlock(String name)
    • getDataBlock

      public PamDataBlock getDataBlock(Class blockType, String name)
      Find a block of a given type with the given name, or null if it doesn't exist.
      Parameters:
      blockType - -- RAW, FFT, DETECTOR, null, etc.
      name - -- the block name
      Returns:
      block, which you may want to cast to a subtype
    • getDataBlocks

      public ArrayList<PamDataBlock> getDataBlocks(Class blockType, boolean includeSubClasses)
    • getDetectorDataBlocks

      public ArrayList<PamDataBlock> getDetectorDataBlocks()
    • getFFTDataBlocks

      public ArrayList<PamDataBlock> getFFTDataBlocks()
    • getFFTDataBlock

      public PamDataBlock getFFTDataBlock(int id)
    • getFFTDataBlock

      public PamDataBlock getFFTDataBlock(String name)
    • getDataBlock

      public PamDataBlock getDataBlock(Class blockType, int id)
      Find a block of a given type with the id number, or null if the number is out of range.
      Parameters:
      blockType -
      id - -- the block id number
      Returns:
      block, which you may want to cast to a subtype
    • getRawDataBlocks

      public ArrayList<PamDataBlock> getRawDataBlocks()
    • getDataBlockByLongName

      public PamDataBlock getDataBlockByLongName(String longName)
      Find a block with the given long name, or null if it doesn't exist.
      Parameters:
      longName - the long name of the PamDataBlock
      Returns:
      block
    • getDataBlocks

      public ArrayList<PamDataBlock> getDataBlocks()
    • findControlledUnits

      public ArrayList<PamControlledUnit> findControlledUnits(String unitType)
      Get a list of PamControlledUnit units of a given type
      Parameters:
      unitType - Controlled unit type
      Returns:
      list of units.
    • findControlledUnits

      public ArrayList<PamControlledUnit> findControlledUnits(String unitType, String unitName)
      Get a list of PamControlledUnit units of a given type and name, allowing for nulls.
      Parameters:
      unitType - Controlled unit type, can be null for all units of name
      unitName - Controlled unit name, can be null for all units of type
      Returns:
      list of units.
    • findControlledUnit

      public PamControlledUnit findControlledUnit(String unitType, String unitName)
      find the first controlled unit with the given type and name.
      Parameters:
      unitType -
      unitName -
      Returns:
    • findControlledUnit

      public PamControlledUnit findControlledUnit(Class unitClass, String unitName)
      Find the first instance of a module with a given class type and name.

      Name can be null in which case the first module with the correct class will be returned

      Parameters:
      unitClass - Module class (sub class of PamControlledUnit)
      unitName - Module Name
      Returns:
      Existing module with that class and name.
    • findControlledUnits

      public ArrayList<PamControlledUnit> findControlledUnits(Class unitClass)
      Get an Array list of PamControlledUnits of a particular class (exact matches only).
      Parameters:
      unitClass - PamControlledUnit class
      Returns:
      List of current instances of this class.
    • findControlledUnits

      public ArrayList<PamControlledUnit> findControlledUnits(Class unitClass, boolean includeSubClasses)
      Get an Array list of PamControlledUnits of a particular class (exact matches only).
      Parameters:
      unitClass - PamControlledUnit class
      Returns:
      List of current instances of this class.
    • isControlledUnit

      public boolean isControlledUnit(String controlName)
      Check whether a controlled unit exists based on it's name.
      Parameters:
      the - controlled unit name e.g. "my crazy click detector", not the default name.
    • saveSettings

      public void saveSettings(long timeNow)
      Gets called in pamStart and may / will attempt to store all PAMGUARD settings via the database and binary storage modules.
    • findSettingsSources

      public ArrayList<PamSettingsSource> findSettingsSources()
      Returns:
      a list of PamControlledUnits which implements the PamSettingsSource interface
      See Also:
    • getPlottableDataBlocks

      public ArrayList<PamDataBlock> getPlottableDataBlocks(GeneralProjector generalProjector)
    • makeDataBlockList

      public ArrayList<PamDataBlock> makeDataBlockList(Class classType, boolean includSubClasses)
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
    • getSettingsReference

      public Serializable getSettingsReference()
    • destroyModel

      public void destroyModel()
    • getControlledUnitIndex

      public int getControlledUnitIndex(PamControlledUnit unit)
      Get the index of a PamControlledUnit
      Parameters:
      unit -
      Returns:
    • findBinaryStorePath

      public String findBinaryStorePath()
      Find the path to the binary store ....
      Returns:
      path to the binary store.
    • getAllOfflineTaskGroups

      public ArrayList<OfflineTaskGroup> getAllOfflineTaskGroups()
      Get a list of all offline task groups in this configuration
      Returns:
      task group list
    • getAllOfflineTasks

      public ArrayList<OfflineTask> getAllOfflineTasks()
      Get a list of all offline tasks in the configuration
      Returns:
      offline task list