@Override public Map<ConstructId, Construct> getConstructs() throws FileAnalysisException { if(this.constructs==null) { analyzer = PythonFileAnalyzer.createAnalyzer(this.file); analyzer.analyze(this.file); this.constructs = analyzer.getConstructs(); } return analyzer.getConstructs(); }
((DirAnalyzer)fa).setExtensionFilter(_exts); fa.analyze(_file); } catch (FileAnalysisException e) { log.error("Error when creating file analyzer for [" + _file.toString() + "]: " + e.getMessage(), e);
@Override public FileAnalyzer fetch(Artifact _key) throws CacheException { // The artifact whose JAR is to be downloaded _key.setClassifier(null); RepositoryDispatcher r = new RepositoryDispatcher(); Path file = null; try { file = r.downloadArtifact(_key); } catch (IllegalArgumentException ie) { throw new CacheException("Artifact [" + _key + "] not ready for download",ie); } catch (Exception e) { throw new CacheException("Cannot download ["+ _key + "]",e); } FileAnalyzer fa = new JarAnalyzer(); try{ if (fa.canAnalyze(file.toFile())) { fa.analyze(file.toFile()); } else { fa = new PythonArchiveAnalyzer(); fa.analyze(file.toFile()); fa.getConstructs(); } }catch (FileAnalysisException fe){ throw new CacheException("Cannot Analyze file ["+ file.toString() + "]",fe); } return fa; }