use of org.infinispan.cli.impl.CliRuntimeRunner in project infinispan by infinispan.
the class CLI method batch.
private CommandResult batch(String inputFile, Shell shell) {
CommandRegistry commandRegistry = initializeCommands(Batch.class);
AeshCommandRuntimeBuilder runtimeBuilder = AeshCommandRuntimeBuilder.builder();
runtimeBuilder.commandActivatorProvider(new ContextAwareCommandActivatorProvider(context)).commandInvocationProvider(new ContextAwareCommandInvocationProvider(context)).commandNotFoundHandler(new CliCommandNotFoundHandler()).completerInvocationProvider(new ContextAwareCompleterInvocationProvider(context)).aeshContext(context).commandRegistry(commandRegistry);
runtimeBuilder.shell(shell);
CliRuntimeRunner cliRunner = new CliRuntimeRunner("batch", runtimeBuilder.build());
int exitCode = cliRunner.args(new String[] { "run", inputFile }).execute();
context.disconnect();
return CommandResult.valueOf(exitCode);
}
use of org.infinispan.cli.impl.CliRuntimeRunner in project infinispan by infinispan.
the class CLI method main.
public static int main(Shell shell, String[] args, Properties properties, boolean kube) {
CommandRuntime runtime = null;
try {
SecurityActions.addSecurityProvider(WildFlyElytronCredentialStoreProvider.getInstance());
runtime = initialCommandRuntimeBuilder(shell, properties, kube).build();
int exitCode = new CliRuntimeRunner(kube ? "kube" : "cli", runtime).args(args).execute();
return exitCode;
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (runtime != null) {
Util.close((AutoCloseable) runtime.getAeshContext());
}
}
}
Aggregations