Interface CommandHandler<R extends org.jolokia.server.core.request.JolokiaRequest>
- All Known Implementing Classes:
AbstractCommandHandler,ExecHandler,ListHandler,NotificationHandler,ReadHandler,SearchHandler,WriteHandler
public interface CommandHandler<R extends org.jolokia.server.core.request.JolokiaRequest>
- Since:
- 09.03.14
- Author:
- roland
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Lifecycle method called when agent goes down.org.jolokia.server.core.util.RequestTypegetType()The type of request which can be served by this handlerhandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess pServerManager, R request, Object pPreviousResult) Override this if you want to have all servers at once for processing the request (like need for merging info as for alistcommand).booleanhandleAllServersAtOnce(R pRequest) Override this if you want all servers as list in the argument, e.g.handleSingleServerRequest(MBeanServerConnection pServer, R pRequest) Handle a request for a single server and throw anInstanceNotFoundExceptionif the request cannot be handle by the provided server.voidLifecycle method in order to initialize the handler
-
Method Details
-
getType
org.jolokia.server.core.util.RequestType getType()The type of request which can be served by this handler- Returns:
- the request typ of this handler
-
handleAllServersAtOnce
Override this if you want all servers as list in the argument, e.g. to query each server on your own. By default, dispatching of the servers are done for you- Parameters:
pRequest- request to decide on whether to handle all request at once- Returns:
- whether you want to have
handleSingleServerRequest(MBeanServerConnection, JolokiaRequest)(false) orhandleAllServerRequest(MBeanServerAccess, JolokiaRequest, Object)(true) called.
-
handleSingleServerRequest
Object handleSingleServerRequest(MBeanServerConnection pServer, R pRequest) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, org.jolokia.server.core.request.NotChangedException, org.jolokia.server.core.request.EmptyResponseException Handle a request for a single server and throw anInstanceNotFoundExceptionif the request cannot be handle by the provided server. Does a check for restrictions as well- Parameters:
pServer- server to trypRequest- request to process- Returns:
- the object result from the request
- Throws:
InstanceNotFoundException- if the provided server cant handle the requestAttributeNotFoundExceptionReflectionExceptionMBeanExceptionIOExceptionorg.jolokia.server.core.request.NotChangedExceptionorg.jolokia.server.core.request.EmptyResponseException
-
handleAllServerRequest
Object handleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess pServerManager, R request, Object pPreviousResult) throws ReflectionException, InstanceNotFoundException, MBeanException, AttributeNotFoundException, IOException, org.jolokia.server.core.request.NotChangedException, org.jolokia.server.core.request.EmptyResponseException Override this if you want to have all servers at once for processing the request (like need for merging info as for alistcommand). This method is only called whenhandleAllServersAtOnce(JolokiaRequest)returnstrue- Parameters:
pServerManager- server manager holding all MBeans servers detectedrequest- request to processpPreviousResult- a previous result which for merging requests can be used to merge files- Returns:
- the object found
- Throws:
IOExceptionAttributeNotFoundExceptionInstanceNotFoundExceptionMBeanExceptionReflectionExceptionorg.jolokia.server.core.request.NotChangedExceptionorg.jolokia.server.core.request.EmptyResponseException
-
init
Lifecycle method in order to initialize the handler- Parameters:
pContext- the jolokia contextpProvider- provider to use for returned names. Handlers can use this for returning meta data with the proper provider prefixed.
-
destroy
Lifecycle method called when agent goes down. Should be overridden by a handler if required.- Throws:
JMException
-