|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.MBeanServerInvocationHandler com.sun.appserv.management.util.jmx.MBeanProxyHandler
public class MBeanProxyHandler
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.
Allows specification of either an AttributeNameMangler or AttributeNameMapper for maximum flexibility in how illegal Attribute names are mapped.
Field Summary | |
---|---|
protected static String |
DEBUG_ID
|
protected static String |
GET
|
protected static int |
GET_PREFIX_LENGTH
|
protected static String |
IS
|
protected static int |
IS_PREFIX_LENGTH
|
protected static String |
LOGGER_NAME
|
protected ConnectionSource |
mConnectionSource
|
protected Output |
mDebug
|
protected AttributeNameMangler |
mMangler
|
protected static String |
SET
|
Constructor Summary | |
---|---|
MBeanProxyHandler(ConnectionSource connectionSource,
ObjectName objectName)
Normally created through MBeanProxyFactory.newProxyInstance(). |
|
MBeanProxyHandler(ConnectionSource connectionSource,
ObjectName objectName,
AttributeNameMangler mangler)
Same as MBeanProxyHandler( connection, objectName ), but can take a name mangler. |
|
MBeanProxyHandler(ConnectionSource connectionSource,
ObjectName objectName,
AttributeNameMapper mapper)
Same as MBeanProxyHandler( connection, objectName ), but can take a supplied mapper for illegal Attribute names. |
Method Summary | |
---|---|
protected void |
cacheMBeanInfo(boolean cacheIt)
|
boolean |
checkValid()
|
void |
connectionBad()
|
protected void |
debug(Object... args)
|
protected void |
debug(Object o)
|
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)
|
static String[] |
getAllAttributeNames(MBeanAttributeInfo[] infos)
|
Object |
getAttribute(String attributeName)
Same as XAttributesAccess.getAttribute, but with exceptions |
AttributeList |
getAttributes(String[] attrNames)
Same as XAttributesAccess.getAttributes, but with exceptions |
protected boolean |
getCacheMBeanInfo()
|
protected MBeanServerConnection |
getConnection()
|
ConnectionSource |
getConnectionSource()
|
protected boolean |
getDebug()
|
protected String |
getDebugID()
|
protected MBeanInfo |
getMBeanInfo(boolean refresh)
Same as XAttributesAccess.getAttributes, but with exceptions |
boolean |
getMBeanInfoIsInvariant()
|
Logger |
getProxyLogger()
|
protected ObjectName |
getTargetObjectName()
|
int |
hashCode()
|
protected void |
initMapper()
Initialize a mapper based on the supplied attributeInfos. |
Object |
invoke(Object proxy,
Method method,
Object[] args)
Invoke the specified method. |
protected boolean |
isMappedAttributeMethod(String attributeName)
|
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 exceptions |
AttributeList |
setAttributes(AttributeList requested)
Same as XAttributesAccess.setAttributes, but with exceptions |
protected void |
setMBeanInfoIsInvariant(boolean isInvariant)
|
void |
setProxyLogger(Logger logger)
|
protected boolean |
targetIsValid()
|
void |
targetUnregistered()
|
Methods inherited from class javax.management.MBeanServerInvocationHandler |
---|
newProxyInstance |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String GET
protected static final String SET
protected static final String IS
protected static final int GET_PREFIX_LENGTH
protected static final int IS_PREFIX_LENGTH
protected final ConnectionSource mConnectionSource
protected AttributeNameMangler mMangler
protected Output mDebug
protected static final String DEBUG_ID
protected static final String LOGGER_NAME
Constructor Detail |
---|
public MBeanProxyHandler(ConnectionSource connectionSource, ObjectName objectName) throws IOException
connectionSource
- the connectionobjectName
- the ObjectName of the proxied MBean
IOException
public MBeanProxyHandler(ConnectionSource connectionSource, ObjectName objectName, AttributeNameMangler mangler) throws IOException
connectionSource
- the connectionobjectName
- the ObjectName of the proxied MBeanmangler
- optional name mangler for illegal Attribute names
IOException
public MBeanProxyHandler(ConnectionSource connectionSource, ObjectName objectName, AttributeNameMapper mapper) throws IOException
connectionSource
- the connectionobjectName
- the ObjectName of the proxied MBeanmapper
- optional name mapper for illegal Attribute names
IOException
Method Detail |
---|
public int hashCode()
hashCode
in class Object
public boolean equals(Object rhs)
equals
in class Object
protected String getDebugID()
public final void targetUnregistered()
public final void connectionBad()
protected final boolean targetIsValid()
public final boolean checkValid()
public void setProxyLogger(Logger logger)
public Logger getProxyLogger()
public final ConnectionSource getConnectionSource()
protected final MBeanServerConnection getConnection() throws IOException
IOException
protected final ObjectName getTargetObjectName()
public static String[] getAllAttributeNames(MBeanAttributeInfo[] infos)
protected void initMapper() throws IOException, IntrospectionException, ReflectionException, InstanceNotFoundException
IOException
IntrospectionException
ReflectionException
InstanceNotFoundException
protected String extractAttributeNameFromMethod(String methodName)
protected boolean isMappedAttributeMethod(String attributeName)
protected void cacheMBeanInfo(boolean cacheIt)
public final boolean getMBeanInfoIsInvariant()
protected final void setMBeanInfoIsInvariant(boolean isInvariant)
protected final boolean getCacheMBeanInfo()
protected MBeanInfo getMBeanInfo(boolean refresh) throws IOException, InstanceNotFoundException, IntrospectionException, ReflectionException
refresh
- whether to get a fresh copy
IOException
InstanceNotFoundException
IntrospectionException
ReflectionException
public Object getAttribute(String attributeName) throws InstanceNotFoundException, ReflectionException, MBeanException, AttributeNotFoundException, IOException
InstanceNotFoundException
ReflectionException
MBeanException
AttributeNotFoundException
IOException
public AttributeList getAttributes(String[] attrNames) throws IOException, InstanceNotFoundException, ReflectionException
IOException
InstanceNotFoundException
ReflectionException
public void setAttribute(Attribute attr) throws IOException, InstanceNotFoundException, ReflectionException, AttributeNotFoundException, MBeanException, InvalidAttributeValueException
IOException
InstanceNotFoundException
ReflectionException
AttributeNotFoundException
MBeanException
InvalidAttributeValueException
public AttributeList setAttributes(AttributeList requested) throws IOException, InstanceNotFoundException, ReflectionException
IOException
InstanceNotFoundException
ReflectionException
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)
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
For anything else, the behavior of MBeanServerInvocationHandler is used.
invoke
in interface InvocationHandler
invoke
in class MBeanServerInvocationHandler
Throwable
protected boolean getDebug()
protected void debugMethod(String methodName, Object... args)
protected void debugMethod(String msg, String methodName, Object... args)
protected void debug(Object... args)
protected void debug(Object o)
|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2006 Sun Microsystems, Inc. All rights reserved.