|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.schmant.support.AbstractArgumentChecker org.schmant.task.stub.AbstractTask<T> org.schmant.task.stub.AbstractActionTask<T> org.schmant.task.stub.AbstractProcessTask<T> org.schmant.task.stub.AbstractProcessOneFileTask<T>
public abstract class AbstractProcessOneFileTask<T extends AbstractProcessOneFileTask<T>>
This is an abstract implementation of a task that reads the contents of one file, processes it in some way and then writes it to a target file.
The contents are processed by proxying the output stream used to write to the target file.
This object implements the Producer
interface. The generated object
is the interpreted target object, so its type depends on the type of target
that is used.
Field Summary |
---|
Fields inherited from interface org.schmant.task.confable.OverwriteConfigurable |
---|
DEFAULT_OVERWRITE_STRATEGY |
Constructor Summary | |
---|---|
AbstractProcessOneFileTask()
|
Method Summary | |
---|---|
void |
copyProperties(T spec)
Override the implementation from AbstractTask to copy the
source properties. |
WritableFile |
get()
Returns the produced object, or null if nothing is produced
yet. |
protected abstract String |
getDefaultTargetFileExtension()
Subclasses implement this to return the default file extension for target files (such as ".gz"). |
protected boolean |
isTargetMandatory()
If the target is not set it can be inferred from the source entity. |
protected abstract OutputStream |
proxyOutputStream(OutputStream os)
|
protected void |
runInternal(Report r)
Subclasses implement this. |
void |
setDeleteSourceFile(boolean b)
Set to true to delete the source file after processing it. |
Methods inherited from class org.schmant.task.stub.AbstractProcessTask |
---|
getOverwriteStrategy, getTarget, setOverwrite, setOverwriteStrategy, setTarget, toString, validate |
Methods inherited from class org.schmant.task.stub.AbstractActionTask |
---|
addSource, addSources, clearSources, getRelativeToBase, getSource, getSources, isMoreThanOneSourceAllowed, isSourcesMandatory, setRelativeToBase, setSource, setSources |
Methods inherited from class org.schmant.task.stub.AbstractTask |
---|
cancel, createTask, getDefaultLogFooter, getDefaultLogHeader, getDependencyForTasksScheduledByThisTask, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, setLogFooter, setLogHeader, setReportLevel, setTraceLogging |
Methods inherited from class org.schmant.support.AbstractArgumentChecker |
---|
check, check, check, check |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.schmant.task.confable.SourceConfigurable |
---|
addSource, addSources, clearSources, setRelativeToBase, setSource, setSources |
Methods inherited from interface org.schmant.task.confable.SourceConfigured |
---|
getSource, getSources |
Methods inherited from interface org.schmant.task.TaskSpecification |
---|
createTask |
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable |
---|
setLogFooter, setLogHeader, setReportLevel, setTraceLogging |
Constructor Detail |
---|
public AbstractProcessOneFileTask()
Method Detail |
---|
protected abstract OutputStream proxyOutputStream(OutputStream os) throws IOException
IOException
protected boolean isTargetMandatory()
isTargetMandatory
in class AbstractProcessTask<T extends AbstractProcessOneFileTask<T>>
true
, alwayspublic void setDeleteSourceFile(boolean b)
true
to delete the source file after processing it. This
requires that the source file is a file entity. Otherwise an warning will
be logged.
The default behavior is to not delete the source file.
b
- Should the source file be deleted?public final WritableFile get()
Producer
null
if nothing is produced
yet.
This method should be implemented thread-safe.
get
in interface Producer<WritableFile>
protected abstract String getDefaultTargetFileExtension()
protected final void runInternal(Report r) throws TaskFailedException
AbstractTask
AbstractTask.validate(Report)
:d before
this method is called, see AbstractTask.run()
.
runInternal
in class AbstractTask<T extends AbstractProcessOneFileTask<T>>
r
- The current thread's Report
.
TaskFailedException
public void copyProperties(T spec)
AbstractActionTask
AbstractTask
to copy the
source properties. Subclasses must override this to copy their own
properties.
copyProperties
in interface TaskSpecification<T extends AbstractProcessOneFileTask<T>>
copyProperties
in class AbstractProcessTask<T extends AbstractProcessOneFileTask<T>>
spec
- The specification to copy properties to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |