@Override public String toString() { return addon.getId().toCoordinates(); }
@Override public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) { Set<String> items = new TreeSet<String>(); Set<Addon> addons = furnace.getAddonRegistry().getAddons(); for (Addon addon : addons) { if (addon.getId().toCoordinates().startsWith(value)) items.add(addon.getId().getName()); } return items; } });
/** * Loads the tag definitions from the files with a ".tags.xml" suffix from the addons. */ @PostConstruct public void loadTagDefinitions() { Map<Addon, List<URL>> addonToResourcesMap = scanner.scanForAddonMap(new FileExtensionFilter("tags.xml")); for (Map.Entry<Addon, List<URL>> entry : addonToResourcesMap.entrySet()) { for (URL resource : entry.getValue()) { log.info("Reading tags definitions from: " + resource.toString() + " from addon " + entry.getKey().getId()); try(InputStream is = resource.openStream()) { tagService.readTags(is); } catch( Exception ex ) { throw new WindupException("Failed reading tags definition: " + resource.toString() + " from addon " + entry.getKey().getId() + ":\n" + ex.getMessage(), ex); } } } }
/** * Loads the tag definitions from the files with a ".tags.xml" suffix from the addons. */ @PostConstruct public void loadTagDefinitions() { Map<Addon, List<URL>> addonToResourcesMap = scanner.scanForAddonMap(new FileExtensionFilter("tags.xml")); for (Map.Entry<Addon, List<URL>> entry : addonToResourcesMap.entrySet()) { for (URL resource : entry.getValue()) { log.info("Reading tags definitions from: " + resource.toString() + " from addon " + entry.getKey().getId()); try(InputStream is = resource.openStream()) { tagService.readTags(is); } catch( Exception ex ) { throw new WindupException("Failed reading tags definition: " + resource.toString() + " from addon " + entry.getKey().getId() + ":\n" + ex.getMessage(), ex); } } } }
private Addon getAddon() { Set<Addon> addons = SimpleContainer.getFurnace(RexsterInitializer.class.getClassLoader()).getAddonRegistry().getAddons(); for (Addon addon : addons) { boolean isRexster = addon.getId().getName().contains("rexster"); if (isRexster) { return addon; } } return null; }
@Override public boolean accept(Addon addon) { Set<AddonDependency> dependencies = addon.getDependencies(); for (AddonDependency dependency : dependencies) { // TODO this should only accept addons that depend on windup-config-groovy or whatever we call that if (dependency.getDependency().getId().getName().contains("groovy")) { return true; } } return false; } };
@Override public boolean accept(Addon addon) { Set<AddonDependency> dependencies = addon.getDependencies(); for (AddonDependency dependency : dependencies) { // TODO this should only accept addons that depend on windup-config-groovy or whatever we call that if (dependency.getDependency().getId().getName().contains("groovy")) { return true; } } return false; } };
/** * Returns a list of files in given addon passing given filter. */ public List<String> filterAddonResources(Addon addon, Predicate<String> filter) { List<String> discoveredFileNames = new ArrayList<>(); List<File> addonResources = addon.getRepository().getAddonResources(addon.getId()); for (File addonFile : addonResources) { if (addonFile.isDirectory()) handleDirectory(filter, addonFile, discoveredFileNames); else handleArchiveByFile(filter, addonFile, discoveredFileNames); } return discoveredFileNames; }
/** * Returns a list of files in given addon passing given filter. */ public List<String> filterAddonResources(Addon addon, Predicate<String> filter) { List<String> discoveredFileNames = new ArrayList<>(); List<File> addonResources = addon.getRepository().getAddonResources(addon.getId()); for (File addonFile : addonResources) { if (addonFile.isDirectory()) handleDirectory(filter, addonFile, discoveredFileNames); else handleArchiveByFile(filter, addonFile, discoveredFileNames); } return discoveredFileNames; }
/** * Returns a list of files in given addon passing given filter. */ public List<String> filterAddonResources(Addon addon, Predicate<String> filter) { List<String> discoveredFileNames = new ArrayList<>(); List<File> addonResources = addon.getRepository().getAddonResources(addon.getId()); for (File addonFile : addonResources) { if (addonFile.isDirectory()) handleDirectory(filter, addonFile, discoveredFileNames); else handleArchiveByFile(filter, addonFile, discoveredFileNames); } return discoveredFileNames; }
List<File> addonResources = addon.getRepository().getAddonResources(addonToScan.getId()); for (File addonResource : addonResources)
@Override public void afterGraphStarted(Map<String, Object> configuration, GraphContext graphContext) { this.configuration = configuration; rexsterExtractDirectory = getAddon().getRepository().getAddonDescriptor(getAddon().getId()).getParent() + "/rexster-extract"; start(graphContext.getFramed()); }
System.err.println("WARN: " + addon.getId() + " status: " + addon.getStatus());
System.err.println("WARN: " + addon.getId() + " status: " + addon.getStatus());
@Override @SuppressWarnings("unchecked") public void start() { getAddonRegistry() .getAddons(addon -> Versions.isSnapshot(addon.getId().getVersion()) && addon.getRepository() instanceof MutableAddonRepository) .stream() .map(Addon::getId) .forEach(addonId -> { // Find local repository path for each addon File installationPath = getInstallationPathFor(addonId); FileResource<?> resource = getResourceFactory().create(FileResource.class, installationPath); ResourceMonitor monitor = resource.monitor(); monitor.addResourceListener(e -> { // Run addonManager.remove and addonManager.install getAddonManager().remove(addonId).perform(); getAddonManager().install(addonId).perform(); }); monitors.put(addonId, monitor); }); }
@Override public void validate(UIValidationContext context) { String coordinate = (String) context.getCurrentInputComponent().getValue(); try { Set<Addon> addons = furnace.getAddonRegistry().getAddons(); boolean match = false; for (Addon addon : addons) { if (addon.getId().getName().equals(coordinate)) { match = true; break; } } if (!match) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" does not refer to any installed Addon coordinate."); } } catch (IllegalArgumentException e) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" is not a valid Addon coordinate"); } } });
private ApplicationReportModel createAboutWindup(GraphContext context, ProjectModel projectModel) { ApplicationReportService applicationReportService = new ApplicationReportService(context); ApplicationReportModel applicationReportModel = applicationReportService.create(); applicationReportModel.setReportPriority(10000); applicationReportModel.setReportName(REPORT_NAME); applicationReportModel.setDescription(REPORT_DESCRIPTION); applicationReportModel.setReportIconClass("fa fa-question-circle"); applicationReportModel.setMainApplicationReport(false); applicationReportModel.setDisplayInApplicationReportIndex(true); if (projectModel == null) applicationReportModel.setDisplayInGlobalApplicationIndex(true); else applicationReportModel.setProjectModel(projectModel); applicationReportModel.setTemplatePath(TEMPLATE_APPLICATION_REPORT); applicationReportModel.setTemplateType(TemplateType.FREEMARKER); Map<String, WindupVertexFrame> related = new HashMap<>(); AboutWindupModel aboutWindupModel = context.getFramed().addFramedVertex(AboutWindupModel.class); aboutWindupModel.setWindupRuntimeVersion(addon.getId().getVersion().toString()); related.put("windupAbout", aboutWindupModel); applicationReportModel.setRelatedResource(related); // Set the filename for the report ReportService reportService = new ReportService(context); String filename = projectModel == null ? "about_global" : "about_" + projectModel.getName(); reportService.setUniqueFilename(applicationReportModel, filename, "html"); return applicationReportModel; }
private ApplicationReportModel createAboutWindup(GraphContext context, ProjectModel projectModel) { ApplicationReportService applicationReportService = new ApplicationReportService(context); ApplicationReportModel applicationReportModel = applicationReportService.create(); applicationReportModel.setReportPriority(10000); applicationReportModel.setReportName(REPORT_NAME); applicationReportModel.setDescription(REPORT_DESCRIPTION); applicationReportModel.setReportIconClass("fa fa-question-circle"); applicationReportModel.setMainApplicationReport(false); applicationReportModel.setDisplayInApplicationReportIndex(true); if (projectModel == null) applicationReportModel.setDisplayInGlobalApplicationIndex(true); else applicationReportModel.setProjectModel(projectModel); applicationReportModel.setTemplatePath(TEMPLATE_APPLICATION_REPORT); applicationReportModel.setTemplateType(TemplateType.FREEMARKER); Map<String, WindupVertexFrame> related = new HashMap<>(); AboutWindupModel aboutWindupModel = context.getFramed().addFramedVertex(AboutWindupModel.class); aboutWindupModel.setWindupRuntimeVersion(addon.getId().getVersion().toString()); related.put("windupAbout", aboutWindupModel); applicationReportModel.setRelatedResource(related); // Set the filename for the report ReportService reportService = new ReportService(context); String filename = projectModel == null ? "about_global" : "about_" + projectModel.getName(); reportService.setUniqueFilename(applicationReportModel, filename, "html"); return applicationReportModel; }
@Override public Result execute(UIExecutionContext context) throws Exception { if (!context.getPrompt().promptBoolean( "Are you sure you want to continue? This command will delete current directories: addons, bin, lib, rules/migration-core")) { return Results.fail("Updating distribution was aborted."); } // Find the latest version. Coordinate latestDist = this.updater.getLatestReleaseOf("org.jboss.windup", "windup-distribution"); Version latestVersion = SingleVersion.valueOf(latestDist.getVersion()); Version installedVersion = currentAddon.getId().getVersion(); if (latestVersion.compareTo(installedVersion) <= 0) { return Results.fail(Util.WINDUP_BRAND_NAME_ACRONYM+" CLI is already in the most updated version."); } distUpdater.replaceWindupDirectoryWithDistribution(latestDist); return Results.success("Sucessfully updated "+Util.WINDUP_BRAND_NAME_ACRONYM+" CLI to version " + latestDist.getVersion() + ". Please restart RHAMT CLI."); }