Class CbusNodeBackupManager

java.lang.Object
jmri.jmrix.can.cbus.node.CbusNodeBackupManager

public class CbusNodeBackupManager extends Object
Class to work with CbusNode xml files Loosely based on Load and store the timetable data file: TimeTableData.xml
  • Field Details

  • Constructor Details

  • Method Details

    • getBackups

      Get a list of all of the backups currently in the xml file
      Returns:
      may be zero length if no backups
    • getNumCompleteBackups

      public int getNumCompleteBackups()
    • getFirstBackupTime

      Get the time of first full backup for the Node.
      Returns:
      value else null if unknown
    • getLastBackupTime

      Get the time of last full backup for the Node.
      Returns:
      value else null if unknown
    • doLoad

      public final void doLoad()
      Full XML load. Searches for XML file for the node and reads info Sets internal flag so can only be triggered once
    • doStore

      public boolean doStore(boolean createNew, boolean seenErrors)
      Save the xml to user profile trims backup list as per user pref.
      Parameters:
      createNew - if true, creates a new backup then saves, false just saves
      seenErrors - if true sets backup completed with errors, else logs as backup complete
      Returns:
      true if all OK, else false if error occurred
    • nodeNotOnNetwork

      protected void nodeNotOnNetwork()
      Add an xml entry advising Node Not on Network
    • nodeInSLiM

      protected void nodeInSLiM()
      Add an xml entry advising Node in SLiM Mode
    • removeNode

      protected boolean removeNode(boolean rotate)
      Remove Node XML File
      Parameters:
      rotate - if true, creates and rotates .bup files before delete, false just deletes the core node file
      Returns:
      true on success, else false
    • getFileLocation

      protected File getFileLocation()
      Get the XML File Location
      Returns:
      Location of the file, creating new if required
    • resetBupArray

      protected void resetBupArray()
      Reset the backup array for testing
    • getSessionBackupStatus

      Get the current backup status for the Node.
      Returns:
      ENUM from CbusNodeConstants, e.g. BackupType.OUTSTANDING or BackupType.COMPLETE
    • setBackupStarted

      protected void setBackupStarted(boolean started)
      Set internal flag for backup started. Triggered within the backup script which is called from various places
      Parameters:
      started - true if started
    • getBackupStarted

      protected boolean getBackupStarted()
    • setNodeInSlim

      protected void setNodeInSlim()