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 void
analyze(Dependency dependency, Engine engine)
Analyzes a given dependency.protected abstract void
analyzeDependency(Dependency dependency, Engine engine)
Analyzes a given dependency.void
close()
The close method does nothing for this Analyzer.protected void
closeAnalyzer()
Closes a given Analyzer.protected abstract java.lang.String
getAnalyzerEnabledSettingKey()
Returns the setting key to determine if the analyzer is enabled.protected Settings
getSettings()
Returns the configured settings.void
initialize(Settings settings)
Initializes the analyzer with the configured settings.boolean
isEnabled()
Get the value of enabled.void
prepare(Engine engine)
Initialize the abstract analyzer.protected void
prepareAnalyzer(Engine engine)
Prepares a given Analyzer.void
setEnabled(boolean enabled)
Set the value of enabled.boolean
supportsParallelProcessing()
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:
initialize
in interfaceAnalyzer
- Parameters:
settings
- the configured settings to use
-
prepare
public final void prepare(Engine engine) throws InitializationException
Initialize the abstract analyzer.- Specified by:
prepare
in 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:
analyze
in 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.Exception
The close method does nothing for this Analyzer.
-
closeAnalyzer
protected void closeAnalyzer() throws java.lang.Exception
Closes 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:
supportsParallelProcessing
in 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
-
-