context.getActionReport().setMessage("No such config named: " + target);
context.getActionReport().setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
BatchRuntimeConfiguration batchRuntimeConfiguration = config.getExtensionByType(BatchRuntimeConfiguration.class);
Map<String, Object> map = new HashMap<>();
map.put(DATA_SOURCE_NAME, batchRuntimeConfiguration.getDataSourceLookupName());
map.put(EXECUTOR_SERVICE_NAME, batchRuntimeConfiguration.getExecutorServiceLookupName());
extraProps.put("listBatchRuntimeConfiguration", map);
ColumnFormatter columnFormatter = new ColumnFormatter(getDisplayHeaders());
Object[] data = new Object[getOutputHeaders().length];
for (int index=0; index<getOutputHeaders().length; index++) {
switch (getOutputHeaders()[index]) {
case DATA_SOURCE_NAME:
String val = batchRuntimeConfiguration.getDataSourceLookupName();
data[index] = (val == null || val.trim().length() == 0)
? BatchRuntimeHelper.getDefaultDataSourceLookupNameForTarget(target) : val;
break;
case EXECUTOR_SERVICE_NAME:
data[index] = batchRuntimeConfiguration.getExecutorServiceLookupName();
break;
default:
throw new IllegalArgumentException("Unknown header: " + getOutputHeaders()[index]);
}
}