org.jscience.util
Class Backup

java.lang.Object
  extended by org.jscience.util.Backup
All Implemented Interfaces:
java.lang.Runnable, Licensed

public class Backup
extends java.lang.Object
implements java.lang.Runnable, Licensed

allows to easily backup directories. Copied are only those files that do not exist or have a modification date after the one that exists or have a different file length. Other existing files in the target directory remain there.

See Also:
ExtendedFile.synchronizeDir(File), JBackup

Constructor Summary
Backup(java.io.File originDir, java.io.File destinationDir)
          Creates a new Backup object.
Backup(java.io.File originDir, java.io.File destinationDir, java.io.FileFilter filter)
          Creates a new Backup object.
Backup(java.io.File originDir, java.io.File destinationDir, java.io.FileFilter filter, boolean deleteAtTarget)
          Creates a new Backup object.
Backup(java.io.File originDir, java.io.File destinationDir, java.io.FileFilter filter, boolean deleteAtTarget, Monitor monitor, Logger logger)
          Creates a new Backup object.
 
Method Summary
 void cancel()
          DOCUMENT ME!
 java.util.TimerTask createTimerTask()
          DOCUMENT ME!
 boolean getDeleteAtTarget()
          DOCUMENT ME!
 java.io.File getDestinationDir()
          DOCUMENT ME!
 java.io.FileFilter getFilter()
          DOCUMENT ME!
 Logger getLogger()
          DOCUMENT ME!
 Monitor getMonitor()
          DOCUMENT ME!
 java.io.File getOriginDir()
          DOCUMENT ME!
 boolean isRunning()
          DOCUMENT ME!
static void main(java.lang.String[] args)
          DOCUMENT ME!
 void run()
          performs the backup operation
 void setDeleteAtTarget(boolean flag)
          DOCUMENT ME!
 void setDestinationDir(java.io.File destinationDir)
          DOCUMENT ME!
 void setExcludeFiles(java.io.File[] excludeList)
          replaces any previous filter; the path matching is case-insensitive
 void setFilter(java.io.FileFilter filter)
          DOCUMENT ME!
 void setLogger(Logger logger)
          DOCUMENT ME!
 void setMonitor(Monitor monitor)
          DOCUMENT ME!
 void setNoSubDirsFilter()
          replaces any previous filter
 void setOriginDir(java.io.File originDir)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Backup

public Backup(java.io.File originDir,
              java.io.File destinationDir)
Creates a new Backup object.

Parameters:
originDir - DOCUMENT ME!
destinationDir - DOCUMENT ME!

Backup

public Backup(java.io.File originDir,
              java.io.File destinationDir,
              java.io.FileFilter filter)
Creates a new Backup object.

Parameters:
originDir - DOCUMENT ME!
destinationDir - DOCUMENT ME!
filter - DOCUMENT ME!

Backup

public Backup(java.io.File originDir,
              java.io.File destinationDir,
              java.io.FileFilter filter,
              boolean deleteAtTarget)
Creates a new Backup object.

Parameters:
originDir - DOCUMENT ME!
destinationDir - DOCUMENT ME!
filter - DOCUMENT ME!
deleteAtTarget - DOCUMENT ME!

Backup

public Backup(java.io.File originDir,
              java.io.File destinationDir,
              java.io.FileFilter filter,
              boolean deleteAtTarget,
              Monitor monitor,
              Logger logger)
Creates a new Backup object.

Parameters:
originDir - DOCUMENT ME!
destinationDir - DOCUMENT ME!
filter - DOCUMENT ME!
deleteAtTarget - DOCUMENT ME!
monitor - DOCUMENT ME!
logger - DOCUMENT ME!
Method Detail

setNoSubDirsFilter

public void setNoSubDirsFilter()
                        throws java.lang.IllegalStateException
replaces any previous filter

Throws:
java.lang.IllegalStateException - DOCUMENT ME!

setExcludeFiles

public void setExcludeFiles(java.io.File[] excludeList)
                     throws java.lang.IllegalArgumentException
replaces any previous filter; the path matching is case-insensitive

Parameters:
excludeList - DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

isRunning

public boolean isRunning()
DOCUMENT ME!

Returns:
DOCUMENT ME!

createTimerTask

public java.util.TimerTask createTimerTask()
DOCUMENT ME!

Returns:
DOCUMENT ME!

run

public void run()
performs the backup operation

Specified by:
run in interface java.lang.Runnable

cancel

public void cancel()
DOCUMENT ME!


getDeleteAtTarget

public boolean getDeleteAtTarget()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getMonitor

public Monitor getMonitor()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getLogger

public Logger getLogger()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getFilter

public java.io.FileFilter getFilter()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setDeleteAtTarget

public void setDeleteAtTarget(boolean flag)
DOCUMENT ME!

Parameters:
flag - DOCUMENT ME!

setLogger

public void setLogger(Logger logger)
               throws java.lang.IllegalStateException
DOCUMENT ME!

Parameters:
logger - DOCUMENT ME!
Throws:
java.lang.IllegalStateException - DOCUMENT ME!

setMonitor

public void setMonitor(Monitor monitor)
                throws java.lang.IllegalStateException
DOCUMENT ME!

Parameters:
monitor - DOCUMENT ME!
Throws:
java.lang.IllegalStateException - DOCUMENT ME!
java.lang.NullPointerException - DOCUMENT ME!

setFilter

public void setFilter(java.io.FileFilter filter)
               throws java.lang.IllegalStateException
DOCUMENT ME!

Parameters:
filter - DOCUMENT ME!
Throws:
java.lang.IllegalStateException - DOCUMENT ME!

setOriginDir

public void setOriginDir(java.io.File originDir)
                  throws java.lang.IllegalStateException
DOCUMENT ME!

Parameters:
originDir - DOCUMENT ME!
Throws:
java.lang.IllegalStateException - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!

setDestinationDir

public void setDestinationDir(java.io.File destinationDir)
                       throws java.lang.IllegalStateException
DOCUMENT ME!

Parameters:
destinationDir - DOCUMENT ME!
Throws:
java.lang.IllegalStateException - DOCUMENT ME!
java.lang.IllegalArgumentException - DOCUMENT ME!

getOriginDir

public java.io.File getOriginDir()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getDestinationDir

public java.io.File getDestinationDir()
DOCUMENT ME!

Returns:
DOCUMENT ME!

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
DOCUMENT ME!

Parameters:
args - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!