Class OfflineFileServer<TmapPoint extends FileDataMapPoint>

java.lang.Object
dataMap.filemaps.OfflineFileServer<TmapPoint>
All Implemented Interfaces:
OfflineDataStore, PamSettings, SettingsNameProvider
Direct Known Subclasses:
OfflineWavFileServer

public abstract class OfflineFileServer<TmapPoint extends FileDataMapPoint> extends Object implements OfflineDataStore, PamSettings
Functionality for handling data from files offline. Was just for sound files, now made more generic for any file type.
Author:
Doug Gillespie
  • Constructor Details

    • OfflineFileServer

      public OfflineFileServer(OfflineFileDataStore offlineRawDataStore)
      Parameters:
      offlineRawDataStore - master controlled unit - acquisition or decimator usually.
      fileDate - file date - passed around so that settings can be shared.
  • Method Details

    • createDataMap

      public abstract OfflineDataMap<TmapPoint> createDataMap(OfflineFileServer<TmapPoint> offlineFileServer, PamDataBlock 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()
      Create the offline data map.
    • getFileFilter

      public abstract FileFilter getFileFilter()
      Get a file filter for the types of files in use.
      Returns:
      file filter.
    • loadSerialisedMap

      public boolean loadSerialisedMap()
    • saveSerialisedMap

      public void saveSerialisedMap()
    • getFileStartandEndTime

      public abstract long[] getFileStartandEndTime(File file)
      Get the file start and end times through whatever means are required.
      Parameters:
      file -
      Returns:
      2 element of times. Fill with 0 if no times available.
    • createMapPoint

      public abstract TmapPoint createMapPoint(File file, long startTime, long endTime)
      Create the type specific data map point.
      Parameters:
      file -
      startTime -
      endTime -
      Returns:
    • sortMapEndTimes

      public abstract void sortMapEndTimes()
      Get the end times of map points. In most cases the data will have come back from the serialised file, so will already have this information so it can be skipped.
    • 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
    • findFirstMapPoint

      public TmapPoint findFirstMapPoint(Iterator<TmapPoint> mapIterator, long startMillis, long endMillis)
    • 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.
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Returns:
      An integer version number for the settings
    • getUnitName

      public String getUnitName()
      Specified by:
      getUnitName in interface SettingsNameProvider
      Returns:
      A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Returns:
      A Name specific to the type, e.g. Click detector
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
    • getOfflineFileParameters

      public OfflineFileParameters getOfflineFileParameters()
      Returns:
      the offlineFileParameters
    • setOfflineFileParameters

      public void setOfflineFileParameters(OfflineFileParameters offlineFileParameters)
      Parameters:
      offlineFileParameters - the offlineFileParameters to set
    • getDataMap

      public OfflineDataMap<TmapPoint> getDataMap()
      Returns:
      the dataMap
    • getRawDataBlock

      public PamDataBlock getRawDataBlock()
      Returns:
      the rawDataBlock
    • 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
    • getOfflineRawDataStore

      public OfflineFileDataStore getOfflineRawDataStore()
      Returns:
      the offlineRawDataStore