* @see org.jboss.as.cli.handlers.CommandHandlerWithHelp#doHandle(org.jboss.as.cli.CommandContext)
*/
@Override
protected void doHandle(CommandContext ctx) {
final BatchManager batchManager = ctx.getBatchManager();
if(!batchManager.isBatchActive()) {
ctx.error("No active batch.");
return;
}
final Batch batch = batchManager.getActiveBatch();
List<BatchedCommand> currentBatch = batch.getCommands();
if(currentBatch.isEmpty()) {
ctx.error("The batch is empty.");
batchManager.discardActiveBatch();
return;
}
final ModelNode composite = batch.toRequest();
try {
ModelNode result = ctx.getModelControllerClient().execute(composite);
if(Util.isSuccess(result)) {
batchManager.discardActiveBatch();
ctx.printLine("The batch executed successfully.");
} else {
ctx.error("Failed to execute batch: " + Util.getFailureDescription(result));
}
} catch (Exception e) {