use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class CliTestUtils method installPatch.
public static FPID installPatch(CliWrapper cli, UniverseSpec universeSpec, String producer, String version, String qualifier, Path directory) throws ProvisioningException {
FeaturePackCreator creator = FeaturePackCreator.getInstance().addArtifactResolver(cli.getSession().getMavenRepoManager());
FeaturePackLocation fp1 = new FeaturePackLocation(universeSpec, producer, "1", null, version + "-patch-" + qualifier);
creator.newFeaturePack(fp1.getFPID()).setPatchFor(buildFPL(universeSpec, producer, "1", null, version + "." + qualifier).getFPID()).newPackage("p1", true).writeContent("fp1/p1.txt", "fp1 p1 patch");
creator.install(directory);
return fp1.getFPID();
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class CliTestUtils method install.
public static void install(CliWrapper cli, UniverseSpec universeSpec, String producer, String version) throws ProvisioningException {
FeaturePackCreator creator = FeaturePackCreator.getInstance().addArtifactResolver(cli.getSession().getMavenRepoManager());
FeaturePackLocation fp1 = new FeaturePackLocation(universeSpec, producer, "1", null, version);
creator.newFeaturePack(fp1.getFPID()).newPackage("p1", true).writeContent(producer + "/p1.txt", "fp1 p1");
creator.install();
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class ListFeaturePacksCommand method runCommand.
@Override
public void runCommand(PmCommandInvocation invoc) throws CommandExecutionException {
Map<UniverseSpec, Table> tables = new HashMap<>();
Map<UniverseSpec, Set<String>> exceptions = new HashMap<>();
// Search for an installation in the context
Path installation = null;
try {
installation = Util.lookupInstallationDir(invoc.getConfiguration().getAeshContext(), null);
} catch (ProvisioningException ex) {
// XXX OK, no installation.
}
Path finalPath = installation;
UniverseVisitor visitor = new UniverseVisitor() {
@Override
public void visit(Producer<?> producer, FeaturePackLocation loc) {
if (loc.getFrequency() == null) {
return;
}
if (allFrequencies || loc.getFrequency().equals(producer.getDefaultFrequency())) {
Table table = tables.get(loc.getUniverse());
if (table == null) {
table = new Table(Headers.PRODUCT, Headers.UPDATE_CHANNEL, Headers.LATEST_BUILD);
tables.put(loc.getUniverse(), table);
}
loc = invoc.getPmSession().getExposedLocation(finalPath, loc);
table.addLine(producer.getName(), StateInfoUtil.formatChannel(loc), (loc.getBuild() == null ? NONE : loc.getBuild()));
}
}
@Override
public void exception(UniverseSpec spec, Exception ex) {
Set<String> set = exceptions.get(spec);
if (set == null) {
set = new HashSet<>();
exceptions.put(spec, set);
}
set.add(ex.getLocalizedMessage() == null ? ex.getMessage() : ex.getLocalizedMessage());
}
};
try {
if (fromUniverse != null) {
invoc.getPmSession().getUniverse().visitUniverse(UniverseSpec.fromString(fromUniverse), visitor, true);
} else {
invoc.getPmSession().getUniverse().visitAllUniverses(visitor, true, finalPath);
}
} catch (ProvisioningException ex) {
throw new CommandExecutionException(invoc.getPmSession(), CliErrors.resolvedUniverseFailed(), ex);
}
FindCommand.printExceptions(invoc, exceptions);
for (Entry<UniverseSpec, Table> entry : tables.entrySet()) {
Table table = entry.getValue();
table.sort(Table.SortType.ASCENDANT);
invoc.println(table.build());
}
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateInfoUtil method buildDependencies.
public static String buildDependencies(List<FeaturePackLocation> dependencies, Map<FPID, FeaturePackConfig> configs) {
if (!dependencies.isEmpty()) {
boolean showPatches = configs == null ? false : showPatches(configs.values());
List<String> headers = new ArrayList<>();
headers.add(Headers.DEPENDENCY);
headers.add(Headers.BUILD);
if (showPatches) {
headers.add(Headers.PATCHES);
}
headers.add(Headers.UPDATE_CHANNEL);
Table table = new Table(headers);
for (FeaturePackLocation d : dependencies) {
List<Cell> line = new ArrayList<>();
line.add(new Cell(d.getProducerName()));
line.add(new Cell(d.getBuild()));
if (showPatches) {
FeaturePackConfig config = configs.get(d.getFPID());
if (config != null && config.hasPatches()) {
Cell patches = new Cell();
for (FPID p : config.getPatches()) {
patches.addLine(p.getBuild());
}
line.add(patches);
}
}
line.add(new Cell(formatChannel(d)));
table.addCellsLine(line);
}
table.sort(Table.SortType.ASCENDANT);
return table.build();
}
return null;
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateInfoUtil method buildFeaturePacks.
private static String buildFeaturePacks(PmCommandInvocation commandInvocation, Path installation, Collection<FeaturePackConfig> fps) {
boolean showPatches = showPatches(fps);
List<String> headers = new ArrayList<>();
headers.add(Headers.PRODUCT);
headers.add(Headers.BUILD);
if (showPatches) {
headers.add(Headers.PATCHES);
}
headers.add(Headers.UPDATE_CHANNEL);
Table t = new Table(headers);
for (FeaturePackConfig c : fps) {
FeaturePackLocation loc = commandInvocation.getPmSession().getExposedLocation(installation, c.getLocation());
List<Cell> line = new ArrayList<>();
line.add(new Cell(loc.getProducer().getName()));
line.add(new Cell(loc.getBuild()));
if (showPatches) {
if (c.hasPatches()) {
Cell patches = new Cell();
for (FPID p : c.getPatches()) {
patches.addLine(p.getBuild());
}
line.add(patches);
}
}
line.add(new Cell(formatChannel(loc)));
t.addCellsLine(line);
}
if (!t.isEmpty()) {
t.sort(Table.SortType.ASCENDANT);
return t.build();
} else {
return null;
}
}
Aggregations