com.mucommander.job
Class AbstractCopyJob

java.lang.Object
  extended by com.mucommander.job.FileJob
      extended by com.mucommander.job.TransferFileJob
          extended by com.mucommander.job.AbstractCopyJob
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
CopyJob, MoveJob

public abstract class AbstractCopyJob
extends TransferFileJob

This class is the parent class of CopyJob and MoveJob and allows them to share methods and fields.

Author:
Maxence Bernard, Mariusz Jakubowski
See Also:
CopyJob, MoveJob

Field Summary
protected  boolean append
           
protected  AbstractRWArchiveFile archiveToOptimize
          The archive that contains the destination files (may be null)
protected  AbstractFile baseDestFolder
          Base destination folder
protected  int defaultFileExistsAction
          Default choice when encountering an existing file
protected  java.lang.String errorDialogTitle
          Title used for error dialogs
protected  boolean isOptimizingArchive
          True when an archive is being optimized
protected  java.lang.String newName
          New filename in destination
 
Fields inherited from class com.mucommander.job.FileJob
APPEND_ACTION, APPEND_TEXT, baseSourceFolder, CANCEL_ACTION, CANCEL_TEXT, currentFile, currentFileIndex, currentFilename, files, FINISHED, INTERRUPTED, mainFrame, nbFiles, NOT_STARTED, PAUSED, progressDialog, RETRY_ACTION, RETRY_TEXT, RUNNING, SKIP_ACTION, SKIP_TEXT
 
Constructor Summary
AbstractCopyJob(ProgressDialog progressDialog, MainFrame mainFrame, FileSet files, AbstractFile destFolder, java.lang.String newName, int fileExistsAction)
          Creates a new AbstractCopyJob.
 
Method Summary
protected  AbstractFile checkForCollision(AbstractFile file, AbstractFile destFolder, AbstractFile destFile, boolean allowCaseVariation)
          Checks if there is a file collision (file exists in the destination).
protected  AbstractFile createDestinationFile(AbstractFile destFolder, java.lang.String destFileName)
          Creates a destination file given a destination folder and a new file name.
protected  void optimizeArchive(AbstractRWArchiveFile rwArchiveFile)
          Optimizes the given writable archive file and notifies the user in case of an error.
 
Methods inherited from class com.mucommander.job.TransferFileJob
closeCurrentInputStream, copyFile, getCurrentFileByteCounter, getCurrentFileSize, getCurrentFileSkippedByteCounter, getFilePercentDone, getStatusString, getThroughputLimit, getTotalByteCounter, getTotalPercentDone, getTotalSkippedByteCounter, isCheckingIntegrity, isIntegrityCheckEnabled, jobPaused, jobResumed, jobStopped, nextFile, setCurrentInputStream, setIntegrityCheckEnabled, setThroughputLimit, skipCurrentFile, tryCopyFile, wasCurrentFileSkipped
 
Methods inherited from class com.mucommander.job.FileJob
addFileJobListener, getCurrentFileIndex, getCurrentFilename, getEffectiveJobTime, getEndDate, getNbFiles, getPausedTime, getPauseStartDate, getStartDate, getState, hasFolderChanged, interrupt, jobCompleted, jobStarted, processFile, refreshTables, removeFileJobListener, run, selectFileWhenFinished, setAutoUnmark, setPaused, setState, showErrorDialog, showErrorDialog, start, waitForUserResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseDestFolder

protected AbstractFile baseDestFolder
Base destination folder


newName

protected java.lang.String newName
New filename in destination


defaultFileExistsAction

protected int defaultFileExistsAction
Default choice when encountering an existing file


errorDialogTitle

protected java.lang.String errorDialogTitle
Title used for error dialogs


append

protected boolean append

archiveToOptimize

protected AbstractRWArchiveFile archiveToOptimize
The archive that contains the destination files (may be null)


isOptimizingArchive

protected boolean isOptimizingArchive
True when an archive is being optimized

Constructor Detail

AbstractCopyJob

public AbstractCopyJob(ProgressDialog progressDialog,
                       MainFrame mainFrame,
                       FileSet files,
                       AbstractFile destFolder,
                       java.lang.String newName,
                       int fileExistsAction)
Creates a new AbstractCopyJob.

Parameters:
progressDialog - dialog which shows this job's progress
mainFrame - mainFrame this job has been triggered by
files - files which are going to be copied
destFolder - destination folder where the files will be copied
newName - the new filename in the destination folder, can be null in which case the original filename will be used.
fileExistsAction - default action to be performed when a file already exists in the destination, see FileCollisionDialog for allowed values
Method Detail

createDestinationFile

protected AbstractFile createDestinationFile(AbstractFile destFolder,
                                             java.lang.String destFileName)
Creates a destination file given a destination folder and a new file name.

Parameters:
destFolder - a destination folder
destFileName - a destination file name
Returns:
the destination file or null if it cannot be created

checkForCollision

protected AbstractFile checkForCollision(AbstractFile file,
                                         AbstractFile destFolder,
                                         AbstractFile destFile,
                                         boolean allowCaseVariation)
Checks if there is a file collision (file exists in the destination). If there is no collision this method returns destFile. If there is a collision this method returns:

Parameters:
file - a source file
destFolder - a destination folder
destFile - a destination file
allowCaseVariation - if true,
Returns:
destFile the new destination file

optimizeArchive

protected void optimizeArchive(AbstractRWArchiveFile rwArchiveFile)
Optimizes the given writable archive file and notifies the user in case of an error.

Parameters:
rwArchiveFile - the writable archive file to optimize


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard