Class AbstractFileTypeAnalyzer
- java.lang.Object
-
- org.owasp.dependencycheck.analyzer.AbstractAnalyzer
-
- org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer
-
- All Implemented Interfaces:
java.io.FileFilter,Analyzer,FileTypeAnalyzer
- Direct Known Subclasses:
AbstractNpmAnalyzer,ArchiveAnalyzer,ArtifactoryAnalyzer,AssemblyAnalyzer,AutoconfAnalyzer,CarthageAnalyzer,CentralAnalyzer,CMakeAnalyzer,CocoaPodsAnalyzer,ComposerLockAnalyzer,DartAnalyzer,ElixirMixAuditAnalyzer,GolangDepAnalyzer,GolangModAnalyzer,JarAnalyzer,LibmanAnalyzer,MSBuildProjectAnalyzer,NexusAnalyzer,NugetconfAnalyzer,NuspecAnalyzer,OpenSSLAnalyzer,PEAnalyzer,PerlCpanfileAnalyzer,PinnedMavenInstallAnalyzer,PipAnalyzer,PipfileAnalyzer,PipfilelockAnalyzer,PoetryAnalyzer,PythonDistributionAnalyzer,PythonPackageAnalyzer,RetireJsAnalyzer,RubyBundleAuditAnalyzer,RubyGemspecAnalyzer,SwiftPackageManagerAnalyzer,SwiftPackageResolvedAnalyzer
@ThreadSafe public abstract class AbstractFileTypeAnalyzer extends AbstractAnalyzer implements FileTypeAnalyzer
The base FileTypeAnalyzer that all analyzers that have specific file types they analyze should extend.- Author:
- Jeremy Long
-
-
Constructor Summary
Constructors Constructor Description AbstractFileTypeAnalyzer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanaccept(java.io.File pathname)Determines if the file can be analyzed by the analyzer.protected abstract java.io.FileFiltergetFileFilter()Returns theFileFilterused to determine which files are to be analyzed.protected booleangetFilesMatched()Gets the value of filesMatched.protected static java.util.Set<java.lang.String>newHashSet(java.lang.String... strings)Utility method to help in the creation of the extensions set.protected voidprepareAnalyzer(Engine engine)Initializes the analyzer.protected abstract voidprepareFileTypeAnalyzer(Engine engine)Prepares the file type analyzer for dependency analysis.protected voidsetFilesMatched(boolean filesMatched)Set the value of filesMatched.-
Methods inherited from class org.owasp.dependencycheck.analyzer.AbstractAnalyzer
analyze, analyzeDependency, close, closeAnalyzer, getAnalyzerEnabledSettingKey, getSettings, initialize, isEnabled, 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, getAnalysisPhase, getName, initialize, isEnabled, prepare, supportsParallelProcessing
-
-
-
-
Method Detail
-
setFilesMatched
protected void setFilesMatched(boolean filesMatched)
Set the value of filesMatched. A flag indicating whether the scan included any file types this analyzer supports.- Parameters:
filesMatched- new value of filesMatched
-
getFilesMatched
protected boolean getFilesMatched()
Gets the value of filesMatched. A flag indicating whether the scan included any file types this analyzer supports.- Returns:
- the value of filesMatched
-
prepareAnalyzer
protected final void prepareAnalyzer(Engine engine) throws InitializationException
Initializes the analyzer.- Overrides:
prepareAnalyzerin classAbstractAnalyzer- Parameters:
engine- a reference to the dependency-check engine- Throws:
InitializationException- thrown if there is an exception during initialization
-
getFileFilter
protected abstract java.io.FileFilter getFileFilter()
Returns the
FileFilterused to determine which files are to be analyzed. An example would be an analyzer that inspected Java jar files. Implementors may useFileFilterBuilder.If the analyzer returns null it will not cause additional files to be analyzed, but will be executed against every file loaded.
- Returns:
- the file filter used to determine which files are to be analyzed
-
prepareFileTypeAnalyzer
protected abstract void prepareFileTypeAnalyzer(Engine engine) throws InitializationException
Prepares the file type analyzer for dependency analysis.- Parameters:
engine- a reference to the dependency-check engine- Throws:
InitializationException- thrown if there is an exception during initialization
-
accept
public boolean accept(java.io.File pathname)
Determines if the file can be analyzed by the analyzer.- Specified by:
acceptin interfacejava.io.FileFilter- Parameters:
pathname- the path to the file- Returns:
- true if the file can be analyzed by the given analyzer; otherwise false
-
newHashSet
protected static java.util.Set<java.lang.String> newHashSet(java.lang.String... strings)
Utility method to help in the creation of the extensions set. This constructs a new Set that can be used in a final static declaration.
This implementation was copied from http://stackoverflow.com/questions/2041778/prepare-java-hashset-values-by-construction
- Parameters:
strings- a list of strings to add to the set.- Returns:
- a Set of strings.
-
-