Class CbusNodeBackupManager

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

      • xmlDateStyle

        public final java.text.SimpleDateFormat xmlDateStyle
    • Method Detail

      • getBackups

        public java.util.ArrayList<CbusNodeFromBackupgetBackups()
        Get a list of all of the backups currently in the xml file
        may be zero length if no backups
      • getFirstBackupTime

        public java.util.Date getFirstBackupTime()
        Get the time of first full backup for the Node.
        value else null if unknown
      • getLastBackupTime

        public java.util.Date getLastBackupTime()
        Get the time of last full backup for the Node.
        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.
        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
        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
        rotate - if true, creates and rotates .bup files before delete, false just deletes the core node file
        true on success, else false
      • getFileLocation

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

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

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