Class Purge

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    Update

    public class Purge
    extends org.apache.tools.ant.Task
    An Ant task definition to execute dependency-check during an Ant build.
    Author:
    Jeremy Long
    • Field Summary

      • 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 
      Constructor Description
      Purge()
      Construct a new DependencyCheckTask.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()
      Sets the Thread Context Class Loader to the one for this class, and then calls executeWithContextClassloader().
      protected void executeWithContextClassloader()
      Executes the dependency-check purge to delete the existing local copy of the NVD CVE data.
      java.lang.String getDataDirectory()
      Get the value of dataDirectory.
      java.lang.String getHostedSuppressionsUrl()
      Get the value of hostedSuppressionsUrl.
      Settings getSettings()  
      boolean isFailOnError()
      Get the value of failOnError.
      protected void populateSettings()
      Takes the properties supplied and updates the dependency-check settings.
      void setDataDirectory​(java.lang.String dataDirectory)
      Set the value of dataDirectory.
      void setFailOnError​(boolean failOnError)
      Set the value of failOnError.
      void setHostedSuppressionsUrl​(java.lang.String hostedSuppressionsUrl)
      Set the value of hostedSuppressionsUrl.
      • 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
    • Constructor Detail

      • Purge

        public Purge()
        Construct a new DependencyCheckTask.
    • Method Detail

      • getSettings

        public Settings getSettings()
      • getDataDirectory

        public java.lang.String getDataDirectory()
        Get the value of dataDirectory.
        Returns:
        the value of dataDirectory
      • setDataDirectory

        public void setDataDirectory​(java.lang.String dataDirectory)
        Set the value of dataDirectory.
        Parameters:
        dataDirectory - new value of dataDirectory
      • isFailOnError

        public boolean isFailOnError()
        Get the value of failOnError.
        Returns:
        the value of failOnError
      • setFailOnError

        public void setFailOnError​(boolean failOnError)
        Set the value of failOnError.
        Parameters:
        failOnError - new value of failOnError
      • getHostedSuppressionsUrl

        public java.lang.String getHostedSuppressionsUrl()
        Get the value of hostedSuppressionsUrl.
        Returns:
        the value of hostedSuppressionsUrl
      • setHostedSuppressionsUrl

        public void setHostedSuppressionsUrl​(java.lang.String hostedSuppressionsUrl)
        Set the value of hostedSuppressionsUrl.
        Parameters:
        hostedSuppressionsUrl - new value of hostedSuppressionsUrl
      • execute

        public final void execute()
                           throws org.apache.tools.ant.BuildException
        Sets the Thread Context Class Loader to the one for this class, and then calls executeWithContextClassloader(). This is done because the JCS cache needs to have the Thread Context Class Loader set to something that can resolve it's classes. Other build tools do this by default but Ant does not.
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException - throws if there is a problem. See executeWithContextClassloader() for details
      • executeWithContextClassloader

        protected void executeWithContextClassloader()
                                              throws org.apache.tools.ant.BuildException
        Executes the dependency-check purge to delete the existing local copy of the NVD CVE data.
        Throws:
        org.apache.tools.ant.BuildException - thrown if there is a problem deleting the file(s)
      • populateSettings

        protected void populateSettings()
                                 throws org.apache.tools.ant.BuildException
        Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties required to change the proxy server, port, and connection timeout.
        Throws:
        org.apache.tools.ant.BuildException - thrown if the properties file cannot be read.