Search in sources :

Example 6 with FeaturePackLocation

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();
}
Also used : FeaturePackCreator(org.jboss.galleon.creator.FeaturePackCreator) BasicStateDiffPlugin(org.jboss.galleon.userchanges.persist.test.BasicStateDiffPlugin) FeatureConfig(org.jboss.galleon.config.FeatureConfig) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) BasicStateDiffPlugin(org.jboss.galleon.userchanges.persist.test.BasicStateDiffPlugin) StateDiffPlugin(org.jboss.galleon.plugin.StateDiffPlugin)

Example 7 with FeaturePackLocation

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);
        }
    }
}
Also used : Path(java.nio.file.Path) FeaturePackInstaller(org.jboss.galleon.maven.plugin.util.FeaturePackInstaller) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MavenArtifactRepositoryManager(org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 8 with FeaturePackLocation

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;
    }
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException)

Example 9 with FeaturePackLocation

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;
}
Also used : Path(java.nio.file.Path) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 10 with FeaturePackLocation

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());
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Test(org.junit.Test)

Aggregations

FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)111 Test (org.junit.Test)46 Path (java.nio.file.Path)23 ProvisioningException (org.jboss.galleon.ProvisioningException)18 UniverseSpec (org.jboss.galleon.universe.UniverseSpec)18 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)16 ArrayList (java.util.ArrayList)13 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)13 FeaturePackCreator (org.jboss.galleon.creator.FeaturePackCreator)12 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)9 XMLStreamException (javax.xml.stream.XMLStreamException)8 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)8 IOException (java.io.IOException)7 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)7 HashMap (java.util.HashMap)6 CommandException (org.aesh.command.CommandException)6 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)6 FeatureConfig (org.jboss.galleon.config.FeatureConfig)6 FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)6 Set (java.util.Set)5