public abstract class JsonRequestHandler<R extends JmxRequest> extends Object
Modifier | Constructor and Description |
---|---|
protected |
JsonRequestHandler(Restrictor pRestrictor) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkForModifiedSince(MBeanServerExecutor pServerManager,
JmxRequest pRequest)
Check, whether the set of MBeans for any managed MBeanServer has been change since the timestamp
provided in the given request
|
protected abstract void |
checkForRestriction(R pRequest)
Check whether there is a restriction on the type to apply.
|
protected void |
checkType()
Check whether a command of the given type is allowed
|
protected abstract Object |
doHandleRequest(MBeanServerConnection server,
R request)
Abstract method to be subclassed by a concrete handler for performing the
request.
|
Object |
doHandleRequest(MBeanServerExecutor serverManager,
R request)
Default implementation fo handling a request for multiple servers at once.
|
protected Restrictor |
getRestrictor()
Get the restrictor which is currently active
|
abstract RequestType |
getType()
The type of request which can be served by this handler
|
boolean |
handleAllServersAtOnce(R pRequest)
Override this if you want all servers as list in the argument, e.g.
|
Object |
handleRequest(MBeanServerConnection pServer,
R pRequest)
Handle a request for a single server and throw an
InstanceNotFoundException
if the request cannot be handle by the provided server. |
Object |
handleRequest(MBeanServerExecutor pServerManager,
R request)
Override this if you want to have all servers at once for processing the request
(like need for merging info as for a
list command). |
boolean |
useReturnValueWithPath()
Use the path for the return value by default
|
protected JsonRequestHandler(Restrictor pRestrictor)
public abstract RequestType getType()
public boolean handleAllServersAtOnce(R pRequest)
pRequest
- request to decide on whether to handle all request at oncedoHandleRequest(MBeanServerConnection, JmxRequest)
(false
) or
doHandleRequest(MBeanServerExecutor, JmxRequest)
(true
) called.public Object handleRequest(MBeanServerConnection pServer, R pRequest) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException
InstanceNotFoundException
if the request cannot be handle by the provided server.
Does a check for restrictions as wellpServer
- server to trypRequest
- request to processInstanceNotFoundException
- if the provided server cant handle the requestAttributeNotFoundException
ReflectionException
MBeanException
IOException
NotChangedException
protected abstract void checkForRestriction(R pRequest)
pRequest
- request to checkprotected void checkType()
protected abstract Object doHandleRequest(MBeanServerConnection server, R request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException
server
- server to tryrequest
- request to processInstanceNotFoundException
AttributeNotFoundException
ReflectionException
MBeanException
IOException
NotChangedException
public Object handleRequest(MBeanServerExecutor pServerManager, R request) throws ReflectionException, InstanceNotFoundException, MBeanException, AttributeNotFoundException, IOException, NotChangedException
list
command). This method
is only called when handleAllServersAtOnce(JmxRequest)
returns true
pServerManager
- server manager holding all MBeans servers detectedrequest
- request to processIOException
AttributeNotFoundException
InstanceNotFoundException
MBeanException
ReflectionException
NotChangedException
public Object doHandleRequest(MBeanServerExecutor serverManager, R request) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException, NotChangedException
true
on handleAllServersAtOnce(JmxRequest)
, needs to override this method.serverManager
- all MBean servers found in this JVMrequest
- the original requestIOException
AttributeNotFoundException
InstanceNotFoundException
MBeanException
ReflectionException
NotChangedException
public boolean useReturnValueWithPath()
protected Restrictor getRestrictor()
protected void checkForModifiedSince(MBeanServerExecutor pServerManager, JmxRequest pRequest) throws NotChangedException
pServerManager
- manager for all MBeanServerspRequest
- the request from where to fetch the timestampNotChangedException
- if there has been no REGISTER/UNREGISTER notifications in the meantimeCopyright © 2017. All rights reserved.