use of org.jboss.as.cli.OperationCommand in project wildfly-core by wildfly.
the class CommandContextImpl method handleLegacyCommand.
private void handleLegacyCommand(String opLine, CommandHandler handler, boolean direct) throws CommandLineException {
if (isBatchMode() && handler.isBatchMode(this)) {
if (!(handler instanceof OperationCommand)) {
throw new CommandLineException("The command is not allowed in a batch.");
} else {
try {
Batch batch = getBatchManager().getActiveBatch();
HandledRequest request = ((OperationCommand) handler).buildHandledRequest(this, batch.getAttachments());
BatchedCommand batchedCmd = new DefaultBatchedCommand(this, opLine, request.getRequest(), request.getResponseHandler());
batch.add(batchedCmd);
} catch (CommandFormatException e) {
throw new CommandFormatException("Failed to add to batch '" + opLine + "'", e);
}
}
} else if (direct) {
handler.handle(CommandContextImpl.this);
} else {
execute(() -> {
executor.execute(handler, timeout, TimeUnit.SECONDS);
return null;
}, opLine);
}
}
Aggregations