use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class UndoCommand method doRunCommand.
@Override
protected void doRunCommand(PmCommandInvocation session, Map<String, String> options) throws CommandExecutionException {
try {
ProvisioningManager mgr = getManager(session);
mgr.undo();
} catch (ProvisioningException | IOException ex) {
throw new CommandExecutionException(session.getPmSession(), CliErrors.undoFailed(), ex);
}
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class StateAddFeatureCommand method getSpec.
private FeatureSpecInfo getSpec(State state, String id) throws PathParserException, PathConsumerException, ProvisioningException {
String path = FeatureContainerPathConsumer.FEATURES_PATH + id;
FeatureContainerPathConsumer consumer = new FeatureContainerPathConsumer(new AllFeaturesContainer(state.getContainer()), false);
PathParser.parse(path, consumer);
Group grp = consumer.getCurrentNode(path);
if (grp == null) {
throw new ProvisioningException("Invalid path");
}
if (grp.getSpec() == null) {
throw new ProvisioningException("Path is not a feature-spec");
}
return grp.getSpec();
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class StateAddFeatureCommand method getConfiguration.
private ConfigInfo getConfiguration(State state) throws PathParserException, PathConsumerException, ProvisioningException {
@SuppressWarnings("unchecked") List<String> args = (List<String>) getValue(ARGUMENT_NAME);
String config = args.get(0);
String path = FeatureContainerPathConsumer.FINAL_CONFIGS_PATH + config + 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 " + config);
}
return ci;
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class StateRemoveFeatureCommand method runCommand.
@Override
protected void runCommand(PmCommandInvocation invoc, State session) throws IOException, ProvisioningException, CommandExecutionException {
try {
String path = FeatureContainerPathConsumer.FINAL_CONFIGS_PATH + (feature.endsWith("" + PathParser.PATH_SEPARATOR) ? feature : feature + PathParser.PATH_SEPARATOR);
FeatureContainerPathConsumer consumer = new FeatureContainerPathConsumer(session.getContainer(), false);
PathParser.parse(path, consumer);
ConfigInfo ci = consumer.getConfig();
if (ci == null) {
throw new ProvisioningException("Not a valid configuration " + feature);
}
Group grp = consumer.getCurrentNode(path);
if (grp == null) {
throw new ProvisioningException("Not a valid feature " + feature);
}
FeatureInfo fi = grp.getFeature();
if (fi == null) {
throw new ProvisioningException("Not a valid feature " + feature);
}
session.removeFeature(invoc.getPmSession(), ci, fi);
} catch (Exception ex) {
throw new CommandExecutionException(invoc.getPmSession(), CliErrors.removeFeatureFailed(), ex);
}
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class StateExcludePackageCommand 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.excludePackageFromNewTransitive(invoc.getPmSession(), getProducer(invoc.getPmSession()), name);
} else {
session.excludePackage(invoc.getPmSession(), name, config);
}
} catch (Exception ex) {
throw new CommandExecutionException(invoc.getPmSession(), CliErrors.excludeFailed(), ex);
}
}
Aggregations