protected Object doExecute()

in nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/commands/IdsCommand.java [41:63]


    protected Object doExecute(AuditorMBean auditor) throws Exception {
        String[] ids;
        if (index >= 0) {
            ids = new String[] { auditor.getExchangeIdByIndex(index) };
        } else if (from >= 0 && to >= 0) {
            ids = auditor.getExchangeIdsByRange(from, to);
        } else if (all) {
            ids = auditor.getAllExchangeIds();
        } else {
            System.err.println("One of [--index, --id, --all] option must be specified");
            return null;
        }
        if (ids == null || ids.length == 0) {
            System.out.println("No matching exchanges");
        } else {
            for (String id : ids) {
                if (id != null) {
                    System.out.println(id);
                }
            }
        }
        return null;
    }