use of org.jboss.galleon.ProvisioningManager in project galleon by wildfly.
the class AbstractInstallationCommand method getFeatureContainer.
public FeatureContainer getFeatureContainer(PmSession session, ProvisioningLayout<FeaturePackLayout> layout) throws ProvisioningException, CommandExecutionException, IOException {
FeatureContainer container;
ProvisioningManager manager = getManager(session);
if (manager.getProvisionedState() == null) {
throw new CommandExecutionException("Specified directory doesn't contain an installation");
}
if (layout == null) {
ProvisioningConfig config = manager.getProvisioningConfig();
try (ProvisioningRuntime runtime = manager.getRuntime(config)) {
container = FeatureContainers.fromProvisioningRuntime(session, runtime);
}
} else {
try (ProvisioningRuntime runtime = manager.getRuntime(layout)) {
container = FeatureContainers.fromProvisioningRuntime(session, runtime);
}
}
return container;
}
use of org.jboss.galleon.ProvisioningManager in project galleon by wildfly.
the class ClearHistoryCommand method runCommand.
@Override
protected void runCommand(PmCommandInvocation invoc) throws CommandExecutionException {
try {
ProvisioningManager mgr = getManager(invoc.getPmSession());
mgr.clearStateHistory();
} catch (ProvisioningException ex) {
throw new CommandExecutionException(invoc.getPmSession(), CliErrors.clearHistoryFailed(), ex);
}
}
use of org.jboss.galleon.ProvisioningManager in project galleon by wildfly.
the class UniverseManager method getDefaultUniverseSpec.
public UniverseSpec getDefaultUniverseSpec(Path installation) {
UniverseSpec defaultUniverse = null;
if (pmSession.getState() != null) {
defaultUniverse = pmSession.getState().getConfig().getDefaultUniverse();
} else {
try {
ProvisioningManager mgr = getProvisioningManager(installation);
defaultUniverse = mgr.getProvisioningConfig().getDefaultUniverse();
} catch (ProvisioningException ex) {
// OK, not an installation
}
}
return defaultUniverse == null ? builtinUniverseSpec : defaultUniverse;
}
use of org.jboss.galleon.ProvisioningManager in project galleon by wildfly.
the class UniverseManager method addUniverse.
public void addUniverse(Path installation, String name, String factory, String location) throws ProvisioningException, IOException {
UniverseSpec u = new UniverseSpec(factory, location);
ProvisioningManager mgr = getProvisioningManager(installation);
if (name != null) {
mgr.addUniverse(name, u);
} else {
mgr.setDefaultUniverse(u);
}
resolveUniverse(u);
}
use of org.jboss.galleon.ProvisioningManager 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
}
}
Aggregations