private void extractAndAnalyze(Dependency dependency, Engine engine, int scanDepth) throws AnalysisException {
        final File f = new File(dependency.getActualFilePath());
        final File tmpDir = getNextTempDirectory();
        extractFiles(f, tmpDir, engine);

        //make a copy
        final List<Dependency> dependencySet = findMoreDependencies(engine, tmpDir);

        if (dependencySet != null && !dependencySet.isEmpty()) {
            for (Dependency d : dependencySet) {
                if (d.getFilePath().startsWith(tmpDir.getAbsolutePath())) {
                    //fix the dependency's display name and path
                    final String displayPath = String.format("%s%s",
                            dependency.getFilePath(),
                            d.getActualFilePath().substring(tmpDir.getAbsolutePath().length()));
                    final String displayName = String.format("%s: %s",
                            dependency.getFileName(),
                            d.getFileName());
                    d.setFilePath(displayPath);
                    d.setFileName(displayName);
                    d.addAllProjectReferences(dependency.getProjectReferences());

                    //TODO - can we get more evidence from the parent? EAR contains module name, etc.
                    //analyze the dependency (i.e. extract files) if it is a supported type.
                    if (this.accept(d.getActualFile()) && scanDepth < maxScanDepth) {
                        extractAndAnalyze(d, engine, scanDepth + 1);
                    }
                } else {
                    dependencySet.stream().filter((sub) -> sub.getFilePath().startsWith(tmpDir.getAbsolutePath())).forEach((sub) -> {
                        final String displayPath = String.format("%s%s",
                                dependency.getFilePath(),
                                sub.getActualFilePath().substring(tmpDir.getAbsolutePath().length()));
                        final String displayName = String.format("%s: %s",
                                dependency.getFileName(),
                                sub.getFileName());
                        sub.setFilePath(displayPath);
                        sub.setFileName(displayName);
                    });
                }
            }
        }
private void extractAndAnalyze ( Dependency dependency , Engine engine , int scanDepth ) throws AnalysisException { final File f = new File ( dependency . getActualFilePath ( ) ) ; final File tmpDir = getNextTempDirectory ( ) ; extractFiles ( f , tmpDir , engine ) ; final List < Dependency > dependencySet = findMoreDependencies ( engine , tmpDir ) ; if ( dependencySet != null && ! dependencySet . isEmpty ( ) ) { for ( Dependency d : dependencySet ) { if ( d . getFilePath ( ) . startsWith ( tmpDir . getAbsolutePath ( ) ) ) { final String displayPath = String . format ( "%s%s" , dependency . getFilePath ( ) , d . getActualFilePath ( ) . substring ( tmpDir . getAbsolutePath ( ) . length ( ) ) ) ; final String displayName = String . format ( "%s: %s" , dependency . getFileName ( ) , d . getFileName ( ) ) ; d . setFilePath ( displayPath ) ; d . setFileName ( displayName ) ; d . addAllProjectReferences ( dependency . getProjectReferences ( ) ) ; if ( this . accept ( d . getActualFile ( ) ) && scanDepth < maxScanDepth ) { extractAndAnalyze ( d , engine , scanDepth + 1 ) ; } } else { dependencySet . stream ( ) . filter ( ( sub ) -> sub . getFilePath ( ) . startsWith ( tmpDir . getAbsolutePath ( ) ) ) . forEach ( ( sub ) -> { final String displayPath = String . format ( "%s%s" , dependency . getFilePath ( ) , sub . getActualFilePath ( ) . substring ( tmpDir . getAbsolutePath ( ) . length ( ) ) ) ; final String displayName = String . format ( "%s: %s" , dependency . getFileName ( ) , sub . getFileName ( ) ) ; sub . setFilePath ( displayPath ) ; sub . setFileName ( displayName ) ; } ) ; } } }
Extracts the contents of the archive dependency and scans for additional
dependencies.

@param dependency the dependency being analyzed
@param engine the engine doing the analysis
@param scanDepth the current scan depth; extracctAndAnalyze is recursive
and will, be default, only go 3 levels deep
@throws AnalysisException thrown if there is a problem analyzing the
dependencies