Class BackupCatalog

java.lang.Object
backupmanager.database.BackupCatalog
Direct Known Subclasses:
DatabaseCatalog

public abstract class BackupCatalog extends Object
Catalogue data that are already backed up. Can do this by scanning the backup directory, but preferred option is to use the database since this can hold more information about what is already backup up and what actions have been performed and why.

Order of operations for all the backing up using the database is
1) List all files in source folder (in DataStream)
2) Check table (can do in constructor)
3) Get all files already in output database and cross check to make list of new files. This doesn't mean that the files have been backed up, just that they are catalogued
4) For each action, re-query the database to see which items have null in that action column
5) run action on that item, and update that row of the database
6) Repeat 4 invalid input: '&' 5 for next action.

If this was done without the database, it's harder !
1) List all files in source (step 1 above)
2) For each action , list all files in destination and make list of source files not in dest
3) Run action on each item
4) Repeat 2 and 3 for next action

Author:
dg50
  • Constructor Details

  • Method Details

    • catalogNewItems

      public abstract List<StreamItem> catalogNewItems(List<StreamItem> allSourceItems)
      If possible, save new items in the backup catalog. Doesn't look at output of actions yet. Used by the database to add to the backuptable.
      Parameters:
      allSourceItems - all source items
      Returns:
      items added to the catalog (hopefully a subset).
    • getUnactedItems

      public abstract List<StreamItem> getUnactedItems(List<StreamItem> sourceItems, BackupAction action)
      Get a list of items that have not been operated by the given action (may vary by action, particularly if new actions are added).
      Parameters:
      sourceItems - all potentially new items.
      action -
      Returns:
      list of items that need acting on.
    • updateItem

      public abstract boolean updateItem(StreamItem streamItem, BackupAction action)
      Once an action is complete, store it's result (if possible)
      Parameters:
      streamItem -
      action -
      Returns:
    • getBackupStream

      public BackupStream getBackupStream()
      Returns:
      the backupStream
    • getSource

      public String getSource()
      Returns:
      the source
    • backupComplete

      public abstract void backupComplete()
      Called when backup of a stream is complete so that catalogue can be closed.