ArrayList<IdNamePair> sourcePairs = new ArrayList<IdNamePair>(sources.size());
for (LogicalSource source: sources) sourcePairs.add(new IdNamePair(source.getId().longValue(), source.getName()));
mapper.writeValue(out, sourcePairs);
}
else if (2 == protoVersion) mapper.writeValue(out, sources);
else throw new InvalidRequestParamValueException(COMMAND_NAME, VERSION_PARAM_NAME,
Integer.toString(protoVersion));
byte[] resultBytes = out.toString().getBytes(Charset.defaultCharset());