org.rhq.enterprise.communications.command.server
Class CommandProcessor

java.lang.Object
  extended by org.rhq.enterprise.communications.command.server.CommandProcessor
All Implemented Interfaces:
org.jboss.remoting.ServerInvocationHandler, org.jboss.remoting.stream.StreamInvocationHandler

public class CommandProcessor
extends Object
implements org.jboss.remoting.stream.StreamInvocationHandler

Handles invoked commands from remote clients.

This server invocation handler will delegate the actual execution of the commands to command services located in the same MBeanServer as this handler.

When this handler is given an invocation request, it determines the ObjectName of the command service to delegate to by:

  1. Using the handler's subsystem as the name of the command service's subsystem
  2. Passing the subsystem and command type to the directory which looks up the command service that provides the command and returns its name

This handler will delegate the command to that service's execute method and will return its return value as-is back to this invocation handler's client.

Author:
John Mazzitelli

Constructor Summary
CommandProcessor()
          Constructor for CommandProcessor.
 
Method Summary
 void addCommandListener(CommandListener listener)
          Adds the given listener to this object's list of command listeners.
 void addListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
           
 CommandProcessorMetrics getCommandProcessorMetrics()
          Returns the metrics object which contains all statistics for the command processor.
 Object handleStream(InputStream in, org.jboss.remoting.InvocationRequest invocation)
          Handles incoming stream data from a client request that used the JBoss/Remoting streaming API.
 Object invoke(org.jboss.remoting.InvocationRequest invocation)
          Invokes the Command that is found in the invocation parameter.
 void removeCommandListener(CommandListener listener)
          Removes the given listener from this object's list of command listeners.
 void removeListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
           
 void setCommandAuthenticator(CommandAuthenticator authenticator)
          Sets the object that will perform the security checks necessary to authenticate incoming commands.
 void setInvoker(org.jboss.remoting.ServerInvoker invoker)
           
 void setMBeanServer(MBeanServer mbs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.remoting.ServerInvocationHandler
toString
 

Constructor Detail

CommandProcessor

public CommandProcessor()
Constructor for CommandProcessor.

Method Detail

setMBeanServer

public void setMBeanServer(MBeanServer mbs)
Specified by:
setMBeanServer in interface org.jboss.remoting.ServerInvocationHandler
See Also:
ServerInvocationHandler.setMBeanServer(javax.management.MBeanServer)

setInvoker

public void setInvoker(org.jboss.remoting.ServerInvoker invoker)
Specified by:
setInvoker in interface org.jboss.remoting.ServerInvocationHandler
See Also:
ServerInvocationHandler.setInvoker(org.jboss.remoting.ServerInvoker)

setCommandAuthenticator

public void setCommandAuthenticator(CommandAuthenticator authenticator)
Sets the object that will perform the security checks necessary to authenticate incoming commands. If null, no security checks will be performed and all commands will be considered authenticated.

Parameters:
authenticator - the object to perform authentication checks on all incoming commands

addCommandListener

public void addCommandListener(CommandListener listener)
Adds the given listener to this object's list of command listeners. This listener will be called each and every time a new command has been received by this object.

Parameters:
listener -

removeCommandListener

public void removeCommandListener(CommandListener listener)
Removes the given listener from this object's list of command listeners. This listener will no longer be called when commands are received by this object.

Parameters:
listener -

getCommandProcessorMetrics

public CommandProcessorMetrics getCommandProcessorMetrics()
Returns the metrics object which contains all statistics for the command processor.

Returns:
the object containing all the metric data - this is the live object and will be updated as more data is collected

invoke

public Object invoke(org.jboss.remoting.InvocationRequest invocation)
              throws Throwable
Invokes the Command that is found in the invocation parameter. Note that the subsystem being invoked must be the subsystem where the command service to be invoked is registered.

Specified by:
invoke in interface org.jboss.remoting.ServerInvocationHandler
Throws:
Throwable
See Also:
ServerInvocationHandler.invoke(org.jboss.remoting.InvocationRequest)

handleStream

public Object handleStream(InputStream in,
                           org.jboss.remoting.InvocationRequest invocation)
                    throws Throwable
Handles incoming stream data from a client request that used the JBoss/Remoting streaming API.

Specified by:
handleStream in interface org.jboss.remoting.stream.StreamInvocationHandler
Throws:
Throwable
See Also:
StreamInvocationHandler.handleStream(InputStream, InvocationRequest)

addListener

public void addListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
Specified by:
addListener in interface org.jboss.remoting.ServerInvocationHandler
See Also:
ServerInvocationHandler.addListener(InvokerCallbackHandler)

removeListener

public void removeListener(org.jboss.remoting.callback.InvokerCallbackHandler callbackHandler)
Specified by:
removeListener in interface org.jboss.remoting.ServerInvocationHandler
See Also:
ServerInvocationHandler.removeListener(InvokerCallbackHandler)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.