Class AbstractAnalyzer

java.lang.Object
org.owasp.dependencycheck.analyzer.AbstractAnalyzer
All Implemented Interfaces:
Analyzer
Direct Known Subclasses:
AbstractDependencyComparingAnalyzer, AbstractFileTypeAnalyzer, AbstractSuppressionAnalyzer, CPEAnalyzer, FalsePositiveAnalyzer, FileNameAnalyzer, HintAnalyzer, KnownExploitedVulnerabilityAnalyzer, NvdCveAnalyzer, OssIndexAnalyzer, UnusedSuppressionRuleAnalyzer

@ThreadSafe public abstract class AbstractAnalyzer extends Object implements Analyzer
Base class for analyzers to avoid code duplication of prepare and close as most analyzers do not need these methods.
Author:
Jeremy Long
  • Constructor Details

    • AbstractAnalyzer

      public AbstractAnalyzer()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Get the value of enabled.
      Specified by:
      isEnabled in interface Analyzer
      Returns:
      the value of enabled
    • setEnabled

      public void setEnabled(boolean enabled)
      Set the value of enabled.
      Parameters:
      enabled - new value of enabled
    • getSettings

      protected Settings getSettings()
      Returns the configured settings.
      Returns:
      the configured settings
    • initialize

      public void initialize(Settings settings)
      Initializes the analyzer with the configured settings.
      Specified by:
      initialize in interface Analyzer
      Parameters:
      settings - the configured settings to use
    • prepare

      public final void prepare(Engine engine) throws InitializationException
      Initialize the abstract analyzer.
      Specified by:
      prepare in interface Analyzer
      Parameters:
      engine - a reference to the dependency-check engine
      Throws:
      InitializationException - thrown if there is an exception
    • prepareAnalyzer

      protected void prepareAnalyzer(Engine engine) throws InitializationException
      Prepares a given Analyzer. This will be skipped if the analyzer is disabled.
      Parameters:
      engine - a reference to the dependency-check engine
      Throws:
      InitializationException - thrown if there is an exception
    • analyze

      public final void analyze(Dependency dependency, Engine engine) throws AnalysisException
      Analyzes a given dependency. If the dependency is an archive, such as a WAR or EAR, the contents are extracted, scanned, and added to the list of dependencies within the engine.
      Specified by:
      analyze in interface Analyzer
      Parameters:
      dependency - the dependency to analyze
      engine - the engine scanning
      Throws:
      AnalysisException - thrown if there is an analysis exception
    • analyzeDependency

      protected abstract void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException
      Analyzes a given dependency. If the dependency is an archive, such as a WAR or EAR, the contents are extracted, scanned, and added to the list of dependencies within the engine.
      Parameters:
      dependency - the dependency to analyze
      engine - the engine scanning
      Throws:
      AnalysisException - thrown if there is an analysis exception
    • close

      public final void close() throws Exception
      The close method does nothing for this Analyzer.
      Specified by:
      close in interface Analyzer
      Throws:
      Exception - thrown if there is an exception
    • closeAnalyzer

      protected void closeAnalyzer() throws Exception
      Closes a given Analyzer. This will be skipped if the analyzer is disabled.
      Throws:
      Exception - thrown if there is an exception
    • supportsParallelProcessing

      public boolean supportsParallelProcessing()
      The default is to support parallel processing.
      Specified by:
      supportsParallelProcessing in interface Analyzer
      Returns:
      true
    • getAnalyzerEnabledSettingKey

      protected abstract String getAnalyzerEnabledSettingKey()

      Returns the setting key to determine if the analyzer is enabled.

      Returns:
      the key for the analyzer's enabled property