@ThreadSafe public class ArchiveAnalyzer extends AbstractFileTypeAnalyzer
An analyzer that extracts files from archives and ensures any supported files contained within the archive are added to the dependency list.
Constructor and Description |
---|
ArchiveAnalyzer()
Make java compiler happy.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File pathname)
Determines if the file can be analyzed by the analyzer.
|
void |
analyzeDependency(Dependency dependency,
Engine engine)
Analyzes a given dependency.
|
void |
closeAnalyzer()
The close method deletes any temporary files and directories created
during analysis.
|
AnalysisPhase |
getAnalysisPhase()
Returns the phase that the analyzer is intended to run in.
|
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
FileFilter used to determine which files are
to be analyzed. |
java.lang.String |
getName()
Returns the name of the analyzer.
|
void |
initialize(Settings settings)
Initializes the analyzer with the configured settings.
|
void |
prepareFileTypeAnalyzer(Engine engine)
The prepare method does nothing for this Analyzer.
|
getFilesMatched, newHashSet, prepareAnalyzer, setFilesMatched
analyze, close, getSettings, isEnabled, prepare, setEnabled, supportsParallelProcessing
public void initialize(Settings settings)
initialize
in interface Analyzer
initialize
in class AbstractAnalyzer
settings
- the configured settings to useprotected java.io.FileFilter getFileFilter()
AbstractFileTypeAnalyzer
Returns the FileFilter
used to determine which files are
to be analyzed. An example would be an analyzer that inspected Java jar
files. Implementors may use
FileFilterBuilder
.
If the analyzer returns null it will not cause additional files to be analyzed, but will be executed against every file loaded.
getFileFilter
in class AbstractFileTypeAnalyzer
public java.lang.String getName()
public AnalysisPhase getAnalysisPhase()
protected java.lang.String getAnalyzerEnabledSettingKey()
getAnalyzerEnabledSettingKey
in class AbstractAnalyzer
public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException
prepareFileTypeAnalyzer
in class AbstractFileTypeAnalyzer
engine
- a reference to the dependency-check engineInitializationException
- is thrown if there is an exception
deleting or creating temporary filespublic void closeAnalyzer() throws java.lang.Exception
closeAnalyzer
in class AbstractAnalyzer
java.lang.Exception
- thrown if there is an exception deleting temporary
filespublic boolean accept(java.io.File pathname)
accept
in interface java.io.FileFilter
accept
in class AbstractFileTypeAnalyzer
pathname
- the path to the filepublic void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException
analyzeDependency
in class AbstractAnalyzer
dependency
- the dependency to analyzeengine
- the engine scanningAnalysisException
- thrown if there is an analysis exceptionCopyright© 2012-21 Jeremy Long. All Rights Reserved.