use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class UniverseManager method visit.
private static void visit(UniverseVisitor visitor, Universe<?> universe, UniverseSpec universeSpec, boolean allBuilds) throws ProvisioningException {
for (Producer<?> producer : universe.getProducers()) {
for (Channel channel : producer.getChannels()) {
if (allBuilds) {
List<String> builds = getAllBuilds(universeSpec, producer, channel);
if (builds != null && !builds.isEmpty()) {
for (String build : builds) {
visitor.visit(producer, new FeaturePackLocation(universeSpec, producer.getName(), channel.getName(), null, build));
}
}
}
for (String freq : producer.getFrequencies()) {
String build = getBuild(universeSpec, producer, channel, freq);
// We have a latest build for the frequency.
if (build != null) {
FeaturePackLocation loc = new FeaturePackLocation(universeSpec, producer.getName(), channel.getName(), freq, build);
visitor.visit(producer, loc);
}
}
}
}
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class BasicTransitiveDepCustomizationTestCase method createFeaturePacks.
@Override
protected void createFeaturePacks(FeaturePackCreator creator) throws ProvisioningException {
fp1Fpl = newFpl("producer1", "1", "1.0.0.Final");
fp2Fpl = newFpl("producer2", "1", "1.0.0.Final");
fp3fpl = newFpl("producer3", "1", "1.0.0.Final");
creator.newFeaturePack().setFPID(fp1Fpl.getFPID()).addDependency(fp2Fpl).addDependency(FeaturePackConfig.transitiveBuilder(new FeaturePackLocation(fp3fpl.getUniverse(), fp3fpl.getProducerName(), null, null, null)).excludePackage("p2").includePackage("p3").build()).addFeatureSpec(FeatureSpec.builder("specA").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specA").setParam("p1", "1")).build()).newPackage("p1", true).writeContent("fp1/p1.txt", "fp1");
creator.newFeaturePack().setFPID(fp2Fpl.getFPID()).addDependency(FeaturePackConfig.builder(fp3fpl).excludePackage("p4").build()).addFeatureSpec(FeatureSpec.builder("specB").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specB").setParam("p1", "1")).build()).newPackage("p1", true).writeContent("fp2/p1.txt", "fp2");
creator.newFeaturePack().setFPID(fp3fpl.getFPID()).addFeatureSpec(FeatureSpec.builder("specC").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specC").setParam("p1", "1")).build()).newPackage("p1", true).addDependency("p2", true).addDependency("p4", true).writeContent("fp3/p1.txt", "fp3 100 p1").getFeaturePack().newPackage("p2").writeContent("fp3/p2.txt", "fp3 100 p2").getFeaturePack().newPackage("p3").writeContent("fp3/p3.txt", "fp3 100 p3").getFeaturePack().newPackage("p4").writeContent("fp3/p4.txt", "fp3 100 p4");
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateInfoUtil method buildDependencies.
private static String buildDependencies(PmCommandInvocation invoc, ProvisioningLayout<FeaturePackLayout> layout) throws ProvisioningException {
Map<FPID, FeaturePackConfig> configs = new HashMap<>();
List<FeaturePackLocation> dependencies = new ArrayList<>();
for (FeaturePackLayout fpLayout : layout.getOrderedFeaturePacks()) {
boolean isProduct = true;
for (FeaturePackLayout fpLayout2 : layout.getOrderedFeaturePacks()) {
if (fpLayout2.getSpec().hasTransitiveDep(fpLayout.getFPID().getProducer()) || fpLayout2.getSpec().getFeaturePackDep(fpLayout.getFPID().getProducer()) != null) {
isProduct = false;
break;
}
}
if (!isProduct) {
FeaturePackLocation loc = invoc.getPmSession().getExposedLocation(null, fpLayout.getFPID().getLocation());
dependencies.add(loc);
FeaturePackConfig transitiveConfig = layout.getConfig().getTransitiveDep(fpLayout.getFPID().getProducer());
configs.put(loc.getFPID(), transitiveConfig);
}
}
return buildDependencies(dependencies, configs);
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateInfoUtil method buildPatches.
public static String buildPatches(PmCommandInvocation invoc, ProvisioningLayout<FeaturePackLayout> layout) throws ProvisioningException {
if (!layout.hasPatches()) {
return null;
}
Table table = new Table(Headers.PATCH, Headers.PATCH_FOR, Headers.UPDATE_CHANNEL);
for (FeaturePackLayout fpLayout : layout.getOrderedFeaturePacks()) {
List<FeaturePackLayout> patches = layout.getPatches(fpLayout.getFPID());
for (FeaturePackLayout patch : patches) {
FeaturePackLocation loc = invoc.getPmSession().getExposedLocation(null, patch.getFPID().getLocation());
FPID patchFor = patch.getSpec().getPatchFor();
table.addLine(patch.getFPID().getBuild(), patchFor.getProducer().getName() + FeaturePackLocation.BUILD_START + patchFor.getBuild(), formatChannel(loc));
}
}
if (!table.isEmpty()) {
table.sort(Table.SortType.ASCENDANT);
return table.build();
}
return null;
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class AbstractPluginsCommand method runCommand.
@Override
protected void runCommand(PmCommandInvocation session, Map<String, String> options) throws CommandExecutionException {
if (isVerbose()) {
session.getPmSession().enableMavenTrace(true);
}
try {
final String id = getId(pmSession);
final FeaturePackLocation loc = id == null ? null : pmSession.getResolvedLocation(getInstallationDirectory(session.getConfiguration().getAeshContext()), id);
runCommand(session, options, loc);
} catch (ProvisioningException ex) {
throw new CommandExecutionException(session.getPmSession(), CliErrors.resolveLocationFailed(), ex);
} finally {
session.getPmSession().enableMavenTrace(false);
}
}
Aggregations