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 StringGETprotected static intGET_PREFIX_LENGTHprotected static StringISprotected static intIS_PREFIX_LENGTHprotected OutputmDebugprotected MBeanInfomInitialMBeanInfoMBeanInfo we first obtainedprotected static StringSET
-
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 voidconnectionBad()protected voiddebug(Object o)protected voiddebug(Object... args)protected voiddebugMethod(String methodName, Object... args)protected voiddebugMethod(String msg, String methodName, Object... args)booleanequals(Object rhs)protected StringextractAttributeNameFromMethod(String methodName)ObjectgetAttribute(String attributeName)Same as XAttributesAccess.getAttribute, but with exceptionsprotected ObjectgetAttributeNoThrow(String name)AttributeListgetAttributes(String[] attrNames)Same as XAttributesAccess.getAttributes, but with exceptionsprotected booleangetDebug()MBeanInfogetMBeanInfo()LoggergetProxyLogger()inthashCode()StringinterfaceName()Objectinvoke(Object proxy, Method method, Object[] args)Invoke the specified method.Objectinvoke(String methodName, Object[] params, String[] signature)JMX direct invokebooleanisInvariantMBeanInfo()booleanisLocal()return true if the MBean is local (in process)booleanisValid()protected voidpostGetAttributeHook(String name, Object value)protected voidpostGetAttributesHook(String[] requested, AttributeList actual)protected voidpostSetAttributeHook(Attribute attr)protected voidpostSetAttributesHook(AttributeList requested, AttributeList actual)voidsetAttribute(Attribute attr)Same as XAttributesAccess.setAttribute, but with exceptionsAttributeListsetAttributes(AttributeList requested)Same as XAttributesAccess.setAttributes, but with exceptionsvoidtargetUnregistered()-
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:
invokein interfaceInvocationHandler- Overrides:
invokein classMBeanServerInvocationHandler- Throws:
Throwable
-
getDebug
protected boolean getDebug()
-
debug
protected void debug(Object... args)
-
debug
protected void debug(Object o)
-
-