Search in sources :

Example 71 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class MavenChannel method getLatestBuild.

@Override
public String getLatestBuild(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().getLatestVersion(artifact, getFrequency(fpl), 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 72 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class MavenFeaturePackInstaller method install.

@Override
public void install(Universe<?> universe, FPID fpid, Path fpZip) throws ProvisioningException {
    if (MvnNoLocUniverse.class.isAssignableFrom(universe.getClass())) {
        ((MvnNoLocUniverse) universe).install(fpid, fpZip);
        return;
    }
    final MavenUniverse mvnUni = (MavenUniverse) universe;
    final FeaturePackLocation fps = fpid.getLocation();
    final MavenProducer producer = mvnUni.getProducer(fps.getProducerName());
    // make sure the channel exists
    producer.getChannel(fps.getChannelName());
    final MavenArtifact artifact = new MavenArtifact();
    artifact.setGroupId(producer.getFeaturePackGroupId());
    artifact.setArtifactId(producer.getFeaturePackArtifactId());
    artifact.setVersion(fpid.getBuild());
    artifact.setExtension(ZIP);
    producer.getRepo().install(artifact, fpZip);
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 73 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class ProvisioningLayout method addFpDeps.

protected void addFpDeps(final ProvisioningConfig.Builder builder, Collection<FeaturePackConfig> deps) throws ProvisioningDescriptionException {
    for (FeaturePackConfig fpConfig : deps) {
        final ProducerSpec producer = fpConfig.getLocation().getProducer();
        final FeaturePackLocation resolvedFpl = resolvedVersions.remove(producer);
        if (resolvedFpl != null) {
            builder.addFeaturePackDep(config.originOf(producer), FeaturePackConfig.builder(resolvedFpl).init(fpConfig).build());
        } else {
            builder.addFeaturePackDep(config.originOf(producer), fpConfig);
        }
    }
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) FeaturePackConfig(org.jboss.galleon.config.FeaturePackConfig)

Example 74 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class ProvisioningLayout method resolveLatestBuild.

private FeaturePackLocation resolveLatestBuild(FeaturePackLocation fpl, final Channel channel) throws ProvisioningException {
    final FeaturePackLocation latestLocation = new FeaturePackLocation(fpl.getUniverse(), fpl.getProducerName(), channel.getName(), fpl.getFrequency(), channel.getLatestBuild(fpl));
    channel.resolve(latestLocation);
    registerResolvedVersion(fpl.getProducer(), latestLocation);
    return latestLocation;
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 75 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class ProvisioningLayout method getFeaturePackUpdate.

/**
 * Query for available version update and patches for the specific producer.
 *
 * @param producer  the producer to check the updates for
 * @return  available updates for the producer
 * @throws ProvisioningException  in case of a failure
 */
public FeaturePackUpdatePlan getFeaturePackUpdate(ProducerSpec producer) throws ProvisioningException {
    final F f = featurePacks.get(producer);
    if (f == null) {
        throw new ProvisioningException(Errors.unknownFeaturePack(producer.getLocation().getFPID()));
    }
    final FeaturePackLocation fpl = f.getFPID().getLocation();
    final Universe<?> universe = layoutFactory.getUniverseResolver().getUniverse(fpl.getUniverse());
    final Channel channel = universe.getProducer(fpl.getProducerName()).getChannel(fpl.getChannelName());
    final List<F> patches = fpPatches.get(fpl.getFPID());
    final Set<FPID> patchIds;
    if (patches == null || patches.isEmpty()) {
        patchIds = Collections.emptySet();
    } else if (patches.size() == 1) {
        patchIds = Collections.singleton(patches.get(0).getFPID());
    } else {
        final Set<FPID> tmp = new HashSet<>(patches.size());
        for (F p : patches) {
            tmp.add(p.getFPID());
        }
        patchIds = CollectionUtils.unmodifiable(tmp);
    }
    return channel.getUpdatePlan(FeaturePackUpdatePlan.request(fpl, patchIds, f.isTransitiveDep()));
}
Also used : HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) ProvisioningException(org.jboss.galleon.ProvisioningException) Channel(org.jboss.galleon.universe.Channel) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

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