public List<String> getIgnoredFileRegexes() { if (ignoredRegexes == null) { ignoredRegexes = new ArrayList<>(); WindupJavaConfigurationModel cfg = getJavaConfigurationModel(getGraphContext()); for (IgnoredFileRegexModel ignored : cfg.getIgnoredFileRegexes()) { //TODO: Consider having isCompilable() in case there is no message but is not compilable if(ignored.getCompilationError() == null) { ignoredRegexes.add(ignored.getRegex()); } } } return ignoredRegexes; }
WindupJavaConfigurationService javaConfigurationService = new WindupJavaConfigurationService(event.getGraphContext()); WindupJavaConfigurationModel javaConfigurationModel = WindupJavaConfigurationService.getJavaConfigurationModel(event.getGraphContext()); if (customerPackagesSpecified && javaConfigurationService.shouldScanPackage(classname))
/** * Loads the single {@link WindupJavaConfigurationModel} from the graph. */ public static synchronized WindupJavaConfigurationModel getJavaConfigurationModel(GraphContext context) { WindupJavaConfigurationService service = new WindupJavaConfigurationService(context); WindupJavaConfigurationModel config = service.getUnique(); if (config == null) config = service.create(); return config; }
@Override public void perform(GraphRewrite event, EvaluationContext context, FileModel fileModel) { File file = new File(fileModel.getFilePath()); ArchiveModel archiveModel = GraphService.addTypeToModel(event.getGraphContext(), fileModel, ArchiveModel.class); archiveModel.setArchiveName(file.getName()); ApplicationArchiveModel appArchiveModel = GraphService.addTypeToModel(event.getGraphContext(), fileModel, ApplicationArchiveModel.class); // This line will cause the file to be marked if it is to be ignored new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, fileModel); ///appArchiveModel.setApplicationName(file.getName()); // Removed because not used. }
@Override public Boolean compute(Vertex argument) { ArchiveModel archive = event.getGraphContext().getFramed().frame(argument, ArchiveModel.class); WindupJavaConfigurationService windupJavaConfigurationService = new WindupJavaConfigurationService( event.getGraphContext()); for (FileModel fileModel : archive.getContainedFileModels()) { if (fileModel instanceof JavaClassFileModel) { JavaClassFileModel javaClassFileModel = (JavaClassFileModel) fileModel; if (windupJavaConfigurationService.shouldScanPackage(javaClassFileModel.getPackageName())) { return true; } } } return false; } });
@Override public void perform(GraphRewrite event, EvaluationContext context, WindupConfigurationModel payload) WindupJavaConfigurationModel javaCfg = WindupJavaConfigurationService.getJavaConfigurationModel(event .getGraphContext()); final List<Path> filesUrl = new ArrayList<>();
WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); boolean shouldScan; if (fileModel.getPackageName() != null) shouldScan = configurationService.shouldScanPackage(fileModel.getPackageName()); else shouldScan = configurationService.shouldScanFile(fileModel.getFilePath());
WindupJavaConfigurationService windupJavaConfigurationService = new WindupJavaConfigurationService(context); if (fileReference.isDirectory()) if (checkIfIgnored(context, subFileModel, windupJavaConfigurationService.getIgnoredFileRegexes()))
public VariableResolvingASTVisitor(GraphContext context) { this.annotationTypeReferenceService = new GraphService<>(context, JavaAnnotationTypeReferenceModel.class); this.javaClassService = new JavaClassService(context); this.typeRefService = new TypeReferenceService(context); this.windupJavaCfgService = new WindupJavaConfigurationService(context); }
/** * Checks if the {@link FileModel#getFilePath()} + {@link FileModel#getFileName()} is ignored by any of the specified regular expressions. */ public boolean checkIfIgnored(final GraphRewrite event, FileModel file) { List<String> patterns = getIgnoredFileRegexes(); boolean ignored = false; if (patterns != null && !patterns.isEmpty()) { for (String pattern : patterns) { if (file.getFilePath().matches(pattern)) { IgnoredFileModel ignoredFileModel = GraphService.addTypeToModel(event.getGraphContext(), file, IgnoredFileModel.class); ignoredFileModel.setIgnoredRegex(pattern); LOG.info("File/Directory placed in " + file.getFilePath() + " was ignored, because matched [" + pattern + "]."); ignored = true; break; } } } return ignored; }
if (windupJavaCfgService.shouldScanPackage(packageName))
@Override public void perform(final GraphRewrite event, final EvaluationContext context) { ExecutionStatistics.get().begin("ProcyonDecompilationOperation.perform"); int threads = WindupExecutors.getDefaultThreadCount(); LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> allClasses = getFilesToDecompile(event.getGraphContext()); List<ClassDecompileRequest> classesToDecompile = new ArrayList<>(10000); // Just a guess as to the average size for (JavaClassFileModel classFileModel : allClasses) { if (configurationService.shouldScanPackage(classFileModel.getPackageName())) { File outputDir = DecompilerUtil.getOutputDirectoryForClass(event.getGraphContext(), classFileModel); classesToDecompile.add(new ClassDecompileRequest(outputDir.toPath(), classFileModel.asFile().toPath(), outputDir.toPath())); } } Collections.sort(classesToDecompile, (ClassDecompileRequest o1, ClassDecompileRequest o2) -> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(classesToDecompile.size()); AddDecompiledItemsToGraph addDecompiledItemsToGraph = new AddDecompiledItemsToGraph(progressEstimate, event); ProcyonDecompiler decompiler = new ProcyonDecompiler(new ProcyonConfiguration().setIncludeNested(false)); decompiler.setExecutorService(WindupExecutors.newFixedThreadPool(threads), threads); decompiler.decompileClassFiles(classesToDecompile, addDecompiledItemsToGraph); decompiler.close(); ExecutionStatistics.get().end("ProcyonDecompilationOperation.perform"); }
@Override public void perform(GraphRewrite event, EvaluationContext context, WindupConfigurationModel payload) WindupJavaConfigurationModel javaCfg = WindupJavaConfigurationService.getJavaConfigurationModel(event .getGraphContext()); final List<Path> filesUrl = new ArrayList<>();
@Override public void perform(GraphRewrite event, EvaluationContext context, FileModel fileModel) { File file = new File(fileModel.getFilePath()); ArchiveModel archiveModel = GraphService.addTypeToModel(event.getGraphContext(), fileModel, ArchiveModel.class); archiveModel.setArchiveName(file.getName()); ApplicationArchiveModel appArchiveModel = GraphService.addTypeToModel(event.getGraphContext(), fileModel, ApplicationArchiveModel.class); // This line will cause the file to be marked if it is to be ignored new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, fileModel); ///appArchiveModel.setApplicationName(file.getName()); // Removed because not used. }
WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); boolean shouldScan; if (fileModel.getPackageName() != null) shouldScan = configurationService.shouldScanPackage(fileModel.getPackageName()); else shouldScan = configurationService.shouldScanFile(fileModel.getFilePath());
@Override public void perform(GraphRewrite event, EvaluationContext context, FileModel resourceModel) { FileService fileModelService = new FileService(event.getGraphContext()); WindupJavaConfigurationService javaConfigurationService = new WindupJavaConfigurationService(event.getGraphContext()); recurseAndAddFiles(event, fileModelService, javaConfigurationService, resourceModel); }
/** * Checks if the {@link FileModel#getFilePath()} + {@link FileModel#getFileName()} is ignored by any of the specified regular expressions. */ public boolean checkIfIgnored(final GraphRewrite event, FileModel file) { List<String> patterns = getIgnoredFileRegexes(); boolean ignored = false; if (patterns != null && !patterns.isEmpty()) { for (String pattern : patterns) { if (file.getFilePath().matches(pattern)) { IgnoredFileModel ignoredFileModel = GraphService.addTypeToModel(event.getGraphContext(), file, IgnoredFileModel.class); ignoredFileModel.setIgnoredRegex(pattern); LOG.info("File/Directory placed in " + file.getFilePath() + " was ignored, because matched [" + pattern + "]."); ignored = true; break; } } } return ignored; }
public List<String> getIgnoredFileRegexes() { if (ignoredRegexes == null) { ignoredRegexes = new ArrayList<String>(); WindupJavaConfigurationModel cfg = getJavaConfigurationModel(getGraphContext()); for (IgnoredFileRegexModel ignored : cfg.getIgnoredFileRegexes()) { //TODO: Consider having isCompilable() in case there is no message but is not compilable if(ignored.getCompilationError() == null) { ignoredRegexes.add(ignored.getRegex()); } } } return ignoredRegexes; }
WindupJavaConfigurationService javaConfigurationService = new WindupJavaConfigurationService(event.getGraphContext()); WindupJavaConfigurationModel javaConfigurationModel = WindupJavaConfigurationService.getJavaConfigurationModel(event.getGraphContext()); if (customerPackagesSpecified && javaConfigurationService.shouldScanPackage(classname))
LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> filesToDecompile = getFilesToDecompile(event.getGraphContext()); if (configurationService.shouldScanPackage(classFileModel.getPackageName()))