Search in sources :

Example 6 with CommandResult

use of org.activityinfo.legacy.shared.command.result.CommandResult in project activityinfo by bedatadriven.

the class DispatcherStub method findResult.

private CommandResult findResult(Command command) {
    CommandResult result = results.get(command);
    if (result == null) {
        result = resultByClass.get(command.getClass());
        if (result == null) {
            throw new AssertionError("Unexpected command: " + command.toString());
        }
    }
    log.add(command);
    return result;
}
Also used : CommandResult(org.activityinfo.legacy.shared.command.result.CommandResult)

Example 7 with CommandResult

use of org.activityinfo.legacy.shared.command.result.CommandResult in project activityinfo by bedatadriven.

the class CommandServlet method handleCommand.

protected CommandResult handleCommand(Command command) throws CommandException {
    RemoteExecutionContext context = null;
    try {
        context = new RemoteExecutionContext(injector);
        CommandResult result = context.startExecute(command);
        if (result instanceof CommandException) {
            LOGGER.log(Level.SEVERE, "Exception executing " + command.getClass().getSimpleName(), (CommandException) result);
        }
        return result;
    } catch (CommandException e) {
        throw e;
    } catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Exception executing " + command.getClass().getSimpleName(), e);
        throw new CommandException(command, context, e);
    }
}
Also used : CommandException(org.activityinfo.legacy.shared.exception.CommandException) InvalidAuthTokenException(org.activityinfo.legacy.shared.exception.InvalidAuthTokenException) CommandException(org.activityinfo.legacy.shared.exception.CommandException) CommandResult(org.activityinfo.legacy.shared.command.result.CommandResult)

Aggregations

CommandResult (org.activityinfo.legacy.shared.command.result.CommandResult)7 Command (org.activityinfo.legacy.shared.command.Command)4 ArrayList (java.util.ArrayList)3 BatchCommand (org.activityinfo.legacy.shared.command.BatchCommand)2 BatchResult (org.activityinfo.legacy.shared.command.result.BatchResult)2 CommandException (org.activityinfo.legacy.shared.exception.CommandException)2 POST (javax.ws.rs.POST)1 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)1 InvalidAuthTokenException (org.activityinfo.legacy.shared.exception.InvalidAuthTokenException)1 User (org.activityinfo.server.database.hibernate.entity.User)1