Class OfflineDataLoading<T extends PamDataUnit>

java.lang.Object
PamguardMVC.dataOffline.OfflineDataLoading<T>

public class OfflineDataLoading<T extends PamDataUnit> extends Object
Handles the loading of offline data from a PamDataBlock.
Author:
Jamie Macaulay
  • Field Details

    • OFFLINE_DATA_INTERRUPT

      public static final int OFFLINE_DATA_INTERRUPT
      The current thread will be cancelled.
      See Also:
    • OFFLINE_DATA_WAIT

      public static final int OFFLINE_DATA_WAIT
      The current thread will continu and the next thread will be executed.
      See Also:
    • OFFLINE_DATA_CANCEL

      public static final int OFFLINE_DATA_CANCEL
      If the current thread is not null then the new order will not be executed.
      See Also:
    • REQUEST_NO_DATA

      public static final int REQUEST_NO_DATA
      No data available for offline loading.
      See Also:
    • REQUEST_DATA_LOADED

      public static final int REQUEST_DATA_LOADED
      Data loaded for requested time period.
      See Also:
    • REQUEST_DATA_PARTIAL_LOAD

      public static final int REQUEST_DATA_PARTIAL_LOAD
      Data partially loaded for requested time period
      See Also:
    • REQUEST_SAME_REQUEST

      public static final int REQUEST_SAME_REQUEST
      this is exactly the same data as requested last time.

      This flag will be used with one of the other three.

      See Also:
    • REQUEST_INTERRUPTED

      public static final int REQUEST_INTERRUPTED
      The request was interrupted (in multi thread load)
      See Also:
    • REQUEST_EXCEPTION

      public static final int REQUEST_EXCEPTION
      The request threw an exception of some sort.
      See Also:
    • orderLock

      public Object orderLock
  • Constructor Details

    • OfflineDataLoading

      public OfflineDataLoading(PamDataBlock<T> pamDataBlock)
      Constructor for the offline data loader.
      Parameters:
      pamDataBlock - - the datablock.
  • Method Details

    • orderOfflineData

      public void orderOfflineData(PamObserver dataObserver, LoadObserver loadObserver, long startMillis, long endMillis, int loadKeepLayers, int interrupt, boolean allowRepeats)
      Similar functionality to getOfflineData, but this will launch a separate worker thread to do the actual work getting the data. The worker thread will call getOfflineData.

      getOfflineData will probably (if not overridden) be sending data to the update member function of the observer, but from the worker thread. Once it's complete, it will send a message to say that data are loaded.

      It's possible that the user will do something which causes this to be called again before the previous thread completed execution, in which case there are three options:

      OFFLINE_DATA_INTERRUPT - previous thread will be terminated

      OFFLINE_DATA_WAIT - wait for previous thread to terminate, then start this load

      OFFLINE_DATA_CANCEL - give up and return

      Parameters:
      dataObserver - observer of the loaded data
      loadObserver - observer to get status information on the load.
      startMillis - data start time in milliseconds
      endMillis - data end time in milliseconds.
      loadKeepLayers - Number of layers of datablock which should hang on to loaded data rather than delete it immediately.
      interrupt - interrupt options.
      allowRepeats - allow repeated loads of exactly the same data.
    • orderOfflineData

      public void orderOfflineData(OfflineDataLoadInfo offlineDataInfo)
      Similar functionality to getOfflineData, but this will launch a separate worker thread to do the actual work getting the data. The worker thread will call getOfflineData.

      getOfflineData will probably (if not overridden) be sending data to the update member function of the observer, but from the worker thread. Once it's complete, it will send a message to say that data are loaded.

      It's possible that the user will do something which causes this to be called again before the previous thread completed execution, in which case there are three options:

      OFFLINE_DATA_INTERRUPT - previous thread will be terminated

      OFFLINE_DATA_WAIT - wait for previous thread to terminate, then start this load

      OFFLINE_DATA_CANCEL - give up and return

      OFFLINE_DATA_CANCEL - give up and return

      Parameters:
      offlineDataInfo - the OfflineDataLoadInfo object which stores all parameters for the data load.
    • cancelDataOrder

      public void cancelDataOrder()
      Cancels the current order.
    • cancelDataOrder

      public void cancelDataOrder(boolean que)
      Parameters:
      que -
    • getOrderStatus

      public boolean getOrderStatus()
      Returns:
      true if an order for data is currently still being processed.
    • getOfflineData

      public int getOfflineData(OfflineDataLoadInfo offlineDataInfo)
      Gets data for offline display, playback, etc.

      This is used to get data from some upstream process which is quite different to the function loadViewerData(...) which loads data directly associated with this data block.

      For example, this might be called in the FFT data block by the spectrogram which wants some data to display. The FFT data block does not have this data, so it passes the request up to it's process which will in turn pass the request on until it reaches a module which is capable of loading data into data units and sending them back down the line.

      Parameters:
      observer - data observer which will receive the data
      startMillis - start time in milliseconds
      endMillis - end time in milliseconds
      loadKeepLayers -
      allowRepeats - allow the same data to be loaded a second time.
      cancellationObject -
      Returns:
      answer: .
    • notifyOfflineObservers

      public void notifyOfflineObservers(T pamDataUnit)
    • isCurrentOfflineLoadKeep

      public boolean isCurrentOfflineLoadKeep()
    • setCurrentOfflineLoadKeep

      public void setCurrentOfflineLoadKeep(boolean currentOfflineLoadKeep)