Package de.uni_hildesheim.sse.easy.ant
Class AbstractModelTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
de.uni_hildesheim.sse.easy.ant.AbstractModelTask
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AdaptationPruning,ModelCopy
public abstract class AbstractModelTask
extends org.apache.tools.ant.Task
Common functionality for tasks manipulating the QM model.
- Author:
- El-Sharkawy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate Fileprivate Stringprivate Fileprivate booleanprivate booleanFields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddOrRemoveLocation(net.ssehub.easy.basics.modelManagement.ModelManagement<? extends net.ssehub.easy.basics.modelManagement.IModel> modelManagement, File folder, boolean add) Removed or adds a (temporary) folder for loading models from this locations.protected voiddebugMessage(String msg) Prints a debug message if verbosity was enabled.protected abstract voidvoidexecute()protected final booleanSpecifies if the destination maybe cleaned up during running the task (default isfalse).protected final FileReturns the target folder where the copied models shall be stored.protected final StringReturns the the starting point of the model.protected final FileReturns the folder containing the source artifacts.protected final booleanReturns whether validation of the result should stop the build or only output an error.protected final booleanReturns whether additional debugging output is desired.protected net.ssehub.easy.varModel.model.ProjectloadProject(File folder, String mainProjectName) Loads the specified project from the location.voidsetAllowDestDeletion(boolean allowDestDeletion) Specifies if the destination maybe cleaned up during running the task (default isfalse).voidsetDestinationFolder(String destinationFolder) The target folder where the copied models shall be stored.voidsetMainProject(String mainProject) Main Project, is needed for loading the projects in a correct order.voidsetSourceFolder(String sourceFolder) A folder containing artifacts to copy.voidsetValidate(boolean valitate) Specifies if the result shall be validatedvoidsetVebose(boolean verbose) Enables/disables additional logging.Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Field Details
-
sourceFolder
-
destinationFolder
-
mainProject
-
validate
private boolean validate -
verbose
private boolean verbose -
allowDestDeletion
private boolean allowDestDeletion
-
-
Constructor Details
-
AbstractModelTask
protected AbstractModelTask()
-
-
Method Details
-
setSourceFolder
A folder containing artifacts to copy. Will consider sub folders.- Parameters:
sourceFolder- A folder containing the source artifacts for copying.
-
setDestinationFolder
The target folder where the copied models shall be stored.- Parameters:
destinationFolder- The folder must exist and empty or not exist (must not benull).
-
setMainProject
Main Project, is needed for loading the projects in a correct order.- Parameters:
mainProject- The starting point of the model to be copied, only its name.
-
setVebose
public void setVebose(boolean verbose) Enables/disables additional logging.- Parameters:
verbose-trueenables some debugging output (enabled by default),falsedisables it.
-
setAllowDestDeletion
public void setAllowDestDeletion(boolean allowDestDeletion) Specifies if the destination maybe cleaned up during running the task (default isfalse).- Parameters:
allowDestDeletion-truedeletes the destination if it exists,falsethrows an error if the destination exists.
-
setValidate
public void setValidate(boolean valitate) Specifies if the result shall be validated- Parameters:
valitate-truean inconsistent result will lead in an crash (default),falseprints errors but will not lead to a buid stop.
-
getSourceFolder
Returns the folder containing the source artifacts.- Returns:
- The source folder.
-
getDestinationFolder
Returns the target folder where the copied models shall be stored.- Returns:
- The destination folder.
-
getMainProject
Returns the the starting point of the model.- Returns:
- The main project.
-
getVebose
protected final boolean getVebose()Returns whether additional debugging output is desired.- Returns:
trueoutput is desired.
-
getAllowDestDeletion
protected final boolean getAllowDestDeletion()Specifies if the destination maybe cleaned up during running the task (default isfalse).- Returns:
truefolder may be deleted,falsethrow an error if destination exists.
-
getValidate
protected final boolean getValidate()Returns whether validation of the result should stop the build or only output an error.- Returns:
trueAn flawed result will stop the whole built.
-
debugMessage
Prints a debug message if verbosity was enabled.- Parameters:
msg- The message to print.
-
addOrRemoveLocation
protected void addOrRemoveLocation(net.ssehub.easy.basics.modelManagement.ModelManagement<? extends net.ssehub.easy.basics.modelManagement.IModel> modelManagement, File folder, boolean add) throws net.ssehub.easy.basics.modelManagement.ModelManagementException Removed or adds a (temporary) folder for loading models from this locations.- Parameters:
modelManagement-VarModel.INSTANCE,BuildModel.INSTANCE, orTemplateModel.INSTANCEfolder- The folder to (un-)registeradd-truethe folder will be added as possible location for models,falsethe folder will be removed.- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- If model files could not be parsed
-
loadProject
protected net.ssehub.easy.varModel.model.Project loadProject(File folder, String mainProjectName) throws net.ssehub.easy.basics.modelManagement.ModelManagementException, IOException Loads the specified project from the location.
This adds thegetSourceFolder()to theVarModel. This should be undone at a later point.- Parameters:
folder- The folder from where to load the project.mainProjectName- The starting point of the project.- Returns:
- The loaded project.
- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- If IVML files could not be parsedIOException- If files could not be copied.
-
execute
public void execute() throws org.apache.tools.ant.BuildException- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException
-
doModelOperation
protected abstract void doModelOperation()
-