net.datacrow.drivemanager
Class DriveManager

java.lang.Object
  extended by net.datacrow.drivemanager.DriveManager

public class DriveManager
extends java.lang.Object

The Drive Manager of Data Crow. Schedules tasks to scan drives for files, allows current file locations to be retrieved and checks the system for new mounted / inserted discs.


Field Summary
static int _PRECISION_HIGHEST
           
static int _PRECISION_LOWEST
           
static int _PRECISION_MEDIUM
           
 
Method Summary
 void addPollerListener(IDriveManagerListener listener)
           
 void addScannerListener(IDriveManagerListener listener)
           
 void addSynchronizerListener(IDriveManagerListener listener)
           
 boolean drivesWereScanned()
           
 void exclude(java.lang.String directory)
           
 FileInfo find(FileInfo fi, int precision)
          Retrieves the actual location / file for the given filename.
 java.util.Collection<java.io.File> getDrives()
           
 java.util.Collection<java.lang.String> getExcludedDirs()
           
static DriveManager getInstance()
           
 java.util.Collection<IDriveManagerListener> getPollerListeners()
           
 java.util.Collection<IDriveManagerListener> getScannerListeners()
           
 java.util.Collection<IDriveManagerListener> getSynchronizerListeners()
           
protected  java.lang.String getTempDir()
           
protected  java.lang.String getTempFileSuffix()
           
protected  boolean isDirExcluded(java.io.File directory)
           
 boolean isScanActive()
           
 void notifyJobStarted(java.util.Collection<IDriveManagerListener> listeners)
           
 void notifyJobStopped(java.util.Collection<IDriveManagerListener> listeners)
           
protected  void notifyScanComplete(DriveScanner scanner)
           
 void restartScan(java.io.File drive)
           
 void sendMessage(java.util.Collection<IDriveManagerListener> listeners, java.lang.String msg)
           
 void setDrives(java.util.Collection<java.io.File> drives)
           
 void setExcludedDirectories(java.util.Collection<java.lang.String> directories)
           
 void startDrivePoller()
           
 void startFileSynchronizer(int precision)
           
 void startScanners()
           
 void stopDrivePoller()
           
 void stopFileSynchronizer()
           
 void stopScanners()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_PRECISION_LOWEST

public static final int _PRECISION_LOWEST
See Also:
Constant Field Values

_PRECISION_MEDIUM

public static final int _PRECISION_MEDIUM
See Also:
Constant Field Values

_PRECISION_HIGHEST

public static final int _PRECISION_HIGHEST
See Also:
Constant Field Values
Method Detail

getInstance

public static DriveManager getInstance()

startDrivePoller

public void startDrivePoller()
                      throws JobAlreadyRunningException
Throws:
JobAlreadyRunningException

startFileSynchronizer

public void startFileSynchronizer(int precision)
                           throws JobAlreadyRunningException
Throws:
JobAlreadyRunningException

sendMessage

public void sendMessage(java.util.Collection<IDriveManagerListener> listeners,
                        java.lang.String msg)

notifyJobStopped

public void notifyJobStopped(java.util.Collection<IDriveManagerListener> listeners)

notifyJobStarted

public void notifyJobStarted(java.util.Collection<IDriveManagerListener> listeners)

restartScan

public void restartScan(java.io.File drive)

startScanners

public void startScanners()
                   throws JobAlreadyRunningException
Throws:
JobAlreadyRunningException

drivesWereScanned

public boolean drivesWereScanned()

stopScanners

public void stopScanners()

stopDrivePoller

public void stopDrivePoller()

stopFileSynchronizer

public void stopFileSynchronizer()

setDrives

public void setDrives(java.util.Collection<java.io.File> drives)
               throws JobAlreadyRunningException
Throws:
JobAlreadyRunningException

getExcludedDirs

public java.util.Collection<java.lang.String> getExcludedDirs()

getTempFileSuffix

protected java.lang.String getTempFileSuffix()

getTempDir

protected java.lang.String getTempDir()

getPollerListeners

public java.util.Collection<IDriveManagerListener> getPollerListeners()

getScannerListeners

public java.util.Collection<IDriveManagerListener> getScannerListeners()

getSynchronizerListeners

public java.util.Collection<IDriveManagerListener> getSynchronizerListeners()

getDrives

public java.util.Collection<java.io.File> getDrives()

isScanActive

public boolean isScanActive()

notifyScanComplete

protected void notifyScanComplete(DriveScanner scanner)

setExcludedDirectories

public void setExcludedDirectories(java.util.Collection<java.lang.String> directories)
                            throws JobAlreadyRunningException
Throws:
JobAlreadyRunningException

isDirExcluded

protected boolean isDirExcluded(java.io.File directory)

exclude

public void exclude(java.lang.String directory)

addPollerListener

public void addPollerListener(IDriveManagerListener listener)

addScannerListener

public void addScannerListener(IDriveManagerListener listener)

addSynchronizerListener

public void addSynchronizerListener(IDriveManagerListener listener)

find

public FileInfo find(FileInfo fi,
                     int precision)
Retrieves the actual location / file for the given filename. The size and the hash of the original file are used to determine its new location.