Class ArchiveAnalysisManager


  • public class ArchiveAnalysisManager
    extends Object
    Parallelizes the analysis of Java archives. The number of parallel Threads as well as a timeout is passed as argument to the constructor.
    • Constructor Detail

      • ArchiveAnalysisManager

        public ArchiveAnalysisManager​(int _pool_size,
                                      long _timeout,
                                      boolean _instr,
                                      org.eclipse.steady.shared.json.model.Application _ctx)

        Constructor for ArchiveAnalysisManager.

        Parameters:
        _pool_size - the number of parallel analysis threads
        _timeout - the timeout in milleseconds to wait for the completion of all analysis tasks (-1 means no timeout)
        _instr - whether or not the Java archives shall be instrumented
        _ctx - the application context in which the analysis takes place (if any)
    • Method Detail

      • setInstrument

        public void setInstrument​(boolean _instr)

        Setter for the field instrument.

        Parameters:
        _instr - a boolean.
      • setWorkDir

        public void setWorkDir​(Path _p)

        Setter for the field workDir.

        Parameters:
        _p - a Path object.
      • setWorkDir

        public void setWorkDir​(Path _p,
                               boolean _create)

        Setter for the field workDir.

        Parameters:
        _p - a Path object.
        _create - a boolean.
      • setLibDir

        public void setLibDir​(Path _p)

        Setter for the field libDir.

        Parameters:
        _p - a Path object.
      • setIncludeDir

        public void setIncludeDir​(Path _p)

        setIncludeDir.

        Parameters:
        _p - a Path object.
      • getSupportedFileExtensions

        public static String[] getSupportedFileExtensions()

        getSupportedFileExtensions.

        Returns:
        an array of String objects.
      • canAnalyze

        public static final boolean canAnalyze​(File _file)

        canAnalyze.

        Parameters:
        _file - a File object.
        Returns:
        a boolean.
      • setRename

        public void setRename​(boolean _b)
        Determines whether the instrumented JAR is renamed or not. If yes, the new file name follows the following format: - If app context is provided: [originalJarName]-vulas-[appGroupId]-[appArtifactId]-[appVersion].jar - Otherwise: [originalJarName]-vulas.jar
        Parameters:
        _b - a boolean.
      • setKnownDependencies

        public void setKnownDependencies​(Map<Path,​org.eclipse.steady.shared.json.model.Dependency> _deps)
        Takes a map of file system paths to Dependencys. Entries will be used when instantiating JarAnalyzers in startAnalysis(Set, JarAnalyzer).
        Parameters:
        _deps - a Map object.
      • getKnownDependency

        public org.eclipse.steady.shared.json.model.Dependency getKnownDependency​(Path _p)
        Returns the Dependency for a given archive, or null if no such archive is known. The underlying map is built during the execution of the Maven plugin.
        Parameters:
        _p - a Path object.
        Returns:
        a Dependency object.
      • startAnalysis

        public void startAnalysis​(@NotNull
                                  Map<Path,​JarAnalyzer> _paths,
                                  JarAnalyzer _parent)
        Starts the analysis for all Paths of the given Map that have a null value. As such, it can be used to avoid analyzing archives multiple times.
        Parameters:
        _paths - a Map object.
        _parent - a JarAnalyzer object.
      • startAnalysis

        public void startAnalysis​(@NotNull
                                  Set<Path> _paths,
                                  JarAnalyzer parent)
        Starts the analysis for all the given Paths, which must point to either JAR or WAR archives.
        Parameters:
        _paths - a Set object.
        parent - a JarAnalyzer object.
      • getAnalyzers

        public Set<JarAnalyzer> getAnalyzers()

        Getter for the field analyzers.

        Returns:
        a Set object.
      • getAnalyzerForSubpath

        public JarAnalyzer getAnalyzerForSubpath​(Path _p)
        Returns the analyzer used to analyze a Java archive whose path ends with the given sub-path _p (the first match is taken), null if no such analyzer can be found.
        Parameters:
        _p - a Path object.
        Returns:
        a JarAnalyzer object.