Search in sources :

Example 71 with ProvisioningException

use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.

the class StateIncludePackageCommand method runCommand.

@Override
protected void runCommand(PmCommandInvocation invoc, State session, FeaturePackConfig config) throws IOException, ProvisioningException, CommandExecutionException {
    try {
        int i = getPackage().indexOf("/");
        String name = getPackage().substring(i + 1);
        // but no transitive dependency has been created yet.
        if (config == null) {
            session.includePackageInNewTransitive(invoc.getPmSession(), getProducer(invoc.getPmSession()), name);
        } else {
            session.includePackage(invoc.getPmSession(), name, config);
        }
    } catch (Exception ex) {
        throw new CommandExecutionException(invoc.getPmSession(), CliErrors.includeFailed(), ex);
    }
}
Also used : CommandExecutionException(org.jboss.galleon.cli.CommandExecutionException) IOException(java.io.IOException) CommandExecutionException(org.jboss.galleon.cli.CommandExecutionException) ProvisioningException(org.jboss.galleon.ProvisioningException)

Example 72 with ProvisioningException

use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.

the class UpdateCommand method doRunCommand.

@Override
protected void doRunCommand(PmCommandInvocation session, Map<String, String> options) throws CommandExecutionException {
    try {
        ProvisioningManager mgr = getManager(session);
        Updates updates = CheckUpdatesCommand.getUpdatesTable(mgr, session, allDependencies(), getFP());
        if (updates.plan.isEmpty()) {
            session.println(UP_TO_DATE);
        } else {
            session.println(UPDATES_AVAILABLE);
            session.println(updates.t.build());
            if (!noConfirm()) {
                try {
                    Key k = null;
                    while (k == null || (!Key.y.equals(k) && !Key.n.equals(k))) {
                        session.print("Proceed with latest updates [y/n]?");
                        KeyAction a = session.input();
                        k = Key.findStartKey(a.buffer().array());
                    }
                    if (Key.n.equals(k)) {
                        return;
                    }
                } finally {
                    session.println("");
                }
            }
            mgr.apply(updates.plan, options);
        }
    } catch (ProvisioningException | IOException ex) {
        throw new CommandExecutionException(session.getPmSession(), CliErrors.updateFailed(), ex);
    } catch (InterruptedException ignored) {
    // Just exit the command smoothly
    }
}
Also used : ProvisioningManager(org.jboss.galleon.ProvisioningManager) Updates(org.jboss.galleon.cli.cmd.maingrp.CheckUpdatesCommand.Updates) ProvisioningException(org.jboss.galleon.ProvisioningException) CommandExecutionException(org.jboss.galleon.cli.CommandExecutionException) IOException(java.io.IOException) KeyAction(org.aesh.readline.action.KeyAction) Key(org.aesh.readline.terminal.Key)

Example 73 with ProvisioningException

use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.

the class AbstractPluginsCommand method runCommand.

@Override
protected void runCommand(PmCommandInvocation session, Map<String, String> options) throws CommandExecutionException {
    if (isVerbose()) {
        session.getPmSession().enableMavenTrace(true);
    }
    try {
        final String id = getId(pmSession);
        final FeaturePackLocation loc = id == null ? null : pmSession.getResolvedLocation(getInstallationDirectory(session.getConfiguration().getAeshContext()), id);
        runCommand(session, options, loc);
    } catch (ProvisioningException ex) {
        throw new CommandExecutionException(session.getPmSession(), CliErrors.resolveLocationFailed(), ex);
    } finally {
        session.getPmSession().enableMavenTrace(false);
    }
}
Also used : ProvisioningException(org.jboss.galleon.ProvisioningException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) CommandExecutionException(org.jboss.galleon.cli.CommandExecutionException)

Example 74 with ProvisioningException

use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.

the class MavenResolveFeaturePack method runCommand.

@Override
protected void runCommand(PmCommandInvocation session) throws CommandExecutionException {
    try {
        if (verbose) {
            session.getPmSession().enableMavenTrace(true);
        }
        try {
            session.getPmSession().downloadFp(session.getPmSession().getResolvedLocation(null, fpl).getFPID());
            session.println("artifact installed in local mvn repository " + session.getPmSession().getPmConfiguration().getMavenConfig().getLocalRepository());
        } finally {
            session.getPmSession().enableMavenTrace(false);
        }
    } catch (ProvisioningException ex) {
        throw new CommandExecutionException(session.getPmSession(), CliErrors.resolveFeaturePackFailed(), ex);
    }
}
Also used : ProvisioningException(org.jboss.galleon.ProvisioningException) CommandExecutionException(org.jboss.galleon.cli.CommandExecutionException)

Example 75 with ProvisioningException

use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.

the class StateResetConfigCommand method getConfiguration.

protected ConfigInfo getConfiguration(State state) throws PathParserException, PathConsumerException, ProvisioningException, Exception {
    String path = FeatureContainerPathConsumer.FINAL_CONFIGS_PATH + configuration + PathParser.PATH_SEPARATOR;
    FeatureContainerPathConsumer consumer = new FeatureContainerPathConsumer(state.getContainer(), false);
    PathParser.parse(path, consumer);
    ConfigInfo ci = consumer.getConfig();
    if (ci == null) {
        throw new ProvisioningException("Not a valid config " + configuration);
    }
    return ci;
}
Also used : FeatureContainerPathConsumer(org.jboss.galleon.cli.path.FeatureContainerPathConsumer) ProvisioningException(org.jboss.galleon.ProvisioningException) ConfigInfo(org.jboss.galleon.cli.model.ConfigInfo)

Aggregations

ProvisioningException (org.jboss.galleon.ProvisioningException)101 IOException (java.io.IOException)45 Path (java.nio.file.Path)35 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)24 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)15 XMLStreamException (javax.xml.stream.XMLStreamException)13 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)10 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)10 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)9 ProvisioningManager (org.jboss.galleon.ProvisioningManager)9 BufferedReader (java.io.BufferedReader)8 HashMap (java.util.HashMap)8 ConfigId (org.jboss.galleon.config.ConfigId)8 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)8 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)8 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 Map (java.util.Map)7 FeatureContainerPathConsumer (org.jboss.galleon.cli.path.FeatureContainerPathConsumer)7 BufferedWriter (java.io.BufferedWriter)6