protected Object doExecute()

in nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/commands/ExchangesCommand.java [45:67]


    protected Object doExecute(AuditorMBean auditor) throws Exception {
        Exchange[] exchanges;
        if (index >= 0) {
            exchanges = new Exchange[] { auditor.getExchangeByIndex(index) };
        } else if (from >= 0 && to >= 0) {
            exchanges = auditor.getExchangesByRange(from, to);
        } else if (id != null) {
            exchanges = new Exchange[] { auditor.getExchangeById(id) };
        } else if (all) {
            exchanges = auditor.getAllExchanges();
        } else {
            System.err.println("One of [--index, --id, --all] option must be specified");
            return null;
        }
        if (exchanges != null) {
            for (Exchange e : exchanges) {
                if (e != null) {
                    System.out.println(e.display(true));
                }
            }
        }
        return null;
    }