use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class CliTestUtils method installWithLayers.
public static void installWithLayers(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()).addFeatureSpec(FeatureSpec.builder(producer + "-FeatureA").addParam(FeatureParameterSpec.createId("id")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("base-" + producer).addFeature(new FeatureConfig(producer + "-FeatureA").setParam("id", "base")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layerA-" + producer).addLayerDep("base-" + producer).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layerB-" + producer).addLayerDep("layerA-" + producer).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layerC-" + producer).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layerD-" + producer).build()).addConfig(ConfigModel.builder("testmodel", "config1.xml").includeLayer("layerB-" + producer).build(), true).addConfig(ConfigModel.builder("testmodel", "config2.xml").includeLayer("layerD-" + producer).build(), true).newPackage("p1", true).writeContent(producer + "/p1.txt", "fp1 p1").getFeaturePack().addService(StateDiffPlugin.class, BasicStateDiffPlugin.class).addPlugin(TestConfigsPersistingPlugin.class);
creator.install();
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class FeaturePackInstallMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping the install-feature-pack goal.");
return;
}
FeaturePackLocation fpl = null;
Path localPath = null;
if (featurePack != null) {
localPath = resolveMaven(featurePack, new MavenArtifactRepositoryManager(repoSystem, repoSession));
} else if (location != null) {
fpl = FeaturePackLocation.fromString(location);
} else {
throw new MojoExecutionException("Either 'location' or 'feature-pack' must be configured");
}
final FeaturePackInstaller fpInstaller = FeaturePackInstaller.newInstance(repoSession.getLocalRepository().getBasedir().toPath(), installDir.toPath()).setFpl(fpl).setLocalArtifact(localPath).setInheritConfigs(inheritConfigs).includeConfigs(includedConfigs).setInheritPackages(inheritPackages).includePackages(includedPackages).excludePackages(excludedPackages).setPluginOptions(pluginOptions);
if (customConfig != null) {
fpInstaller.setCustomConfig(customConfig.toPath().toAbsolutePath());
}
final String originalMavenRepoLocal = System.getProperty(MAVEN_REPO_LOCAL);
System.setProperty(MAVEN_REPO_LOCAL, session.getSettings().getLocalRepository());
try {
fpInstaller.install();
} finally {
if (originalMavenRepoLocal == null) {
System.clearProperty(MAVEN_REPO_LOCAL);
} else {
System.setProperty(MAVEN_REPO_LOCAL, originalMavenRepoLocal);
}
}
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class MavenChannel method getAllBuilds.
@Override
public List<String> getAllBuilds(FeaturePackLocation fpl) throws ProvisioningException {
final MavenArtifact artifact = new MavenArtifact();
artifact.setGroupId(producer.getFeaturePackGroupId());
artifact.setArtifactId(producer.getFeaturePackArtifactId());
artifact.setExtension(MavenArtifact.EXT_ZIP);
artifact.setVersionRange(versionRange);
try {
return producer.getRepo().getAllVersions(artifact, versionIncludePattern, versionExcludePattern);
} catch (MavenLatestVersionNotAvailableException e) {
if (fpl.getFrequency() == null && producer.hasDefaultFrequency()) {
fpl = new FeaturePackLocation(fpl.getUniverse(), fpl.getProducerName(), fpl.getChannelName(), producer.getDefaultFrequency(), null);
}
throw new LatestVersionNotAvailableException(fpl);
} catch (MavenUniverseException e) {
throw e;
}
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class LayoutUtils method getFeaturePackDir.
public static Path getFeaturePackDir(Path fpLayoutDir, FPID fpid, boolean existing) throws ProvisioningDescriptionException {
final FeaturePackLocation fps = fpid.getLocation();
final UniverseSpec universe = fps.getUniverse();
Path fpPath = fpLayoutDir.resolve(universe.getFactory());
if (universe.getLocation() != null) {
fpPath = fpPath.resolve(ensureValidFileName(universe.getLocation()));
}
fpPath = fpPath.resolve(ensureValidFileName(fps.getProducerName()));
if (fps.getChannelName() != null) {
fpPath = fpPath.resolve(fps.getChannelName());
}
fpPath = fpPath.resolve(ensureValidFileName(fpid.getBuild()));
if (existing && !Files.exists(fpPath)) {
throw new ProvisioningDescriptionException(Errors.pathDoesNotExist(fpPath));
}
return fpPath;
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class FeaturePackLocationStringTestCase method testProducerUniverseFactoryLocationFromString.
@Test
public void testProducerUniverseFactoryLocationFromString() throws Exception {
final FeaturePackLocation parsedSrc = FeaturePackLocation.fromString("producer@factory(location)");
Assert.assertNotNull(parsedSrc);
Assert.assertEquals(new UniverseSpec("factory", "location"), parsedSrc.getUniverse());
Assert.assertEquals("producer", parsedSrc.getProducerName());
Assert.assertNull(parsedSrc.getChannelName());
Assert.assertNull(parsedSrc.getFrequency());
Assert.assertNull(parsedSrc.getBuild());
}
Aggregations