Class NexusAnalyzer
- java.lang.Object
-
- org.owasp.dependencycheck.analyzer.AbstractAnalyzer
-
- org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer
-
- org.owasp.dependencycheck.analyzer.NexusAnalyzer
-
- All Implemented Interfaces:
java.io.FileFilter
,Analyzer
,FileTypeAnalyzer
@ThreadSafe public class NexusAnalyzer extends AbstractFileTypeAnalyzer
Analyzer which will attempt to locate a dependency on a Nexus service by SHA-1 digest of the dependency. There are two settings which govern this behavior:Settings.KEYS.ANALYZER_NEXUS_ENABLED
determines whether this analyzer is even enabled. This can be overridden by setting the system property.Settings.KEYS.ANALYZER_NEXUS_URL
the URL to a Nexus service to search by SHA-1. There is an expected%s
in this where the SHA-1 will get entered.
- Author:
- colezlaw
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_URL
The default URL - this will be used by the CentralAnalyzer to determine whether to enable this.
-
Constructor Summary
Constructors Constructor Description NexusAnalyzer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
analyzeDependency(Dependency dependency, Engine engine)
Performs the analysis.AnalysisPhase
getAnalysisPhase()
Returns the analysis phase under which the analyzer runs.protected java.lang.String
getAnalyzerEnabledSettingKey()
Returns the key used in the properties file to reference the analyzer's enabled property.protected java.io.FileFilter
getFileFilter()
Returns the FileFilterjava.lang.String
getName()
Returns the analyzer's name.void
initialize(Settings settings)
Initializes the analyzer with the configured settings.boolean
isEnabled()
Determine whether to enable this analyzer or not.void
prepareFileTypeAnalyzer(Engine engine)
Initializes the analyzer once before any analysis is performed.boolean
useProxy()
Determine if a proxy should be used for the Nexus Analyzer.-
Methods inherited from class org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer
accept, getFilesMatched, newHashSet, prepareAnalyzer, setFilesMatched
-
Methods inherited from class org.owasp.dependencycheck.analyzer.AbstractAnalyzer
analyze, close, closeAnalyzer, getSettings, prepare, setEnabled, supportsParallelProcessing
-
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
analyze, close, prepare, supportsParallelProcessing
-
-
-
-
Field Detail
-
DEFAULT_URL
public static final java.lang.String DEFAULT_URL
The default URL - this will be used by the CentralAnalyzer to determine whether to enable this.- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(Settings settings)
Initializes the analyzer with the configured settings.- Specified by:
initialize
in interfaceAnalyzer
- Overrides:
initialize
in classAbstractAnalyzer
- Parameters:
settings
- the configured settings to use
-
isEnabled
public boolean isEnabled()
Determine whether to enable this analyzer or not.- Specified by:
isEnabled
in interfaceAnalyzer
- Overrides:
isEnabled
in classAbstractAnalyzer
- Returns:
- whether the analyzer should be enabled
-
prepareFileTypeAnalyzer
public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException
Initializes the analyzer once before any analysis is performed.- Specified by:
prepareFileTypeAnalyzer
in classAbstractFileTypeAnalyzer
- Parameters:
engine
- a reference to the dependency-check engine- Throws:
InitializationException
- if there's an error during initialization
-
getName
public java.lang.String getName()
Returns the analyzer's name.- Returns:
- the name of the analyzer
-
getAnalyzerEnabledSettingKey
protected java.lang.String getAnalyzerEnabledSettingKey()
Returns the key used in the properties file to reference the analyzer's enabled property.- Specified by:
getAnalyzerEnabledSettingKey
in classAbstractAnalyzer
- Returns:
- the analyzer's enabled property setting key
-
getAnalysisPhase
public AnalysisPhase getAnalysisPhase()
Returns the analysis phase under which the analyzer runs.- Returns:
- the phase under which this analyzer runs
-
getFileFilter
protected java.io.FileFilter getFileFilter()
Returns the FileFilter- Specified by:
getFileFilter
in classAbstractFileTypeAnalyzer
- Returns:
- the FileFilter
-
analyzeDependency
public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException
Performs the analysis.- Specified by:
analyzeDependency
in classAbstractAnalyzer
- Parameters:
dependency
- the dependency to analyzeengine
- the engine- Throws:
AnalysisException
- when there's an exception during analysis
-
useProxy
public boolean useProxy()
Determine if a proxy should be used for the Nexus Analyzer.- Returns:
true
if a proxy should be used
-
-