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
        Returns:
        may be zero length if no backups
      • getFirstBackupTime

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

        @CheckForNull
        public java.util.Date 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 java.io.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
      • 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