public class IterativeTaskFile extends Object
| Constructor and Description |
|---|
IterativeTaskFile(File originalSourceFile,
String targetFileName,
TempDir tempDir)
An instance of this class manages files for encapsulated tasks - passing results of a previous task, as the source
for following task.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dropCurrentTarget()
Invalidates the current temporary target and will preserve the current source file for the next operation.
|
File |
finalizeAndReset(File targetFile,
File targetDirectory)
This shall both reset this instance to it's original state and shall copy the last produced result to either the
given targetFile (using the exact name and path), or to the given targetDirectory (using the initially set targetName).
|
File |
getCurrentSource()
Shall return the file, that is serving as the source file of the currently prepared step.
|
File |
getCurrentTarget()
This shall return the current target file - if the current target file has not yet been initialized, a new
temporary target file shall be prepared by calling this method.
|
void |
prepareNextOperation()
This shall decide whether the current temporary source file shall be deleted or not.
|
void |
preserveCurrentSource()
When called the current temporary source file will not be deleted, when it is replaced by the current target in
next step.
|
void |
reset()
This will drop the current context and will reset this instance to the original source document.
|
void |
setCurrentSource(File currentSource,
boolean preserveSource)
Shall set the file, that is serving as the source file of the currently prepared step.
|
void |
tryPublish(Variable variable)
Attempts to publish the current group result to the Ant context using the given output var name.
|
public IterativeTaskFile(File originalSourceFile, String targetFileName, TempDir tempDir) throws org.apache.tools.ant.BuildException
originalSourceFile - The initial source file, that shall be processed iteratively.targetFileName - The name of the terminal target file.tempDir - The directory temporary files shall be placed in.org.apache.tools.ant.BuildException - Shall be thrown if any of the parameters is invalid (null).public void setCurrentSource(File currentSource, boolean preserveSource)
currentSource - The file, that shall be used as the source of the currently prepared step.preserveSource - When set to true the prepared source file shall not be deleted after the execution.public File getCurrentSource()
public void preserveCurrentSource()
public File getCurrentTarget() throws IOException
IOException - Shall be thrown if a temporary target file could not be created for some reason.public void prepareNextOperation()
public File finalizeAndReset(File targetFile, File targetDirectory) throws IOException
targetFile - The file the final result shall be copied to.targetDirectory - The directory the target file shall be created in.IOException - Shall be thrown if the target file could not be copied/created.public void reset()
public void dropCurrentTarget()
public void tryPublish(Variable variable)
Copyright © 2017–2019 SoftVision Development GmbH, Fulda, Germany. All rights reserved.