Collection<LogicalSource> sources = _relay.getSourcesIdNameRegistry().getAllSources();
if (1 == protoVersion)
{
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));