Various sub-interfaces offer additional functionality, such as explicit methods for getting
children of a particular type, creating new children (eg configuration), attribute getter/setter
methods, etc. The most notable sub-interface is AMXConfigProxy and
its sub-interfaces.
Implementing handler— an AMXProxy is implemented by AMXProxyHandler, but the handler should be considered
private: do not use it as it is subject to change.
Sub interfaces— the base AMXProxy interface can and should be extended for specific MBeans, but in most cases it will not be appropriate or convenient for MBean implementors to 'implement' the interface because it is for use by a proxy to the MBean, not the MBean itself. In particular, it makes no sense for an MBean to implement the proxy interface because the proxy interface demands the use of AMXProxy and sub-types, whereas the MBean must return ObjectName.
Method name convention— a convention followed in AMXProxy is that convenience "getter" methods
(non-remote methods implemented directly by the proxy itself) do not use the get prefix,
in order to distinguish them from the usual getter pattern for real MBean attributes.
For example, parent() returns an AMXProxy, but AMX_SPI.getParent() returns the value of the
Parent attribute (an ObjectName).
The same convention is followed for childrenSet(), etc / AMX_SPI.getChildren().
Not authoritative— proxy interfaces should not be considered authoritative, meaning that an underlying MBean
implementation determines what the MBean actually provides, possibly ignoring
the proxy interface (this is the case with config MBeans, which derive their metadata from the ConfigBean
@Configured interface).
Therefore, it is possible for the proxy interface to completely misrepresent the actual MBean functionality,
should the interface get out of sync with the actual MBean.
Only at runtime would errors between the interface and the MBean would emerge.
Methods in sub-interfaces of AMXProxy— To mininimize issues with tracking
implementation changes over time (eg addition or removal of attributes),
sub-interfaces of AMXProxy might choose to omit
getter/setter methods for attributes, and instead manifest the containment relationships (children),
which form the core of usability of navigating the hierarchy.
The methods attributeNames() and attributesMap() can be used to generically
obtain all available attributes, and of course MetaGetters.mbeanInfo() provides extensive metadata.
Auto-mapping of ObjectName— An AMXProxy automatically maps various ObjectName constructs to the equivalent AMXProxy(ies).
For example, an MBean providing an Attribute named Item
should declare it as an ObjectName, or for a plurality Items, declaring an ObjectName[].
Any of the following proxy methods (declared in a sub-interface of AMXProxy) will automatically convert the resulting
ObjectName(s) into the corresponding AMXProxy or plurality of AMXProxy:
AMXProxy getItem(); AMXProxy[] getItems(); Set<AMXProxy> getItems(); List<AMXProxy> getItems(); Map<String,AMXProxy> getItems();The same approach is used in the generic
child(java.lang.String), childrenSet(), childrenMap(java.lang.String) methods.
Invoking operations generically— Use the invokeOp(java.lang.String) methods to invoke an arbitrary
operation by name.
@Taxonomy(stability=UNCOMMITTED) @Deprecated public interface AMXProxy extends AMX_SPI
Extra,
MetaGetters,
AMXConfigProxy| Modifier and Type | Method and Description |
|---|---|
<T extends AMXProxy> |
as(Class<T> intf)
Deprecated.
Return a proxy implementing the specified interface.
|
Set<String> |
attributeNames()
Deprecated.
Get all available Attributes names, no trip to server needed.
|
Map<String,Object> |
attributesMap()
Deprecated.
Get a Map keyed by Attribute name of all Attribute values.
|
Map<String,Object> |
attributesMap(Set<String> attrNames)
Deprecated.
Get a Map keyed by Attribute name of the specified Attribute values.
|
<T extends AMXProxy> |
child(Class<T> intf)
Deprecated.
Get a singleton child.
|
AMXProxy |
child(String type)
Deprecated.
Get a singleton child of the specified type.
|
<T extends AMXProxy> |
childrenMap(Class<T> intf)
Deprecated.
Get all children of the same type.
|
Map<String,AMXProxy> |
childrenMap(String type)
Deprecated.
Get all children of a specified type, keyed by the name as found in the ObjectName.
|
Map<String,Map<String,AMXProxy>> |
childrenMaps()
Deprecated.
Get Maps keyed by type, with a Map keyed by name.
|
Set<AMXProxy> |
childrenSet()
Deprecated.
Get all existing children of all types.
|
Extra |
extra()
Deprecated.
additional capabilities, including direct JMX access
|
Object |
invokeOp(String operationName)
Deprecated.
Invoke an operation by name, no arguments.
|
Object |
invokeOp(String operationName,
Object[] params,
String[] signature)
Deprecated.
Invoke an operation by name, JMX style params and signature.
|
String |
java()
Deprecated.
Return a Java interface representing this MBean, suitable for display or compilation
|
String |
nameProp()
Deprecated.
Value of the name property of the ObjectName.
|
ObjectName |
objectName()
Deprecated.
The ObjectName of this MBean.
|
AMXProxy |
parent()
Deprecated.
MBean MUST return an ObjectName.
|
String |
parentPath()
Deprecated.
The value of the
PARENT_PATH_KEY property in the ObjectName |
String |
path()
Deprecated.
Get this MBean's pathname.
|
String |
type()
Deprecated.
The value of the
TYPE_KEY property in the ObjectName |
boolean |
valid()
Deprecated.
A proxy can become invalid if its corresponding MBean is unregistered, the connection is lost, etc.
|
getChildren, getName, getParentAMXProxy parent()
String nameProp()
String parentPath()
PARENT_PATH_KEY property in the ObjectNameString type()
TYPE_KEY property in the ObjectNameboolean valid()
Set<AMXProxy> childrenSet()
Map<String,AMXProxy> childrenMap(String type)
<T extends AMXProxy> Map<String,T> childrenMap(Class<T> intf)
intf - the proxy interface, type is deduced from itMap<String,Map<String,AMXProxy>> childrenMaps()
AMXProxy child(String type)
<T extends AMXProxy> T child(Class<T> intf)
Util.deduceType(java.lang.Class<?>).<T extends AMXProxy> T as(Class<T> intf)
AMXProxy can specialized it with this method; the proxy
by default will implement only the base AMXProxy interface.
This method is needed when crossing module boundaries where the desired class is not available to the AMXProxyHandler through its own classloader and/or when a generic proxy has been obtained through other means. When sub-interfaces of AMXProxy already return the appropriate type there is no reason or need to use this method.
Map<String,Object> attributesMap()
Map<String,Object> attributesMap(Set<String> attrNames)
Set<String> attributeNames()
String path()
path
on parent()ObjectName objectName()
String java()
Extra extra()
Object invokeOp(String operationName)
Copyright © 2017. All rights reserved.