public abstract class AbstractArchiver<C extends ApplicationContext> extends AbstractAsyncExecutable<C>
Modifier and Type | Field and Description |
---|---|
protected AccumulatingProgressInputStream |
measureStream |
childTaskRef, isTestMode, monitorController, resultRef, stateFlag
Constructor and Description |
---|
AbstractArchiver(C ctx) |
AbstractArchiver(C ctx,
ArchiveInputList inputList) |
AbstractArchiver(C ctx,
java.io.File archiveFile) |
AbstractArchiver(C ctx,
java.io.File zipOutFile,
ArchiveInputList inputList) |
AbstractArchiver(C ctx,
LogChannel logCh,
java.io.File archiveFile,
ArchiveInputList inputList) |
Modifier and Type | Method and Description |
---|---|
void |
addDirectory(java.io.File dir,
boolean isRecursive)
Adds the content of the given directory to the archive input list.
|
void |
addDirectory(java.io.File dir,
java.io.FileFilter filter)
Adds all files contained in the given directory to the input. if All files If the filter is
not null, all files must match the given filter, otherwise all files are added.
|
void |
addFile(java.io.File file)
Adds the given File to the archive input list.
|
void |
addFiles(java.io.File... files)
Adds the given File(s) to the archive input list.
|
protected void |
checkDirectoryExists(java.io.File file) |
protected void |
checkFileExists(java.io.File file) |
protected void |
checkHasArchivedFiles() |
protected CleanupFileOutputStream |
createCleanupFileOutputStream(java.io.File archiveFile) |
protected void |
doOnAddingArchiveEntry(java.lang.String entryName) |
void |
executeAsync()
Contains the code to be executed asynchronously.
|
abstract FileType |
getArchiveType() |
java.io.File |
getSourceRootDir() |
protected void |
incrementArchivedFileCount() |
protected abstract void |
processArchiving(java.io.File archiveFile,
ArchiveInputList inputList) |
void |
setArchiveFile(java.io.File archiveFile)
Sets the target output file where the archive is written to.
|
void |
setRemoveSourceFiles(boolean isRemove)
Tells whether the source files should be removed after archiving.
|
void |
setRootDirectory(java.io.File rootDir) |
void |
setSourceRootDir(java.io.File rootDir)
Sets the base dir for locating files to be archived.
|
addMonitor, checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, handleFinish, handleStart, handleSuccess, hasError, hasMonitor, isCancellable, notifyProceeded, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelled
getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getApplicationContext
getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
protected final AccumulatingProgressInputStream measureStream
public AbstractArchiver(C ctx)
public AbstractArchiver(C ctx, java.io.File archiveFile)
public AbstractArchiver(C ctx, ArchiveInputList inputList)
public AbstractArchiver(C ctx, java.io.File zipOutFile, ArchiveInputList inputList)
public AbstractArchiver(C ctx, LogChannel logCh, java.io.File archiveFile, ArchiveInputList inputList)
public abstract FileType getArchiveType()
protected void checkHasArchivedFiles() throws java.lang.Exception
java.lang.Exception
public void setSourceRootDir(java.io.File rootDir)
public java.io.File getSourceRootDir()
setSourceRootDir(File).
public void setArchiveFile(java.io.File archiveFile)
public void setRemoveSourceFiles(boolean isRemove)
public void addFile(java.io.File file)
public void addFiles(java.io.File... files)
public void addDirectory(java.io.File dir, java.io.FileFilter filter)
filter
- all files must match the filter if not nulladdDirectory(File, boolean)
public void setRootDirectory(java.io.File rootDir)
public void addDirectory(java.io.File dir, boolean isRecursive)
isRecursive
- adds the content of all sub-directories as well.addDirectory(File, FileFilter)
protected void incrementArchivedFileCount()
protected void checkDirectoryExists(java.io.File file)
protected void checkFileExists(java.io.File file)
protected void doOnAddingArchiveEntry(java.lang.String entryName)
protected CleanupFileOutputStream createCleanupFileOutputStream(java.io.File archiveFile) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public final void executeAsync() throws java.lang.Exception
AsyncExecutable
Runnable.run()
for async execution.executeAsync
in interface AsyncExecutable<C extends ApplicationContext>
executeAsync
in class AbstractAsyncExecutable<C extends ApplicationContext>
java.lang.Exception
for synchronous execution
protected abstract void processArchiving(java.io.File archiveFile, ArchiveInputList inputList) throws java.lang.Exception
java.lang.Exception
Copyright © 2014 EsprIT-Systems. All Rights Reserved.