Package backupmanager.stream
Class BackupStream
java.lang.Object
backupmanager.stream.BackupStream
- All Implemented Interfaces:
BackupFunction
,PamSettings
,SettingsNameProvider
- Direct Known Subclasses:
FileBackupStream
This is the central management class for each datastream that's going to get automatically backed up.
It will have links to the stream information, database info, etc. and manage the calls on a schedule to
process and backup data.
- Author:
- dg50
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAction
(BackupAction action) Add an actionabstract void
Called when backup of a stream is complete so that catalogue can be closed, etc.abstract List<StreamItem>
build the data catalogue from the last item in the current database.boolean
doAction
(BackupManager backupManager, BackupAction action, StreamItem streamItem) Carry out some action or other on the stream item.abstract List<ActionMaker>
Get the amount of space remaining at the data source locationabstract BackupSettings
Return basic settings.getDialogPanel
(Window owner) A dialog panelgetName()
long
abstract List<StreamItem>
getToDoList
(List<StreamItem> sourceItems, BackupAction action) Get a list of items that this action needs to work on.boolean
removeAction
(BackupAction action) remove an actionboolean
restoreSettings
(PamControlledUnitSettings pamControlledUnitSettings) boolean
runBackup
(BackupManager backupManager) Run all backups associated with this stream.abstract boolean
setBackupSettings
(BackupSettings restoredSettings) Set settings when read back from PmSettings.abstract void
updateActedItem
(BackupAction action, StreamItem streamItem)
-
Constructor Details
-
BackupStream
-
-
Method Details
-
runBackup
Run all backups associated with this stream. There is a single SwingWorker running ALL backups in turn, so this will already be running in a separate thread and it should send updates back to the manager which can forward them onto observers in the AWT thread (I think). These will have- Parameters:
backupManager
-- Returns:
-
catalogData
build the data catalogue from the last item in the current database.
Individual actions may want to look in the database to see if they have themselves acted on the data, so will run their own query.Note that catalogData and getToDoList are separate functions, the idea being that catalog data will be listing all files in the source folder (or ones not already listed in the database table) whereas getToDoList can provide a set of files that are associated with a particular action, which may be a subset of files found in catalogData or may ignore catalogData in it's entirity.
- Returns:
-
getToDoList
Get a list of items that this action needs to work on. this may be a subset of sourceItems- Parameters:
sourceItems
-action
-- Returns:
-
updateActedItem
-
getName
- Specified by:
getName
in interfaceBackupFunction
- Returns:
- a String name
-
doAction
public boolean doAction(BackupManager backupManager, BackupAction action, StreamItem streamItem) throws BackupException Carry out some action or other on the stream item.- Parameters:
backupManager
-action
- Backup action to perform- Returns:
- true if successful, otherwise false
- Throws:
BackupException
-
addAction
Add an action- Parameters:
action
-
-
removeAction
remove an action- Parameters:
action
-- Returns:
-
getActions
- Returns:
- the actions
-
getDialogPanel
Description copied from interface:BackupFunction
A dialog panel- Specified by:
getDialogPanel
in interfaceBackupFunction
- Parameters:
owner
- owner should be the dialog, not the main PAMGuard frame- Returns:
- dialog panel (can be null if no options to set).
-
getBackupSettings
Return basic settings. Cannot be null. does not need to add all of the Action and Decision settings since that will all be handled by the calling functions getSettings from pamSettings- Returns:
-
setBackupSettings
Set settings when read back from PmSettings. Should always br the right type, but return flase if it isn't.- Parameters:
restoredSettings
-- Returns:
-
getUnitName
- Specified by:
getUnitName
in interfaceSettingsNameProvider
- Returns:
- A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
-
getUnitType
- Specified by:
getUnitType
in interfacePamSettings
- Returns:
- A Name specific to the type, e.g. Click detector
-
getSettingsReference
- Specified by:
getSettingsReference
in interfacePamSettings
- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersion
in interfacePamSettings
- Returns:
- An integer version number for the settings
-
restoreSettings
- Specified by:
restoreSettings
in interfacePamSettings
- Returns:
- true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
-
getAvailableSpace
Get the amount of space remaining at the data source location- Returns:
- space in bytes
-
backupComplete
public abstract void backupComplete()Called when backup of a stream is complete so that catalogue can be closed, etc. -
getAvailableActions
-