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

    Fields
    Modifier and Type
    Field
    Description
    private boolean
     
    private File
     
    private String
     
    private File
     
    private boolean
     
    private boolean
     

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addOrRemoveLocation(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 void
    Prints a debug message if verbosity was enabled.
    protected abstract void
     
    void
     
    protected final boolean
    Specifies if the destination maybe cleaned up during running the task (default is false).
    protected final File
    Returns the target folder where the copied models shall be stored.
    protected final String
    Returns the the starting point of the model.
    protected final File
    Returns the folder containing the source artifacts.
    protected final boolean
    Returns whether validation of the result should stop the build or only output an error.
    protected final boolean
    Returns whether additional debugging output is desired.
    protected net.ssehub.easy.varModel.model.Project
    loadProject(File folder, String mainProjectName)
    Loads the specified project from the location.
    void
    setAllowDestDeletion(boolean allowDestDeletion)
    Specifies if the destination maybe cleaned up during running the task (default is false).
    void
    setDestinationFolder(String destinationFolder)
    The target folder where the copied models shall be stored.
    void
    setMainProject(String mainProject)
    Main Project, is needed for loading the projects in a correct order.
    void
    setSourceFolder(String sourceFolder)
    A folder containing artifacts to copy.
    void
    setValidate(boolean valitate)
    Specifies if the result shall be validated
    void
    setVebose(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, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • sourceFolder

      private File sourceFolder
    • destinationFolder

      private File destinationFolder
    • mainProject

      private String mainProject
    • validate

      private boolean validate
    • verbose

      private boolean verbose
    • allowDestDeletion

      private boolean allowDestDeletion
  • Constructor Details

    • AbstractModelTask

      protected AbstractModelTask()
  • Method Details

    • setSourceFolder

      public void setSourceFolder(String sourceFolder)
      A folder containing artifacts to copy. Will consider sub folders.
      Parameters:
      sourceFolder - A folder containing the source artifacts for copying.
    • setDestinationFolder

      public void setDestinationFolder(String destinationFolder)
      The target folder where the copied models shall be stored.
      Parameters:
      destinationFolder - The folder must exist and empty or not exist (must not be null).
    • setMainProject

      public void setMainProject(String mainProject)
      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 - true enables some debugging output (enabled by default), false disables it.
    • setAllowDestDeletion

      public void setAllowDestDeletion(boolean allowDestDeletion)
      Specifies if the destination maybe cleaned up during running the task (default is false).
      Parameters:
      allowDestDeletion - true deletes the destination if it exists, false throws an error if the destination exists.
    • setValidate

      public void setValidate(boolean valitate)
      Specifies if the result shall be validated
      Parameters:
      valitate - true an inconsistent result will lead in an crash (default), false prints errors but will not lead to a buid stop.
    • getSourceFolder

      protected final File getSourceFolder()
      Returns the folder containing the source artifacts.
      Returns:
      The source folder.
    • getDestinationFolder

      protected final File getDestinationFolder()
      Returns the target folder where the copied models shall be stored.
      Returns:
      The destination folder.
    • getMainProject

      protected final String 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:
      true output is desired.
    • getAllowDestDeletion

      protected final boolean getAllowDestDeletion()
      Specifies if the destination maybe cleaned up during running the task (default is false).
      Returns:
      true folder may be deleted, false throw 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:
      true An flawed result will stop the whole built.
    • debugMessage

      protected void debugMessage(String msg)
      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, or TemplateModel.INSTANCE
      folder - The folder to (un-)register
      add - true the folder will be added as possible location for models, false the 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 the getSourceFolder() to the VarModel. 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 parsed
      IOException - If files could not be copied.
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException
    • doModelOperation

      protected abstract void doModelOperation()