if (!(handler instanceof OperationCommand)) {
throw new CommandLineException("The command is not allowed in a batch.");
} else {
try {
ModelNode request = ((OperationCommand) handler).buildRequest(this);
BatchedCommand batchedCmd = new DefaultBatchedCommand(line, request);
Batch batch = getBatchManager().getActiveBatch();
batch.add(batchedCmd);
printLine("#" + batch.size() + " " + batchedCmd.getCommand());
} catch (CommandFormatException e) {
throw new CommandFormatException("Failed to add to batch '" + line + "'", e);
}
}
} else {