Package org.jitterbit.util.kongaprotocol

Examples of org.jitterbit.util.kongaprotocol.KongaCommandResult


        // rather than these lines:
        JFrame active = UiUtils.getActiveFrame();
        if (active != null) {
            active.toFront();
        }
        KongaCommandResult result = new KongaCommandResult(SocketLock.TO_FRONT);
        result.addReturnValue("OK");
        return result;
    }
View Full Code Here


    class GetStatusHandler implements CommandHandler {

        @Override
        public CommandResult handleCommand(Command command) {
            KongaCommandResult result = new KongaCommandResult(command.getCommandName());

            int nArgs = command.getArguments().size();
            if (nArgs != 1) {
                result.addReturnValue(Integer.toString(KongaModuleStatusBitFields.rsERROR));
                result.addReturnValue("Internal Error: Too many arguments for the GetStatus command.");
                return result;
            }

            String cmd = command.getArguments().iterator().next();
            int responseLevel = 0;
            try {
                responseLevel = Integer.parseInt(cmd);
                if (responseLevel < -1 || responseLevel > 1)
                    responseLevel = 0;
            } catch (NumberFormatException e) {
                e.printStackTrace();
                result.addReturnValue(Integer.toString(KongaModuleStatusBitFields.rsERROR));
                result.addReturnValue("Internal Error: Invalid status level " + cmd);
                return result;
            }

            long status = KongaModuleStatusBitFields.rsSTOPPED;
            if (messageRouter != null) {
                status = messageRouter.getStatus();
            }

            String msg = "The JMS Engine is ";
            if ((status & KongaModuleStatusBitFields.rsSTARTING) != 0)
                msg += "starting";
            else if ((status & KongaModuleStatusBitFields.rsSTOPPING) != 0)
                msg += "stopping";
            else if ((status & KongaModuleStatusBitFields.rsRUNNING) != 0)
                msg += "running";
            else if ((status & KongaModuleStatusBitFields.rsSTOPPED) != 0)
                msg += "stopped";
            else if ((status & KongaModuleStatusBitFields.rsUNREACHABLE) != 0)
                msg += "unreachable";
            msg += ".";

            if (responseLevel == 1) {
                // TODO: Add "normal" level of information.
            }
            if (responseLevel == -1) {
                // TODO: Add a longer status message
                // Any more info we could send?
                // Last 5 received/sent message times?
                // Total time running?
            }

            result.addReturnValue(Long.toString(status));
            result.addReturnValue(msg);
            return result;
        }
View Full Code Here

    private class StartHandler implements CommandHandler {

        @Override
        public CommandResult handleCommand(Command command) {
            KongaCommandResult result = new KongaCommandResult(command.getCommandName());

            if (messageRouter == null) {
                messageRouter = new MessageRouter(new JmsOperationQueuer(false));
            }
            try {
View Full Code Here

    private class StopHandler implements CommandHandler {

        @Override
        public CommandResult handleCommand(Command command) {
            KongaCommandResult result = new KongaCommandResult(command.getCommandName());
            if (messageRouter != null) {
                messageRouter.stop();
            }
            return result;
        }
View Full Code Here

    private class ShutdownHandler implements CommandHandler {

        @Override
        public CommandResult handleCommand(Command command) {
            KongaCommandResult result = new KongaCommandResult(command.getCommandName());
            try {
                if (commandListener != null) {
                    commandListener.stopListening();
                }
            } catch (IOException e) {
View Full Code Here

    private class UpdateHandler implements CommandHandler {

        @Override
        public CommandResult handleCommand(Command command) {
            KongaCommandResult result = new KongaCommandResult(command.getCommandName());
            try {
                if (messageRouter != null) {
                    messageRouter.update();
                }
            } catch (JmsServerException e) {
View Full Code Here

    private class CheckOutgoingHandler implements CommandHandler {

        @Override
        public CommandResult handleCommand(Command command) {
            KongaCommandResult result = new KongaCommandResult(command.getCommandName());
            if (messageRouter != null) {
                messageRouter.checkOutgoing();
            }
            return result;
        }
View Full Code Here

    private static class TestConnectionHandler implements CommandHandler {

        @Override
        public CommandResult handleCommand(Command command) {
            KongaCommandResult result = new KongaCommandResult(command.getCommandName());
            try {
                LocationProperties connectivityProps = new LocationProperties();
                boolean isKey = true;
                String key = "";
                for (String s : command.getArguments()) {
                    if (isKey) {
                        key = s;
                    } else {
                        connectivityProps.addProperty(key, s);
                    }
                    isKey = !isKey;
                }
                ConnectionTester.testConnection(connectivityProps);
                result.addReturnValue("true");
            } catch (Throwable e) {
                result.setException(e);
                e.printStackTrace();
            }
            return result;
        }
View Full Code Here

TOP

Related Classes of org.jitterbit.util.kongaprotocol.KongaCommandResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.