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;
}
}
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);
}
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);
}
}
}
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;
}
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()));
}
Aggregations