com.siviam.bobup.strategy
Class TowerOfHanoiBackupStrategy

java.lang.Object
  extended bycom.siviam.bobup.strategy.TowerOfHanoiBackupStrategy
All Implemented Interfaces:
IBackupStrategy

public class TowerOfHanoiBackupStrategy
extends java.lang.Object
implements IBackupStrategy

Backup strategy using the Tower of Hanoi strategy.

Author:
vishnu

Field Summary
static long ONE_DAY
           
static long ONE_MINUTE
           
 
Constructor Summary
TowerOfHanoiBackupStrategy()
           
TowerOfHanoiBackupStrategy(long periodicity)
          constructor.
 
Method Summary
protected  int getCurrentMediumNumberIndex()
          Obtains the currently set medium number index.
 int getMaxNumberOfMedia()
          Provides the number of media that are used for the backup.
 int getMediumNumber(boolean next)
          Obtains media/disk/folder number to be used for the backup according to this strategy.
 int getMediumNumber(java.util.Date epochDate, java.util.Date referenceDate)
          Obtains a medium number at the provided reference date given an "epoch" date i.e.
 long getPeriodicity()
          The medium for the backup will be switched after the current period has expired.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONE_DAY

public static long ONE_DAY

ONE_MINUTE

public static long ONE_MINUTE
Constructor Detail

TowerOfHanoiBackupStrategy

public TowerOfHanoiBackupStrategy()

TowerOfHanoiBackupStrategy

public TowerOfHanoiBackupStrategy(long periodicity)
constructor.

Method Detail

getMaxNumberOfMedia

public int getMaxNumberOfMedia()
Description copied from interface: IBackupStrategy
Provides the number of media that are used for the backup. This could be either physical disks, tapes or merely folders.

Specified by:
getMaxNumberOfMedia in interface IBackupStrategy
Returns:
the number of media.

getMediumNumber

public int getMediumNumber(boolean next)
Description copied from interface: IBackupStrategy
Obtains media/disk/folder number to be used for the backup according to this strategy.

Specified by:
getMediumNumber in interface IBackupStrategy
Parameters:
next - true if a new medium must be selected, false otherwise.
Returns:
the medium number that is currently being used.

getCurrentMediumNumberIndex

protected int getCurrentMediumNumberIndex()
Obtains the currently set medium number index. Implementations can persist the medium number index and recover the current number in the case of a server restart, for instance. The default implementation merely returns the currently set medium number index.

Returns:
the currently set medium number index.

getMediumNumber

public int getMediumNumber(java.util.Date epochDate,
                           java.util.Date referenceDate)
Description copied from interface: IBackupStrategy
Obtains a medium number at the provided reference date given an "epoch" date i.e. the date when the backups were first started for the system.

Specified by:
getMediumNumber in interface IBackupStrategy
Parameters:
epochDate -
referenceDate -
Returns:

getPeriodicity

public long getPeriodicity()
Description copied from interface: IBackupStrategy
The medium for the backup will be switched after the current period has expired. The periodicity is configurable for the strategy.

Specified by:
getPeriodicity in interface IBackupStrategy
Returns:
the periodicity in milliseconds.


Copyright © 2001-2006. All Rights Reserved.