Class ExecHandler

java.lang.Object
org.jolokia.service.jmx.handler.AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
org.jolokia.service.jmx.handler.ExecHandler
All Implemented Interfaces:
CommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>

public class ExecHandler extends AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
Handler for dealing with execute requests.
Since:
Jun 12, 2009
Author:
roland
  • Constructor Details

    • ExecHandler

      public ExecHandler()
  • Method Details

    • getType

      public org.jolokia.server.core.util.RequestType getType()
      Description copied from interface: CommandHandler
      The type of request which can be handled
      Returns:
      the request type of this handler
    • checkForRestriction

      protected void checkForRestriction(org.jolokia.server.core.request.JolokiaExecRequest pRequest)
      Description copied from class: AbstractCommandHandler
      Check whether there is a restriction on the type to apply. This method should be overwritten by specific handlers if they support a more sophisticated check than only for the type
      Specified by:
      checkForRestriction in class AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
      Parameters:
      pRequest - request to check
    • handleAllServersAtOnce

      public boolean handleAllServersAtOnce(org.jolokia.server.core.request.JolokiaExecRequest pRequest)
      EXEC may be performed on multiple objects if they match the ObjectName pattern - similar to READ requests
      Specified by:
      handleAllServersAtOnce in interface CommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
      Overrides:
      handleAllServersAtOnce in class AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
      Parameters:
      pRequest -
      Returns:
    • doHandleSingleServerRequest

      public Object doHandleSingleServerRequest(MBeanServerConnection server, org.jolokia.server.core.request.JolokiaExecRequest request) throws IOException, JMException, org.jolokia.server.core.request.BadRequestException
      Execute an JMX operation on a single MBean. The operation name is taken from the request, as well as the arguments to use. If the operation is given in the format "op(type1,type2,...)" (e.g "getText(java.lang.String,int)" then the argument types are taken into account as well. This way, overloaded JMX operation can be used. If an overloaded JMX operation is called without specifying the argument types, then an exception is thrown.
      Specified by:
      doHandleSingleServerRequest in class AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
      Parameters:
      server - server to try
      request - request to process from where the operation and its arguments are extracted.
      Returns:
      the return value of the operation call
      Throws:
      IOException - when there's an error invoking MBeanServerConnection
      JMException - JMX checked exception, because most requests are handled by dealing with MBeans
      org.jolokia.server.core.request.BadRequestException - because some commands do more user input parsing in addition to what was checked when the JolokiaRequest was created
    • doHandleAllServerRequest

      public Object doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess jmxAccess, org.jolokia.server.core.request.JolokiaExecRequest pRequest, Object pPreviousResult) throws JMException, org.jolokia.server.core.request.BadRequestException, IOException
      Description copied from class: AbstractCommandHandler
      Default implementation for handling a request for multiple servers at once. A subclass, which returns, true from AbstractCommandHandler.handleAllServersAtOnce(JolokiaRequest), needs to override this method. If AbstractCommandHandler.handleAllServersAtOnce(JolokiaRequest) returns false, the iteration over available connections is performed by the caller (RequestHandler).
      Overrides:
      doHandleAllServerRequest in class AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
      Parameters:
      jmxAccess - all MBean servers found in this JVM
      pRequest - the original request
      pPreviousResult - a previous result which for merging requests can be used to merge the data
      Returns:
      the result of the the request.
      Throws:
      JMException - JMX checked exception, because most requests are handled by dealing with MBeans
      org.jolokia.server.core.request.BadRequestException - because some commands do more user input parsing in addition to what was checked when the JolokiaRequest was created
      IOException - when there's an error invoking MBeanServerConnection