Class ListHandler

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

public class ListHandler extends AbstractCommandHandler<org.jolokia.server.core.request.JolokiaListRequest>
Handler for obtaining a list of all available MBeans and its attributes and operations (to get JSON representations of MBeanInfo).
Since:
Jun 12, 2009
Author:
roland
  • Constructor Details

    • ListHandler

      public ListHandler()
  • 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
    • init

      public void init(org.jolokia.server.core.service.api.JolokiaContext pContext, String pProvider)
      Description copied from interface: CommandHandler
      Lifecycle method in order to initialize the handler
      Specified by:
      init in interface CommandHandler<org.jolokia.server.core.request.JolokiaListRequest>
      Overrides:
      init in class AbstractCommandHandler<org.jolokia.server.core.request.JolokiaListRequest>
      Parameters:
      pContext - the jolokia context
      pProvider - provider to use for returned names. Handlers can use this for returning meta data with the proper provider prefixed.
    • checkForRestriction

      protected void checkForRestriction(org.jolokia.server.core.request.JolokiaListRequest 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.JolokiaListRequest>
      Parameters:
      pRequest - request to check
    • handleAllServersAtOnce

      public boolean handleAllServersAtOnce(org.jolokia.server.core.request.JolokiaListRequest pRequest)
      Return true since a list handler needs to merge all information from all available servers and we want to do it manually
      Specified by:
      handleAllServersAtOnce in interface CommandHandler<org.jolokia.server.core.request.JolokiaListRequest>
      Overrides:
      handleAllServersAtOnce in class AbstractCommandHandler<org.jolokia.server.core.request.JolokiaListRequest>
      Parameters:
      pRequest - request to decide on whether to handle all request at once
      Returns:
      always true
    • doHandleSingleServerRequest

      public Object doHandleSingleServerRequest(MBeanServerConnection server, org.jolokia.server.core.request.JolokiaListRequest request)
      Description copied from class: AbstractCommandHandler
      Abstract method to be subclassed by a concrete handler for performing the request on a single MBeanServerConnection after the checks are performed. Subclasses should only implement the command logic.
      Specified by:
      doHandleSingleServerRequest in class AbstractCommandHandler<org.jolokia.server.core.request.JolokiaListRequest>
      Parameters:
      server - server to try
      request - request to process
      Returns:
      the object result from the request
    • doHandleAllServerRequest

      public Object doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess pServerManager, org.jolokia.server.core.request.JolokiaListRequest pRequest, Object pPreviousResult) throws IOException, JMException, org.jolokia.server.core.request.BadRequestException, org.jolokia.server.core.request.NotChangedException
      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.JolokiaListRequest>
      Parameters:
      pServerManager - 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:
      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
      org.jolokia.server.core.request.NotChangedException - when (according to request parameters) user wants HTTP 304 if nothing has changed