Package jmri.jmrix.can.cbus.node
Class CbusNodeBackupManager
java.lang.Object
jmri.jmrix.can.cbus.node.CbusNodeBackupManager
Class to work with CbusNode xml files
Loosely based on
Load and store the timetable data file: TimeTableData.xml
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new CbusNodeBackupManager -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddoLoad()Full XML load.booleandoStore(boolean createNew, boolean seenErrors) Save the xml to user profile trims backup list as per user pref.Get a list of all of the backups currently in the xml fileprotected booleanprotected FileGet the XML File LocationGet the time of first full backup for the Node.Get the time of last full backup for the Node.intGet the current backup status for the Node.protected voidAdd an xml entry advising Node in SLiM Modeprotected voidAdd an xml entry advising Node Not on Networkprotected booleanremoveNode(boolean rotate) Remove Node XML Fileprotected voidReset the backup array for testingprotected voidsetBackupStarted(boolean started) Set internal flag for backup started.protected void
-
Field Details
-
xmlDateStyle
-
-
Constructor Details
-
CbusNodeBackupManager
Create a new CbusNodeBackupManager- Parameters:
node- the CbusNode which the xml is associated with
-
-
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
-
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
Full XML load. Searches for XML file for the node and reads info Sets internal flag so can only be triggered once -
doStore
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 savesseenErrors- if true sets backup completed with errors, else logs as backup complete- Returns:
- true if all OK, else false if error occurred
-
nodeNotOnNetwork
Add an xml entry advising Node Not on Network -
nodeInSLiM
Add an xml entry advising Node in SLiM Mode -
removeNode
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
Get the XML File Location- Returns:
- Location of the file, creating new if required
-
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
Set internal flag for backup started. Triggered within the backup script which is called from various places- Parameters:
started- true if started
-
getBackupStarted
-
setNodeInSlim
-