public class BackendManager extends Object implements AgentDetailsHolder
JmxRequest
Constructor and Description |
---|
BackendManager(Configuration pConfig,
LogHandler pLogHandler)
Construct a new backend manager with the given configuration and which allows
every operation (no restrictor)
|
BackendManager(Configuration pConfig,
LogHandler pLogHandler,
Restrictor pRestrictor)
Construct a new backend manager with the given configuration.
|
BackendManager(Configuration pConfig,
LogHandler pLogHandler,
Restrictor pRestrictor,
boolean pLazy)
Construct a new backend manager with the given configuration.
|
Modifier and Type | Method and Description |
---|---|
Object |
convertExceptionToJson(Throwable pExp,
JmxRequest pJmxReq)
Convert a Throwable to a JSON object so that it can be included in an error response
|
void |
debug(String msg)
Log at debug level
|
void |
destroy()
Remove MBeans
|
void |
error(String message,
Throwable t)
Log at error level.
|
AgentDetails |
getAgentDetails()
Get the details for the agent which can be updated or used
|
org.json.simple.JSONObject |
handleRequest(JmxRequest pJmxReq)
Handle a single JMXRequest.
|
void |
info(String msg)
Log at info level
|
boolean |
isDebug()
Whether debug is switched on
|
boolean |
isOriginAllowed(String pOrigin,
boolean pOnlyWhenStrictCheckingIsEnabled)
Check whether CORS access is allowed for the given origin.
|
boolean |
isRemoteAccessAllowed(String pRemoteHost,
String pRemoteAddr)
Check whether remote access from the given client is allowed.
|
public BackendManager(Configuration pConfig, LogHandler pLogHandler)
pConfig
- configuration used for tuning this handler's behaviourpLogHandler
- loggerpublic BackendManager(Configuration pConfig, LogHandler pLogHandler, Restrictor pRestrictor)
pConfig
- configuration used for tuning this handler's behaviourpLogHandler
- loggerpRestrictor
- a restrictor for limiting access. Can be null in which case every operation is allowedpublic BackendManager(Configuration pConfig, LogHandler pLogHandler, Restrictor pRestrictor, boolean pLazy)
pConfig
- configuration map used for tuning this handler's behaviourpLogHandler
- loggerpRestrictor
- a restrictor for limiting access. Can be null in which case every operation is allowedpLazy
- whether the initialisation should be done lazypublic org.json.simple.JSONObject handleRequest(JmxRequest pJmxReq) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException
pJmxReq
- request to performInstanceNotFoundException
AttributeNotFoundException
ReflectionException
MBeanException
IOException
public Object convertExceptionToJson(Throwable pExp, JmxRequest pJmxReq)
pExp
- throwable to convertpJmxReq
- the request from where to take the serialization optionspublic void destroy()
public boolean isRemoteAccessAllowed(String pRemoteHost, String pRemoteAddr)
pRemoteHost
- remote host to check against. Can be null if no reverse lookup is configured.pRemoteAddr
- alternative IP addresspublic boolean isOriginAllowed(String pOrigin, boolean pOnlyWhenStrictCheckingIsEnabled)
pOrigin
- origin URL which needs to be checked. Can be null.pOnlyWhenStrictCheckingIsEnabled
- whether do the check only when strict-checking is enabled.
If true an no strict-checking is configured then always allow.public void info(String msg)
msg
- to logpublic void debug(String msg)
msg
- message to logpublic void error(String message, Throwable t)
message
- message to logt
- ecxeption occuredpublic boolean isDebug()
public AgentDetails getAgentDetails()
getAgentDetails
in interface AgentDetailsHolder
Copyright © 2021. All rights reserved.