Package org.jolokia.service.jmx.handler
Class ReadHandler
java.lang.Object
org.jolokia.service.jmx.handler.AbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>
org.jolokia.service.jmx.handler.ReadHandler
- All Implemented Interfaces:
CommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>
public class ReadHandler
extends AbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>
Handler for managing READ requests for reading attributes.
- Since:
- Jun 12, 2009
- Author:
- roland
-
Field Summary
Fields inherited from class org.jolokia.service.jmx.handler.AbstractCommandHandler
context, pProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckForRestriction(org.jolokia.server.core.request.JolokiaReadRequest pRequest) We override it here with a noop since we do a more fine grained check during processing of the request.doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess pServerManager, org.jolokia.server.core.request.JolokiaReadRequest pRequest, Object pPreviousResult) Default implementation fo handling a request for multiple servers at once.doHandleSingleServerRequest(MBeanServerConnection pServer, org.jolokia.server.core.request.JolokiaReadRequest pRequest) Used for a request to a single attribute from a single MBean.org.jolokia.server.core.util.RequestTypegetType()The type of request which can be served by this handlerbooleanhandleAllServersAtOnce(org.jolokia.server.core.request.JolokiaReadRequest pRequest) For a simple requests (one MBean, one attribute) we let the dispatching of the servers done by the upper level.Methods inherited from class org.jolokia.service.jmx.handler.AbstractCommandHandler
checkForModifiedSince, checkType, destroy, handleAllServerRequest, handleSingleServerRequest, init, isObjectNameHidden
-
Constructor Details
-
ReadHandler
public ReadHandler()
-
-
Method Details
-
getType
public 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
public boolean handleAllServersAtOnce(org.jolokia.server.core.request.JolokiaReadRequest pRequest) For a simple requests (one MBean, one attribute) we let the dispatching of the servers done by the upper level. If the request is for an MBean pattern or multiple attributes are required, we try multiple requests for multiple server.- Specified by:
handleAllServersAtOncein interfaceCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Overrides:
handleAllServersAtOncein classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Parameters:
pRequest- request to decide on whether to handle all request at once- Returns:
- true if this is a multi attribute request, has an MBean pattern to look for or is a request for all attributes.
-
doHandleSingleServerRequest
public Object doHandleSingleServerRequest(MBeanServerConnection pServer, org.jolokia.server.core.request.JolokiaReadRequest pRequest) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException Used for a request to a single attribute from a single MBean. Merging of MBeanServers is done one layer above.- Specified by:
doHandleSingleServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Parameters:
pServer- server on which to request the attributepRequest- the request itself.- Returns:
- the attribute's value
- Throws:
InstanceNotFoundExceptionAttributeNotFoundExceptionReflectionExceptionMBeanExceptionIOException
-
doHandleAllServerRequest
public Object doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess pServerManager, org.jolokia.server.core.request.JolokiaReadRequest pRequest, Object pPreviousResult) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException Default implementation fo handling a request for multiple servers at once. A subclass, which returns,trueonAbstractCommandHandler.handleAllServersAtOnce(JolokiaRequest), needs to override this method.- Overrides:
doHandleAllServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Parameters:
pServerManager- all MBean servers found in this JVMpRequest- the original requestpPreviousResult- a previous result which for merging requests can be used to merge files- Returns:
- the result of the the request.
- Throws:
InstanceNotFoundExceptionAttributeNotFoundExceptionReflectionExceptionMBeanExceptionIOException
-
checkForRestriction
protected void checkForRestriction(org.jolokia.server.core.request.JolokiaReadRequest pRequest) We override it here with a noop since we do a more fine grained check during processing of the request.- Specified by:
checkForRestrictionin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Parameters:
pRequest- request to check
-