Package org.glassfish.admin.amx.util.jmx
Class MBeanProxyHandler
- java.lang.Object
-
- javax.management.MBeanServerInvocationHandler
-
- org.glassfish.admin.amx.util.jmx.MBeanProxyHandler
-
- All Implemented Interfaces:
InvocationHandler
- Direct Known Subclasses:
AMXProxyHandler
public class MBeanProxyHandler extends MBeanServerInvocationHandler
Implementation of a proxy handler that supports Attribute names which are not legal Java identifiers. It does so by mapping illegal Java identifiers into legal names. Any interface supplied needs to take mapped names into account. THREAD SAFE, but not clear if parent class javax.management.MBeanServerInvocationHandler is thread-safe
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
GET
protected static int
GET_PREFIX_LENGTH
protected static String
IS
protected static int
IS_PREFIX_LENGTH
protected Output
mDebug
protected MBeanInfo
mInitialMBeanInfo
MBeanInfo we first obtainedprotected static String
SET
-
Constructor Summary
Constructors Constructor Description MBeanProxyHandler(MBeanServerConnection conn, ObjectName objectName, MBeanInfo mbeanInfo)
Normally created through MBeanProxyFactory.newProxyInstance().
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connectionBad()
protected void
debug(Object o)
protected void
debug(Object... args)
protected void
debugMethod(String methodName, Object... args)
protected void
debugMethod(String msg, String methodName, Object... args)
boolean
equals(Object rhs)
protected String
extractAttributeNameFromMethod(String methodName)
Object
getAttribute(String attributeName)
Same as XAttributesAccess.getAttribute, but with exceptionsprotected Object
getAttributeNoThrow(String name)
AttributeList
getAttributes(String[] attrNames)
Same as XAttributesAccess.getAttributes, but with exceptionsprotected boolean
getDebug()
MBeanInfo
getMBeanInfo()
Logger
getProxyLogger()
int
hashCode()
String
interfaceName()
Object
invoke(Object proxy, Method method, Object[] args)
Invoke the specified method.Object
invoke(String methodName, Object[] params, String[] signature)
JMX direct invokeboolean
isInvariantMBeanInfo()
boolean
isLocal()
return true if the MBean is local (in process)boolean
isValid()
protected void
postGetAttributeHook(String name, Object value)
protected void
postGetAttributesHook(String[] requested, AttributeList actual)
protected void
postSetAttributeHook(Attribute attr)
protected void
postSetAttributesHook(AttributeList requested, AttributeList actual)
void
setAttribute(Attribute attr)
Same as XAttributesAccess.setAttribute, but with exceptionsAttributeList
setAttributes(AttributeList requested)
Same as XAttributesAccess.setAttributes, but with exceptionsvoid
targetUnregistered()
-
Methods inherited from class javax.management.MBeanServerInvocationHandler
getMBeanServerConnection, getObjectName, isMXBean, newProxyInstance
-
-
-
-
Field Detail
-
GET
protected static final String GET
- See Also:
- Constant Field Values
-
SET
protected static final String SET
- See Also:
- Constant Field Values
-
IS
protected static final String IS
- See Also:
- Constant Field Values
-
GET_PREFIX_LENGTH
protected static final int GET_PREFIX_LENGTH
-
IS_PREFIX_LENGTH
protected static final int IS_PREFIX_LENGTH
-
mInitialMBeanInfo
protected final MBeanInfo mInitialMBeanInfo
MBeanInfo we first obtained
-
mDebug
protected final Output mDebug
-
-
Constructor Detail
-
MBeanProxyHandler
public MBeanProxyHandler(MBeanServerConnection conn, ObjectName objectName, MBeanInfo mbeanInfo) throws IOException
Normally created through MBeanProxyFactory.newProxyInstance(). Creates a new instance to be used as a handler object for Proxy.newProxyInstance.- Parameters:
conn
- the connectionobjectName
- the ObjectName of the proxied MBeanmbeanInfo
- will be fetched if null- Throws:
IOException
-
-
Method Detail
-
isInvariantMBeanInfo
public boolean isInvariantMBeanInfo()
-
interfaceName
public String interfaceName()
-
targetUnregistered
public final void targetUnregistered()
-
connectionBad
public final void connectionBad()
-
isLocal
public boolean isLocal()
return true if the MBean is local (in process)
-
isValid
public final boolean isValid()
-
getProxyLogger
public Logger getProxyLogger()
-
getMBeanInfo
public MBeanInfo getMBeanInfo()
-
getAttribute
public Object getAttribute(String attributeName) throws InstanceNotFoundException, ReflectionException, MBeanException, AttributeNotFoundException, IOException
Same as XAttributesAccess.getAttribute, but with exceptions
-
getAttributes
public AttributeList getAttributes(String[] attrNames) throws IOException, InstanceNotFoundException, ReflectionException
Same as XAttributesAccess.getAttributes, but with exceptions
-
setAttribute
public void setAttribute(Attribute attr) throws IOException, InstanceNotFoundException, ReflectionException, AttributeNotFoundException, MBeanException, InvalidAttributeValueException
Same as XAttributesAccess.setAttribute, but with exceptions
-
setAttributes
public AttributeList setAttributes(AttributeList requested) throws IOException, InstanceNotFoundException, ReflectionException
Same as XAttributesAccess.setAttributes, but with exceptions
-
postGetAttributesHook
protected void postGetAttributesHook(String[] requested, AttributeList actual)
-
postSetAttributeHook
protected void postSetAttributeHook(Attribute attr)
-
postSetAttributesHook
protected void postSetAttributesHook(AttributeList requested, AttributeList actual)
-
invoke
public Object invoke(String methodName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException
JMX direct invoke
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
Invoke the specified method. This implementation supports additional functionality over the JMX MBeanServerInvocationHandler: (1) It supports mapped Attribute names (ones that are not legal Java names) (2) it supports XAttributesAccess, which otherwise does not work correctlyFor anything else, the behavior of MBeanServerInvocationHandler is used.
- Specified by:
invoke
in interfaceInvocationHandler
- Overrides:
invoke
in classMBeanServerInvocationHandler
- Throws:
Throwable
-
getDebug
protected boolean getDebug()
-
debug
protected void debug(Object... args)
-
debug
protected void debug(Object o)
-
-