Class BaseMonitor

java.lang.Object
java.lang.Thread
de.dlr.proseo.api.basemon.BaseMonitor
All Implemented Interfaces:
Runnable

public abstract class BaseMonitor extends Thread
Base class for implementing monitors on pickup points ("interface points" in the ESA Ground Segment Framework architecture). The monitor is intended to run "forever" (i. e. until it is shut down by an interrupt), so it does not terminate on errors during transfer or follow-up actions. It does terminate if it cannot correctly write its transfer history.
Author:
Dr. Thomas Bassler
  • Constructor Details

    • BaseMonitor

      public BaseMonitor()
  • Method Details

    • getCheckInterval

      public long getCheckInterval()
      Gets the interval between pickup point checks
      Returns:
      the checkInterval the interval in milliseconds
    • setCheckInterval

      public void setCheckInterval(long checkInterval)
      Sets the interval between pickup point checks
      Parameters:
      checkInterval - the check interval to set in milliseconds
    • getTransferHistoryFile

      public Path getTransferHistoryFile()
      Gets the file path of the transfer history file
      Returns:
      the path to the transfer history file
    • setTransferHistoryFile

      public void setTransferHistoryFile(Path transferHistoryFile)
      Gets the file path of the transfer history file
      Parameters:
      transferHistoryFile - the path to the transfer history file to set
    • getTruncateInterval

      public long getTruncateInterval()
      Gets the interval to truncate transfer history file
      Returns:
      the truncation interval
    • setTruncateInterval

      public void setTruncateInterval(long truncateInterval)
      Sets the interval to truncate transfer history file
      Parameters:
      truncateInterval - the truncation interval to set
    • getHistoryRetentionDuration

      public Duration getHistoryRetentionDuration()
      Gets the period to retain transfer history entries for
      Returns:
      the history retention duration
    • setHistoryRetentionDuration

      public void setHistoryRetentionDuration(Duration historyRetentionDuration)
      Sets the period to retain transfer history entries for
      Parameters:
      historyRetentionDuration - the history retention duration to set
    • getMaxDownloadThreads

      public int getMaxDownloadThreads()
      Gets the maximum number of parallel download threads
      Returns:
      the maximum number of download threads
    • setMaxDownloadThreads

      public void setMaxDownloadThreads(int maxDownloadThreads)
      Sets the maximum number of parallel download threads
      Parameters:
      maxDownloadThreads - the maximum number of download threads to set
    • getTaskWaitInterval

      public int getTaskWaitInterval()
      Gets the interval to check for completed subtasks
      Returns:
      the task wait interval in millliseconds
    • setTaskWaitInterval

      public void setTaskWaitInterval(int taskWaitInterval)
      Sets the interval to check for completed subtasks
      Parameters:
      taskWaitInterval - the task wait interval in millliseconds to set
    • getMaxWaitCycles

      public int getMaxWaitCycles()
      Gets the maximum number of wait cycles for task completion checks
      Returns:
      the maximum number of wait cycles
    • setMaxWaitCycles

      public void setMaxWaitCycles(int maxWaitCycles)
      Sets the maximum number of wait cycles for task completion checks
      Parameters:
      maxWaitCycles - the maximum number of wait cycles to set
    • checkAvailableDownloads

      protected abstract BaseMonitor.TransferControl checkAvailableDownloads(Instant referenceTimeStamp)
      Check the pickup point for available objects (unfiltered)
      Parameters:
      referenceTimeStamp - the reference timestamp to apply for pickup point lookups
      Returns:
      a transfer control object containing the latest reference time and a list of available transfer objects
    • transferToTargetDir

      protected abstract boolean transferToTargetDir(TransferObject object)
      Download the given transfer object from the pickup point and copy it to the configured target directory
      Parameters:
      object - the transfer object to download
      Returns:
      true, if the download was successful, false otherwise
    • triggerFollowOnAction

      protected abstract boolean triggerFollowOnAction(TransferObject object)
      Trigger any necessary follow-on action on the transfer object (processing, order generation etc.)
      Parameters:
      object - the transfer object to start the action on
      Returns:
      true, if starting the action succeeded (not necessarily the action itself), false otherwise
    • run

      public void run(Integer maxCycles)
      Monitoring loop:
      1. Check data availability on pickup point
      2. Filter objects not yet processed from transfer history
      3. For all objects not yet processed:
        1. Transfer object to local target directory
        2. Record transfer in history
        3. Trigger follow-on action
      Parameters:
      maxCycles - maximum number of loop cycles (if null, run forever)
    • run

      public void run()
      Run forever (as required by Thread superclass, at the same time convenience function for calling run(Integer) with a null argument)
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread