public class JsonControlService extends java.lang.Object implements ControlService
controlRequest(JsonObject)
to invoke a control
operation (method) on a registered MBean.Format of control request operation
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALIAS_KEY
Key for the alias of the control MBean in a JSON request.
|
static java.lang.String |
ARGS_KEY
Key for the argument list.
|
static java.lang.String |
OP_KEY
Key for the operation name.
|
static java.lang.String |
TYPE_KEY
Key for the type of the control MBean in a JSON request.
|
Constructor and Description |
---|
JsonControlService() |
Modifier and Type | Method and Description |
---|---|
com.google.gson.JsonElement |
controlRequest(com.google.gson.JsonObject request)
Handle a JSON control request.
|
<T> T |
getControl(java.lang.String type,
java.lang.String alias,
java.lang.Class<T> controlInterface)
Return a control Mbean registered with this service.
|
<T> java.lang.String |
getControlId(java.lang.String type,
java.lang.String alias,
java.lang.Class<T> controlInterface)
Return the unique identifier for a control Mbean registered with
this service.
|
<T> java.lang.String |
registerControl(java.lang.String type,
java.lang.String id,
java.lang.String alias,
java.lang.Class<T> controlInterface,
T control)
Register a control MBean.
|
void |
unregister(java.lang.String controlId)
Unregister a control bean registered by
ControlService.registerControl(String, String, String, Class, Object) |
public static final java.lang.String TYPE_KEY
public static final java.lang.String ALIAS_KEY
public static final java.lang.String OP_KEY
public static final java.lang.String ARGS_KEY
public com.google.gson.JsonElement controlRequest(com.google.gson.JsonObject request) throws java.lang.Exception
request
- the requestjava.lang.Exception
- on failurepublic <T> java.lang.String registerControl(java.lang.String type, java.lang.String id, java.lang.String alias, java.lang.Class<T> controlInterface, T control)
All control service MBeans must be valid according
to Controls.isControlServiceMBean(Class)
.
registerControl
in interface ControlService
T
- Control MBean typetype
- Type of the control MBean.id
- Unique identifier for the control MBean.alias
- Alias for the control MBean. Required to be unique within the context
of type
.controlInterface
- Public interface for the control MBean.control
- The control MBeanControls.isControlServiceMBean(Class)
public void unregister(java.lang.String controlId)
ControlService.registerControl(String, String, String, Class, Object)
unregister
in interface ControlService
controlId
- control's registration identifier returned by registerControl
public <T> T getControl(java.lang.String type, java.lang.String alias, java.lang.Class<T> controlInterface)
ControlService
getControl
in interface ControlService
T
- Control MBean typetype
- Type of the control MBean.alias
- Alias for the control MBean.controlInterface
- Public interface of the control MBean.public <T> java.lang.String getControlId(java.lang.String type, java.lang.String alias, java.lang.Class<T> controlInterface)
ControlService
getControlId
in interface ControlService
T
- Control MBean typetype
- Type of the control MBean.alias
- Alias for the control MBean.controlInterface
- Public interface of the control MBean.Copyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641