BackupsRootFolder
Date: 2017-06-10

org.gcube.informationsystem.collector.impl.xmlstorage.backup

## Class BackupsRootFolder

- java.lang.Object
- - org.gcube.informationsystem.collector.impl.xmlstorage.backup.BackupsRootFolder

-     public class BackupsRootFolder
      extends java.lang.Object

  An abstract representation of the backups root folder
  Author:
    Manuele Simi (ISTI-CNR)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BackupsRootFolder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BackupFolder` | `createBackupFolder()` Creates a new backup folder in the BackupsRoot folder.
    `static <T extends BackupFolder> T` | `getLastBackup(java.lang.Class<T> backupType, java.io.FileFilter... filter)` Gets the last modified backup in the BackupsRoot folder
    `static void` | `manageOldBackups(java.io.FileFilter... filter)` Manages the backup folder as a circular queue by maintaining only the latest N backups.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BackupsRootFolder

          public BackupsRootFolder()

  - ### Method Detail

    - #### createBackupFolder

          public static BackupFolder createBackupFolder()
                                                 throws java.io.IOException

      Creates a new backup folder in the BackupsRoot folder.
      The root folder is specified as value of the backupDir variable in the service's JNDI file
      Returns:
        the new backup Folder
      Throws:
        `java.io.IOException` - if the creation fails

    - #### manageOldBackups

          public static void manageOldBackups(java.io.FileFilter... filter)
                                       throws java.io.IOException

      Manages the backup folder as a circular queue by maintaining only the latest N backups.
      N is specified as value of the maxBackups variable in the service's JNDI file
      Parameters:
        `filter` - the file filter to identify valid backups in the BackupsRoot
      Throws:
        `java.io.IOException`

    - #### getLastBackup

          public static <T extends BackupFolder> T getLastBackup(java.lang.Class<T> backupType,
                                                 java.io.FileFilter... filter)
                                                      throws java.io.IOException

      Gets the last modified backup in the BackupsRoot folder
      Type Parameters:
        `T` - the class of the backup folder
      Parameters:
        `backupType` - the type class
        `filter` - the file filter to identify valid backups in the BackupsRoot
      Returns:
      Throws:
        `java.io.IOException`