Search in sources :

Example 36 with FeaturePackLocation

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

the class PmSession method getResolvedLocation.

public FeaturePackLocation getResolvedLocation(Path installation, String location) throws ProvisioningException {
    final char endC = location.charAt(location.length() - 1);
    if (endC == FeaturePackLocation.FREQUENCY_START || endC == FeaturePackLocation.BUILD_START) {
        location = location.substring(0, location.length() - 1);
    }
    // A producer spec without any universe nor channel.
    /*
        if (!location.contains("" + FeaturePackLocation.UNIVERSE_START) && !location.contains("" + FeaturePackLocation.CHANNEL_START)) {
            location = new FeaturePackLocation(universe.getDefaultUniverseSpec(installation), location, null, null, null).toString();
        }
        */
    FeaturePackLocation loc = FeaturePackLocation.fromString(location);
    if (loc.getUniverse() == null) {
        loc = loc.replaceUniverse(universe.getDefaultUniverseSpec(installation));
    }
    return getResolvedLocation(installation, loc);
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 37 with FeaturePackLocation

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

the class PmSessionCommand method handleCommandExecutionException.

private static Throwable handleCommandExecutionException(Throwable t) {
    if (t instanceof CommandExecutionException) {
        CommandExecutionException cex = (CommandExecutionException) t;
        if (cex.getPmSession() != null) {
            // Handle default and named universes
            if (cex.getCause() instanceof LatestVersionNotAvailableException) {
                LatestVersionNotAvailableException cause = (LatestVersionNotAvailableException) cex.getCause();
                FeaturePackLocation fpl = cex.getPmSession().getExposedLocation(null, cause.getLocation());
                t = new LatestVersionNotAvailableException(fpl);
            }
        }
    }
    return t;
}
Also used : LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 38 with FeaturePackLocation

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

the class UniverseManager method resolveBuiltinUniverse.

/**
 * Universe resolution is done in a separate thread to not impact startup
 * time.
 */
synchronized void resolveBuiltinUniverse() {
    if (closed) {
        return;
    }
    Future<?> f = executorService.submit(() -> {
        synchronized (UniverseManager.this) {
            if (closed) {
                return;
            }
            try {
                List<FeaturePackLocation> deps = new ArrayList<>();
                builtinUniverse = (MavenUniverse) universeResolver.getUniverse(builtinUniverseSpec, true);
                if (closed) {
                    return;
                }
                // speed-up future completion and execution by retrieving producers and channels
                for (Producer<?> p : builtinUniverse.getProducers()) {
                    final MavenProducer mvnProducer = (MavenProducer) p;
                    if (mvnProducer.isResolvedLocally()) {
                        mvnProducer.refresh();
                    }
                    if (closed) {
                        return;
                    }
                    for (Channel c : p.getChannels()) {
                        if (closed) {
                            return;
                        }
                        FeaturePackLocation ploc = new FeaturePackLocation(builtinUniverseSpec, p.getName(), c.getName(), null, null);
                        deps.add(ploc);
                    }
                }
            } catch (Exception ex) {
                CliLogging.exceptionResolvingBuiltinUniverse(ex);
            }
        }
    });
    submited.add(f);
}
Also used : MavenProducer(org.jboss.galleon.universe.maven.MavenProducer) Channel(org.jboss.galleon.universe.Channel) ArrayList(java.util.ArrayList) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) XMLStreamException(javax.xml.stream.XMLStreamException) IOException(java.io.IOException) ProvisioningException(org.jboss.galleon.ProvisioningException)

Example 39 with FeaturePackLocation

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

the class UniverseManager method getBuild.

private static String getBuild(UniverseSpec spec, Producer<?> producer, Channel channel, String freq) {
    FeaturePackLocation loc = new FeaturePackLocation(spec, producer.getName(), channel.getName(), freq, null);
    String build = null;
    try {
        build = channel.getLatestBuild(loc);
    } catch (ProvisioningException ex) {
    // OK, no build.
    }
    return build;
}
Also used : ProvisioningException(org.jboss.galleon.ProvisioningException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 40 with FeaturePackLocation

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

the class UniverseManager method getAllBuilds.

private static List<String> getAllBuilds(UniverseSpec spec, Producer<?> producer, Channel channel) {
    FeaturePackLocation loc = new FeaturePackLocation(spec, producer.getName(), channel.getName(), null, null);
    List<String> build = Collections.emptyList();
    try {
        build = channel.getAllBuilds(loc);
    } catch (ProvisioningException ex) {
    // OK, no build.
    }
    return build;
}
Also used : ProvisioningException(org.jboss.galleon.ProvisioningException) 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