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,VersionFilterAnalyzer
@ThreadSafe public abstract class AbstractAnalyzer extends java.lang.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 Summary
Constructors Constructor Description AbstractAnalyzer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidanalyze(Dependency dependency, Engine engine)Analyzes a given dependency.protected abstract voidanalyzeDependency(Dependency dependency, Engine engine)Analyzes a given dependency.voidclose()The close method does nothing for this Analyzer.protected voidcloseAnalyzer()Closes a given Analyzer.protected abstract java.lang.StringgetAnalyzerEnabledSettingKey()Returns the setting key to determine if the analyzer is enabled.protected SettingsgetSettings()Returns the configured settings.voidinitialize(Settings settings)Initializes the analyzer with the configured settings.booleanisEnabled()Get the value of enabled.voidprepare(Engine engine)Initialize the abstract analyzer.protected voidprepareAnalyzer(Engine engine)Prepares a given Analyzer.voidsetEnabled(boolean enabled)Set the value of enabled.booleansupportsParallelProcessing()The default is to support parallel processing.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.owasp.dependencycheck.analyzer.Analyzer
getAnalysisPhase, getName
-
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Get 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:
initializein interfaceAnalyzer- Parameters:
settings- the configured settings to use
-
prepare
public final void prepare(Engine engine) throws InitializationException
Initialize the abstract analyzer.- Specified by:
preparein interfaceAnalyzer- 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:
analyzein interfaceAnalyzer- Parameters:
dependency- the dependency to analyzeengine- 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 analyzeengine- the engine scanning- Throws:
AnalysisException- thrown if there is an analysis exception
-
close
public final void close() throws java.lang.ExceptionThe close method does nothing for this Analyzer.
-
closeAnalyzer
protected void closeAnalyzer() throws java.lang.ExceptionCloses a given Analyzer. This will be skipped if the analyzer is disabled.- Throws:
java.lang.Exception- thrown if there is an exception
-
supportsParallelProcessing
public boolean supportsParallelProcessing()
The default is to support parallel processing.- Specified by:
supportsParallelProcessingin interfaceAnalyzer- Returns:
- true
-
getAnalyzerEnabledSettingKey
protected abstract java.lang.String getAnalyzerEnabledSettingKey()
Returns the setting key to determine if the analyzer is enabled.
- Returns:
- the key for the analyzer's enabled property
-
-