Package org.rhq.enterprise.communications.command

Examples of org.rhq.enterprise.communications.command.Command


            config.defaultTimeoutMillis = 4000L;
            sender = new ClientCommandSender(comm, config);
            sender.startSending();

            // sanity check - make sure we can call it
            Command cmd = createNewCommand("hello");
            assert sender.sendSynch(cmd).getResults().toString().equals("hello");

            // try to send a command that can never make it - we should never retry this one
            cmd = createNewCommand(new NotSerializable());
            TestCommandResponseCallback callback = new TestCommandResponseCallback();
View Full Code Here


     *
     * @see    #invoke(InvocationRequest)
     * @see    #handleStream(InputStream, InvocationRequest)
     */
    private Object handleIncomingInvocationRequest(InputStream in, InvocationRequest invocation) {
        Command cmd = null;
        CommandResponse ret_response = null;

        long elapsed = 0L; // will be the time in ms that it took to invoked the command service if we did invoke it

        try {
            // get the subsystem - find the command service in this subsystem that will execute our command
            String subsystem = invocation.getSubsystem();

            // get the Command the client wants to execute
            cmd = (Command) invocation.getParameter();
            IncomingCommandTrace.start(cmd);

            if (cmd != null) {
                notifyListenersOfReceivedCommand(cmd);

                // make sure the command is authenticated; if it is not, return immediately without further processing the command
                if (m_authenticator != null) {
                    if (!m_authenticator.isAuthenticated(cmd)) {
                        // We don't want to flood the logs with authentication errors if the command is
                        // the identify command since that is expected to fail when attempting to auto-detect
                        // servers that we aren't yet authorized to talk to yet. So we only log a warn
                        // and we only increment our getNumberFailedCommands counter if its not an identify command.
                        if ((cmd.getCommandType() == null)
                            || !cmd.getCommandType().getName().equals(IdentifyCommand.COMMAND_TYPE.getName())) {
                            LOG.warn(CommI18NResourceKeys.COMMAND_PROCESSOR_FAILED_AUTHENTICATION, cmd);
                            m_metrics.numberFailedCommands++;
                        }

                        String err = LOG
                            .getMsgString(CommI18NResourceKeys.COMMAND_PROCESSOR_FAILED_AUTHENTICATION, cmd);
                        ret_response = new GenericCommandResponse(null, false, null, new AuthenticationException(err));

                        notifyListenersOfProcessedCommand(cmd, ret_response);

                        return ret_response;
                    }
                }

                // get the command's type
                CommandType cmdType = cmd.getCommandType();

                // ask the directory what command service supports the command we want to execute
                CommandServiceDirectoryEntry entry = null;
                ObjectName cmdServiceName = null;

View Full Code Here

TOP

Related Classes of org.rhq.enterprise.communications.command.Command

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.