/** * 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; }
/** * 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; }
/** * 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; }
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); }
@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); }
@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); }
@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 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. }
LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> filesToDecompile = getFilesToDecompile(event.getGraphContext());
@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(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, ArchiveModel payload) { if (new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, payload)) return; LOG.info("Unzipping archive: " + payload.toPrettyString()); File zipFile = payload.asFile(); if (zipFile == null || !zipFile.isFile()) { throw new WindupException("Input path doesn't point to a file: " + (zipFile == null ? "null" : zipFile.getAbsolutePath())); } final GraphContext graphContext = event.getGraphContext(); checkCancelled(event); // Create a folder for all archive contents. Path unzippedArchiveDir = getArchivesDirLocation(graphContext); ensureDirIsCreated(unzippedArchiveDir); // Collect the malformed archives here. Object badArchives = event.getRewriteContext().get(KEY_BAD_ARCHIVES); if (null == badArchives) event.getRewriteContext().put(KEY_BAD_ARCHIVES, new ArrayList<String>()); unzipToTempDirectory(event, context, unzippedArchiveDir, zipFile, payload, false); }
LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> filesToDecompile = getFilesToDecompile(event.getGraphContext());
@Override public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel payload) { if (new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, payload)) return; LOG.info("Unzipping archive: " + payload.toPrettyString()); File zipFile = payload.asFile(); if (zipFile == null || !zipFile.isFile()) { throw new WindupException("Input path doesn't point to a file: " + (zipFile == null ? "null" : zipFile.getAbsolutePath())); } final GraphContext graphContext = event.getGraphContext(); checkCancelled(event); // Create a folder for all archive contents. Path unzippedArchiveDir = getArchivesDirLocation(graphContext); ensureDirIsCreated(unzippedArchiveDir); // Collect the malformed archives here. Object badArchives = event.getRewriteContext().get(KEY_BAD_ARCHIVES); if (null == badArchives) event.getRewriteContext().put(KEY_BAD_ARCHIVES, new ArrayList<String>()); unzipToTempDirectory(event, context, unzippedArchiveDir, zipFile, payload, false); }
@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; } });
WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); boolean shouldScan; if (fileModel.getPackageName() != null)
WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); boolean shouldScan; if (fileModel.getPackageName() != null)
public void perform(GraphRewrite event, EvaluationContext context, FileModel payload) { if (new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, payload)) return; ExecutionStatistics.get().begin("DiscoverPropertiesFilesRuleProvider.perform"); GraphService<PropertiesModel> service = new GraphService<>(event.getGraphContext(), PropertiesModel.class); TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext()); PropertiesModel properties = service.addTypeToModel(payload); properties.setGenerateSourceReport(true); GraphService.addTypeToModel(event.getGraphContext(), payload, SourceFileModel.class); technologyTagService.addTagToFileModel(payload, TECH_TAG, TECH_TAG_LEVEL); ExecutionStatistics.get().end("DiscoverPropertiesFilesRuleProvider.perform"); } }
public void perform(GraphRewrite event, EvaluationContext context, FileModel payload) { if (new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, payload)) return; ExecutionStatistics.get().begin("DiscoverPropertiesFilesRuleProvider.perform"); GraphService<PropertiesModel> service = new GraphService<>(event.getGraphContext(), PropertiesModel.class); TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext()); PropertiesModel properties = service.addTypeToModel(payload); properties.setGenerateSourceReport(true); GraphService.addTypeToModel(event.getGraphContext(), payload, SourceFileModel.class); technologyTagService.addTagToFileModel(payload, TECH_TAG, TECH_TAG_LEVEL); ExecutionStatistics.get().end("DiscoverPropertiesFilesRuleProvider.perform"); } }
try WindupJavaConfigurationService windupJavaConfigurationService = new WindupJavaConfigurationService( event.getGraphContext()); if (!windupJavaConfigurationService.shouldScanPackage(payload.getPackageName()))