org.glassfish.admin.amx.core.proxy
Class AMXProxyHandler

java.lang.Object
  extended by javax.management.MBeanServerInvocationHandler
      extended by org.glassfish.admin.amx.util.jmx.MBeanProxyHandler
          extended by org.glassfish.admin.amx.core.proxy.AMXProxyHandler
All Implemented Interfaces:
InvocationHandler, AMX_SPI, AMXProxy, Extra, MetaGetters, StdAttributesAccess

@Taxonomy(stability=PRIVATE)
public final class AMXProxyHandler
extends MBeanProxyHandler
implements AMXProxy, Extra

Extends MBeanProxyHandler by also supporting the functionality required of an AMX.


Field Summary
static String ADD_NOTIFICATION_LISTENER
           
static String REMOVE_NOTIFICATION_LISTENER
           
 
Fields inherited from class org.glassfish.admin.amx.util.jmx.MBeanProxyHandler
GET_PREFIX_LENGTH, IS, IS_PREFIX_LENGTH, mDebug, mInitialMBeanInfo, SET
 
Constructor Summary
protected AMXProxyHandler(MBeanServerConnection conn, ObjectName objectName, MBeanInfo mbeanInfo)
          Create a new AMX proxy.
 
Method Summary
protected  Object _invoke(Object myProxy, Method method, Object[] argsIn)
           
protected  void addNotificationListener(Object[] args)
           
<T extends AMXProxy>
T
as(Class<T> intf)
          convert to specified class.
 MBeanAttributeInfo attributeInfo(String attrName)
          Get MBeanOperationInfo for specified attribute name.
 Set<String> attributeNames()
          Get all available Attributes names, no trip to server needed.
 Map<String,Object> attributesMap()
          Get a Map keyed by Attribute name of all Attribute values.
 Map<String,Object> attributesMap(Set<String> attrNames)
          Get a Map keyed by Attribute name of the specified Attribute values.
<T extends AMXProxy>
T
child(Class<T> intf)
          Get a singleton child.
 AMXProxy child(String type)
          Get a singleton child of the specified type.
<T extends AMXProxy>
T
child(String type, Class<T> intf)
           
<T extends AMXProxy>
T
child(String type, String name, Class<T> intf)
           
<T extends AMXProxy>
Map<String,T>
childrenMap(Class<T> intf)
          Get all children of the same type.
 Map<String,AMXProxy> childrenMap(String type)
          Get all children of a specified type, keyed by the name as found in the ObjectName.
<T extends AMXProxy>
Map<String,T>
childrenMap(String type, Class<T> intf)
           
 Map<String,Map<String,AMXProxy>> childrenMaps()
          Get Maps keyed by type, with a Map keyed by name.
 Set<AMXProxy> childrenSet()
          Returns an array of children, including an empty array if there are none, but children are possible.
 Set<AMXProxy> childrenSet(ObjectName[] objectNames)
           
<T extends AMXProxy>
Set<T>
childrenSet(String type, Class<T> intf)
           
 Set<String> childrenTypes(ObjectName[] objectNames)
           
 Descriptor descriptor()
          MBeanInfo descriptor
 DomainRoot domainRootProxy()
           
 Extra extra()
          additional capabilities, including direct JMX access
 Class<? extends AMXProxy> genericInterface()
          From Descriptor: get the generic interface for this MBean eg AMXProxy or AMXConfigProxy or (possibly) something else.
 String genericInterfaceName()
           
static String genericInterfaceName(MBeanInfo info)
           
 MBeanAttributeInfo getAttributeInfo(String name)
           
 ObjectName[] getChildren()
          If no children are possible (a leaf node), an AttributeNotFoundException should be thrown.
static
<T> T
getDescriptorField(MBeanInfo info, String name, T defaultValue)
           
protected
<T> T
getDescriptorField(String name, T defaultValue)
           
 String getName()
          the unencoded name, which could differ from the value of the 'name' property in the ObjectName
 ObjectName getParent()
          Return the ObjectName of the parent.
protected  AMXProxy getProxy(ObjectName objectName)
           
protected
<T extends AMXProxy>
T
getProxy(ObjectName objectName, Class<T> intf)
           
 boolean globalSingleton()
          From Descriptor: true if this MBean is a global singleton (1 instance within entire domain)
static boolean globalSingleton(MBeanInfo info)
           
 String group()
          From Descriptor: return the group value
 String interfaceName()
          From Descriptor: get the Java classname of the interface for this MBean.
static String interfaceName(MBeanInfo info)
           
 Object invoke(Object myProxy, Method method, Object[] args)
          Invoke the specified method.
 Object invokeOp(String operationName)
          Invoke an operation by name, no arguments.
 Object invokeOp(String operationName, Object[] args, String[] signature)
          Invoke an operation by name, JMX style params and signature.
protected static boolean isSingleProxyGetter(Method method, int argCount)
          Return true if the method is one that is requesting a single AMX object.
 String java()
          Return a Java interface representing this MBean, suitable for display or compilation
 MBeanInfo mbeanInfo()
           
 MBeanServerConnection mbeanServerConnection()
          Get the MBeanServerConnection.
 String nameProp()
          Value of the name property of the ObjectName.
 ObjectName objectName()
          The ObjectName of this MBean.
 MBeanOperationInfo operationInfo(String operationName)
          Get MBeanOperationInfo for specified operation.
 AMXProxy parent()
          MBean MUST return an ObjectName.
 String parentPath()
          The value of the PARENT_PATH_KEY property in the ObjectName
 String path()
          Get this MBean's pathname.
 ProxyFactory proxyFactory()
           
protected  void removeNotificationListener(Object[] args)
           
 boolean singleton()
          From Descriptor: true if this MBean is a singleton (1 instance within its parent scope)
static boolean singleton(MBeanInfo info)
           
 String[] subTypes()
          From Descriptor: Get the *potential* sub types this MBean expects to have
 boolean supportsAdoption()
          From Descriptor: return true if new children are allowed by external subsystems
 String type()
          The value of the TYPE_KEY property in the ObjectName
static AMXProxyHandler unwrap(AMXProxy proxy)
           
 boolean valid()
          A proxy can become invalid if its corresponding MBean is unregistered, the connection is lost, etc.
 
Methods inherited from class org.glassfish.admin.amx.util.jmx.MBeanProxyHandler
connectionBad, debug, debug, debugMethod, debugMethod, equals, extractAttributeNameFromMethod, getAttribute, getAttributeNoThrow, getAttributes, getDebug, getMBeanInfo, getProxyLogger, hashCode, invoke, isInvariantMBeanInfo, isLocal, isValid, postGetAttributeHook, postGetAttributesHook, postSetAttributeHook, postSetAttributesHook, setAttribute, setAttributes, targetUnregistered
 
Methods inherited from class javax.management.MBeanServerInvocationHandler
getMBeanServerConnection, getObjectName, isMXBean, newProxyInstance
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.admin.amx.core.StdAttributesAccess
getAttribute, getAttributes, invoke, setAttribute, setAttributes
 
Methods inherited from interface org.glassfish.admin.amx.core.MetaGetters
isInvariantMBeanInfo
 

Field Detail

ADD_NOTIFICATION_LISTENER

public static final String ADD_NOTIFICATION_LISTENER
See Also:
Constant Field Values

REMOVE_NOTIFICATION_LISTENER

public static final String REMOVE_NOTIFICATION_LISTENER
See Also:
Constant Field Values
Constructor Detail

AMXProxyHandler

protected AMXProxyHandler(MBeanServerConnection conn,
                          ObjectName objectName,
                          MBeanInfo mbeanInfo)
                   throws IOException
Create a new AMX proxy.

Throws:
IOException
Method Detail

as

public <T extends AMXProxy> T as(Class<T> intf)
convert to specified class.

Specified by:
as in interface AMXProxy

extra

public Extra extra()
Description copied from interface: AMXProxy
additional capabilities, including direct JMX access

Specified by:
extra in interface AMXProxy

unwrap

public static AMXProxyHandler unwrap(AMXProxy proxy)

domainRootProxy

public final DomainRoot domainRootProxy()

getProxy

protected <T extends AMXProxy> T getProxy(ObjectName objectName,
                                          Class<T> intf)

getProxy

protected AMXProxy getProxy(ObjectName objectName)

isSingleProxyGetter

protected static boolean isSingleProxyGetter(Method method,
                                             int argCount)
Return true if the method is one that is requesting a single AMX object. Such methods are client-side methods and do not operate on the target MBean.


invoke

public final Object invoke(Object myProxy,
                           Method method,
                           Object[] args)
                    throws Throwable
Description copied from class: MBeanProxyHandler
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 correctly

For anything else, the behavior of MBeanServerInvocationHandler is used.

Specified by:
invoke in interface InvocationHandler
Overrides:
invoke in class MBeanProxyHandler
Throws:
Throwable

invokeOp

public Object invokeOp(String operationName)
Description copied from interface: AMXProxy
Invoke an operation by name, no arguments.

Specified by:
invokeOp in interface AMXProxy

invokeOp

public Object invokeOp(String operationName,
                       Object[] args,
                       String[] signature)
Description copied from interface: AMXProxy
Invoke an operation by name, JMX style params and signature.

Specified by:
invokeOp in interface AMXProxy

_invoke

protected Object _invoke(Object myProxy,
                         Method method,
                         Object[] argsIn)
                  throws Throwable
Throws:
Throwable

addNotificationListener

protected void addNotificationListener(Object[] args)
                                throws IOException,
                                       InstanceNotFoundException
Throws:
IOException
InstanceNotFoundException

removeNotificationListener

protected void removeNotificationListener(Object[] args)
                                   throws IOException,
                                          InstanceNotFoundException,
                                          ListenerNotFoundException
Throws:
IOException
InstanceNotFoundException
ListenerNotFoundException

interfaceName

public static String interfaceName(MBeanInfo info)

interfaceName

public String interfaceName()
Description copied from interface: MetaGetters
From Descriptor: get the Java classname of the interface for this MBean. If it has not been specified, a default generic interface is returned eg 'AMX'. There is no guarantee that the interface exists on the client.

Specified by:
interfaceName in interface MetaGetters
Overrides:
interfaceName in class MBeanProxyHandler

genericInterfaceName

public static String genericInterfaceName(MBeanInfo info)

genericInterfaceName

public String genericInterfaceName()

genericInterface

public Class<? extends AMXProxy> genericInterface()
Description copied from interface: MetaGetters
From Descriptor: get the generic interface for this MBean eg AMXProxy or AMXConfigProxy or (possibly) something else. The generic interface is always part of amx-core.

Specified by:
genericInterface in interface MetaGetters

valid

public boolean valid()
Description copied from interface: AMXProxy
A proxy can become invalid if its corresponding MBean is unregistered, the connection is lost, etc. If currently marked as valid, a trip to the server is made to verify validity.

Specified by:
valid in interface AMXProxy
Returns:
true if this proxy is valid

proxyFactory

public ProxyFactory proxyFactory()
Specified by:
proxyFactory in interface Extra
Returns:
the ProxyFactory that created this proxy.

mbeanServerConnection

public MBeanServerConnection mbeanServerConnection()
Description copied from interface: Extra
Get the MBeanServerConnection.

Specified by:
mbeanServerConnection in interface Extra

objectName

public ObjectName objectName()
Description copied from interface: AMXProxy
The ObjectName of this MBean.

Specified by:
objectName in interface AMXProxy

nameProp

public String nameProp()
Description copied from interface: AMXProxy
Value of the name property of the ObjectName. Could differ from getName(), which returns the internal name, which might not be legal in an ObjectName, or could have changed.

Specified by:
nameProp in interface AMXProxy

parentPath

public String parentPath()
Description copied from interface: AMXProxy
The value of the PARENT_PATH_KEY property in the ObjectName

Specified by:
parentPath in interface AMXProxy

type

public String type()
Description copied from interface: AMXProxy
The value of the TYPE_KEY property in the ObjectName

Specified by:
type in interface AMXProxy

getName

public String getName()
Description copied from interface: AMX_SPI
the unencoded name, which could differ from the value of the 'name' property in the ObjectName

Specified by:
getName in interface AMX_SPI

getParent

public ObjectName getParent()
Description copied from interface: AMX_SPI
Return the ObjectName of the parent. Must not be null (except for DomainRoot)

Specified by:
getParent in interface AMX_SPI

parent

public AMXProxy parent()
Description copied from interface: AMXProxy
MBean MUST return an ObjectName. May be null for DomainRoot only.

Specified by:
parent in interface AMXProxy

path

public String path()
Description copied from interface: AMXProxy
Get this MBean's pathname. Its parent path can be obtained by calling path on AMXProxy.parent()

Specified by:
path in interface AMXProxy

getChildren

public ObjectName[] getChildren()
Description copied from interface: AMX_SPI
If no children are possible (a leaf node), an AttributeNotFoundException should be thrown.

Specified by:
getChildren in interface AMX_SPI

childrenSet

public Set<AMXProxy> childrenSet()
Returns an array of children, including an empty array if there are none, but children are possible. Returns null if children are not possible.

Specified by:
childrenSet in interface AMXProxy

childrenSet

public Set<AMXProxy> childrenSet(ObjectName[] objectNames)

childrenTypes

public Set<String> childrenTypes(ObjectName[] objectNames)

childrenMap

public Map<String,AMXProxy> childrenMap(String type)
Description copied from interface: AMXProxy
Get all children of a specified type, keyed by the name as found in the ObjectName.

Specified by:
childrenMap in interface AMXProxy

childrenMap

public <T extends AMXProxy> Map<String,T> childrenMap(Class<T> intf)
Description copied from interface: AMXProxy
Get all children of the same type. The Map is keyed by the name as found in the ObjectName.

Specified by:
childrenMap in interface AMXProxy
Parameters:
intf - the proxy interface, type is deduced from it

childrenMap

public <T extends AMXProxy> Map<String,T> childrenMap(String type,
                                                      Class<T> intf)

childrenMaps

public Map<String,Map<String,AMXProxy>> childrenMaps()
Description copied from interface: AMXProxy
Get Maps keyed by type, with a Map keyed by name.

Specified by:
childrenMaps in interface AMXProxy

childrenSet

public <T extends AMXProxy> Set<T> childrenSet(String type,
                                               Class<T> intf)

child

public AMXProxy child(String type)
Description copied from interface: AMXProxy
Get a singleton child of the specified type. An exception is thrown if the child is not a singleton. If children do not exist, or there is no such child, then null is returned.

Specified by:
child in interface AMXProxy

child

public <T extends AMXProxy> T child(Class<T> intf)
Description copied from interface: AMXProxy
Get a singleton child. Its type is deduced from the interface using Util#deduceType.

Specified by:
child in interface AMXProxy

child

public <T extends AMXProxy> T child(String type,
                                    Class<T> intf)

child

public <T extends AMXProxy> T child(String type,
                                    String name,
                                    Class<T> intf)

mbeanInfo

public final MBeanInfo mbeanInfo()
Specified by:
mbeanInfo in interface MetaGetters

attributesMap

public Map<String,Object> attributesMap(Set<String> attrNames)
Description copied from interface: AMXProxy
Get a Map keyed by Attribute name of the specified Attribute values.

Specified by:
attributesMap in interface AMXProxy

attributesMap

public Map<String,Object> attributesMap()
Description copied from interface: AMXProxy
Get a Map keyed by Attribute name of all Attribute values. Requires a trip to the server.

Specified by:
attributesMap in interface AMXProxy

getAttributeInfo

public MBeanAttributeInfo getAttributeInfo(String name)

attributeNames

public Set<String> attributeNames()
Description copied from interface: AMXProxy
Get all available Attributes names, no trip to server needed. Requires a trip to the server.

Specified by:
attributeNames in interface AMXProxy

getDescriptorField

public static <T> T getDescriptorField(MBeanInfo info,
                                       String name,
                                       T defaultValue)

singleton

public static boolean singleton(MBeanInfo info)

globalSingleton

public static boolean globalSingleton(MBeanInfo info)

getDescriptorField

protected <T> T getDescriptorField(String name,
                                   T defaultValue)

singleton

public boolean singleton()
Description copied from interface: MetaGetters
From Descriptor: true if this MBean is a singleton (1 instance within its parent scope)

Specified by:
singleton in interface MetaGetters

globalSingleton

public boolean globalSingleton()
Description copied from interface: MetaGetters
From Descriptor: true if this MBean is a global singleton (1 instance within entire domain)

Specified by:
globalSingleton in interface MetaGetters

group

public String group()
Description copied from interface: MetaGetters
From Descriptor: return the group value

Specified by:
group in interface MetaGetters

supportsAdoption

public boolean supportsAdoption()
Description copied from interface: MetaGetters
From Descriptor: return true if new children are allowed by external subsystems

Specified by:
supportsAdoption in interface MetaGetters

subTypes

public String[] subTypes()
Description copied from interface: MetaGetters
From Descriptor: Get the *potential* sub types this MBean expects to have

Specified by:
subTypes in interface MetaGetters

java

public String java()
Description copied from interface: AMXProxy
Return a Java interface representing this MBean, suitable for display or compilation

Specified by:
java in interface AMXProxy
Specified by:
java in interface Extra

descriptor

public Descriptor descriptor()
Description copied from interface: MetaGetters
MBeanInfo descriptor

Specified by:
descriptor in interface MetaGetters

attributeInfo

public MBeanAttributeInfo attributeInfo(String attrName)
Description copied from interface: MetaGetters
Get MBeanOperationInfo for specified attribute name.

Specified by:
attributeInfo in interface MetaGetters

operationInfo

public MBeanOperationInfo operationInfo(String operationName)
Description copied from interface: MetaGetters
Get MBeanOperationInfo for specified operation.

Specified by:
operationInfo in interface MetaGetters


Submit a bug or feature

Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.

Generated on 12-March-2010 04:35