Refine search
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; }
private String toMavenCoords(AddonId addonId) { String coords = addonId.getName() + ":jar:" + this.classifier + ":" + addonId.getVersion(); return coords; }
/** * Used by the converter addon */ public static AddonId valueOf(String coordinates) { return fromCoordinates(coordinates); }
public AddonInfoBuilder setAPIVersion(Version apiVersion) { AddonId newId = AddonId.from(addon.getName(), addon.getVersion(), apiVersion); this.addon = newId; return this; }
@Override public int compareTo(AddonId other) { if (other == null) throw new IllegalArgumentException("Cannot compare against null."); int result = getName().compareTo(other.getName()); if (result == 0) result = getVersion().compareTo(other.getVersion()); if (result == 0) result = getApiVersion().compareTo(other.getApiVersion()); return result; }
Set<Addon> addons = furnace.getAddonRegistry().getAddons(); AddonId addonId = addons.stream().map(a -> a.getId()).filter(a -> a.getName().equals(named.getValue())) .findFirst().get(); String addonAPIVersion = resolver.resolveAPIVersion(addonId).get(); try Response<AddonId[]> resolveVersions = resolver.resolveVersions(addonId.getName()); if (id.getVersion().compareTo(maxAddonId.getVersion()) > 0 && addonAPIVersion.equals(resolver.resolveAPIVersion(id).get())) for (AddonRepository r : furnace.getRepositories()) if (id.equals(maxAddonId)) return Results.fail("Addon " + maxAddonId.toCoordinates() + " is already installed with the most updated version."); if (installRequest.getActions().isEmpty()) return Results.fail("Addon " + maxAddonId.toCoordinates() + " is already installed with the most updated version."); return Results.success("Addon " + maxAddonId.toCoordinates() + " was installed successfully."); return Results.fail("Addon " + maxAddonId.toCoordinates() + " could not be installed.", t);
AddonManager addonManager = SimpleContainer.getServices(getClass().getClassLoader(), AddonManager.class).get(); AddonId id = AddonId.from(coordinate.getGroupId() + ":" + coordinate.getArtifactId(), coordinate.getVersion()); RemoveRequest removeRequest = addonManager.remove(id); removeRequest.perform(); AddonRegistry registry = SimpleContainer.getFurnace(getClass().getClassLoader()).getAddonRegistry(); Addons.waitUntilStopped(registry.getAddon(id)); InstallRequest installRequest = addonManager.install(id);
@Override public Result execute(UIExecutionContext context) throws Exception Furnace furnace = SimpleContainer.getFurnace(getClass().getClassLoader()); AddonRegistry registry = furnace.getAddonRegistry(); AddonManager addonManager = registry.getServices(AddonManager.class).get(); ProjectFactory projectFactory = getProjectFactory(); ResourceFactory resourceFactory = registry.getServices(ResourceFactory.class).get(); GitUtils gitUtils = registry.getServices(GitUtils.class).get(); .addArguments("clean", "install", "-Dversion.furnace=" + furnace.getVersion(), "-Dversion.forge=" + Versions.getImplementationVersionFor(getClass())) .runTests(false) ids.add(AddonId.fromCoordinates(c)); ids.add(AddonId.from(c, buildCoordinate.getVersion())); ids.add(AddonId.from(buildCoordinate.getGroupId() + ":" + buildCoordinate.getArtifactId(), buildCoordinate.getVersion()));
@Override public Result execute(UIExecutionContext context) throws Exception { Furnace furnace = SimpleContainer.getFurnace(getClass().getClassLoader()); FacetFactory facetFactory = SimpleContainer.getServices(getClass().getClassLoader(), FacetFactory.class).get(); DependencyInstaller dependencyInstaller = SimpleContainer .getServices(getClass().getClassLoader(), DependencyInstaller.class).get(); UIContext uiContext = context.getUIContext(); Project project = getSelectedProject(uiContext); facetFactory.install(project, FurnaceVersionFacet.class); project.getFacet(FurnaceVersionFacet.class).setVersion(furnace.getVersion().toString()); facetFactory.install(project, AddonTestFacet.class); for (AddonId addonId : addonDependencies.getValue()) { DependencyBuilder dependency = DependencyBuilder.create(addonId.getName()) .setVersion(addonId.getVersion().toString()).setScopeType("test"); if (!dependencyInstaller.isInstalled(project, dependency)) { dependencyInstaller.install(project, dependency); } } return Results .success("Project " + project.getFacet(MetadataFacet.class).getProjectName() + " is now configured for testing"); }
@Override public Result execute(UIExecutionContext context) { Furnace furnace = SimpleContainer.getFurnace(getClass().getClassLoader()); AddonManager addonManager = SimpleContainer.getServices(getClass().getClassLoader(), AddonManager.class).get(); AddonDependencyResolver resolver = SimpleContainer .getServices(getClass().getClassLoader(), AddonDependencyResolver.class).get(); Version version = furnace.getVersion(); AddonId addonId = CoordinateUtils.resolveCoordinate(coordinate.getValue(), version, resolver); try { addonManager.install(addonId).perform(); // Invalidate project cache getProjectFactory().invalidateCaches(); return Results.success("Addon " + addonId.toCoordinates() + " was installed successfully."); } catch (Throwable t) { return Results.fail( "Addon " + addonId.toCoordinates() + " could not be installed: " + t.getCause().getMessage(), t); } }
.getServices(getClass().getClassLoader(), AddonProjectConfigurator.class).get(); InputComponentFactory factory = builder.getInputComponentFactory(); addon = factory.createInput("addon", String.class).setLabel("Addon Coordinates") Project project = getSelectedProject(builder); Furnace furnace = SimpleContainer.getFurnace(getClass().getClassLoader()); for (AddonRepository repository : furnace.getRepositories()) boolean isContainerAddon = id.getName().contains("org.jboss.forge.furnace.container"); if (!isContainerAddon && !configurator.dependsOnAddon(project, id))
.setRequired(true).setRequiredMessage( "The specified addon coordinates were not found within any configured furnace repository"); Furnace furnace = SimpleContainer.getFurnace(getClass().getClassLoader()); ProjectFactory projectFactory = SimpleContainer.getServices(getClass().getClassLoader(), ProjectFactory.class) .get(); Set<AddonId> choices = new TreeSet<>(); for (AddonRepository repository : furnace.getRepositories()) AddonId selectedAddonId = AddonId.from(name, facet.getProjectVersion()); if (choices.contains(selectedAddonId))
private void addAddonDependency(Project project, StringBuilder dependenciesAnnotationBody, AddonId addonId) { DependencyInstaller dependencyInstaller = SimpleContainer .getServices(getClass().getClassLoader(), DependencyInstaller.class).get(); Dependency dependency = DependencyBuilder.create(addonId.getName()).setVersion( addonId.getVersion().toString()).setClassifier(MavenAddonDependencyResolver.FORGE_ADDON_CLASSIFIER) .setScopeType("test"); String name = addonId.getName(); if (!dependencyInstaller.isInstalled(project, dependency)) { dependencyInstaller.install(project, dependency); } dependenciesAnnotationBody.append("@AddonDependency(name = \"").append(name).append("\")"); }
@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; } });
@Override public void initializeUI(UIBuilder builder) throws Exception { InputComponentFactory factory = builder.getInputComponentFactory(); coordinate = factory.createInput("coordinate", String.class).setLabel("Coordinate") .setDescription("The addon's \"groupId:artifactId,version\" coordinate") .setNote("The addon's \"groupId:artifactId,version\" coordinate").setRequired(true); ProjectFactory projectFactory = SimpleContainer.getServices(getClass().getClassLoader(), ProjectFactory.class) .get(); Project project = Projects.getSelectedProject(projectFactory, builder.getUIContext()); if (project != null) { MetadataFacet facet = project.getFacet(MetadataFacet.class); Coordinate c = facet.getOutputDependency().getCoordinate(); coordinate.setDefaultValue(AddonId.from(c.getGroupId() + ":" + c.getArtifactId(), c.getVersion()) .toCoordinates()); } List<String> defaultCoords = Arrays.asList(CoordinateUtils.FORGE_ADDON_GROUP_ID); coordinate.setCompleter((UIContext context, InputComponent<?, String> input, String value) -> { Iterable<String> items = Collections.emptySet(); if (Strings.isNullOrEmpty(value)) { items = defaultCoords; } return items; }); builder.add(coordinate); }
@Override public Result execute(UIExecutionContext context) throws Exception { AddonManager manager = SimpleContainer.getServices(getClass().getClassLoader(), AddonManager.class).get(); Iterable<AddonId> value = addons.getValue(); Iterator<AddonId> iterator = value.iterator(); StringBuilder builder = new StringBuilder(); while (iterator.hasNext()) { AddonId addonId = iterator.next(); builder.append(addonId.toCoordinates()); manager.disable(addonId).perform(); manager.remove(addonId).perform(); if (iterator.hasNext()) builder.append(", "); } return Results.success("Removed addons: " + builder.toString()); } }
@Override public Result execute(UIExecutionContext context) throws Exception { AddonProjectConfigurator configurator = SimpleContainer .getServices(getClass().getClassLoader(), AddonProjectConfigurator.class).get(); Project project = getSelectedProject(context); AddonId addonId = AddonId.fromCoordinates(addon.getValue()); configurator.installSelectedAddons(project, Collections.singleton(addonId), false); return Results.success("Addon " + addonId + " added as a dependency to project " + project.getFacet(MetadataFacet.class).getProjectName()); }
@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"); } } });
AddonId defaultContainer = null; AddonId defaultDependency = null; Furnace furnace = SimpleContainer.getFurnace(getClass().getClassLoader()); for (AddonRepository repository : furnace.getRepositories()) if (DEFAULT_CONTAINER_NAME.equals(id.getName())) else if (DEFAULT_DEPENDENCY_NAME.equals(id.getName())) boolean isContainerAddon = id.getName().contains("org.jboss.forge.furnace.container"); if (isContainerAddon)
addon = AddonId.fromCoordinates(coordinates); coordinates = addon.getName(); REPOS: for (AddonRepository repository : furnace.getRepositories()) if (!coordinates.equals(id.getName()) || !(repository instanceof MutableAddonRepository)) continue;