Methods Summary |
---|
public static java.util.Set | getAllAttributeNames(javax.management.MBeanServerConnection conn, javax.management.ObjectName objectName)
final Set allNames = new HashSet();
// add the Attribute names
final MBeanInfo info = conn.getMBeanInfo( objectName );
final MBeanAttributeInfo [] attrsInfo = info.getAttributes();
if ( attrsInfo != null )
{
for( int i = 0; i < attrsInfo.length; ++i )
{
allNames.add( attrsInfo[ i ].getName() );
}
}
return( allNames );
|
java.lang.Class | getAttributeClass(javax.management.ObjectName objectName, java.lang.String attributeName)
final MBeanInfo info = getMBS().getMBeanInfo( objectName );
final MBeanAttributeInfo [] attrsInfo = info.getAttributes();
Class theClass = null;
for( int i = 0; i < attrsInfo.length; ++i )
{
final String testName = attrsInfo[ i ].getName();
if ( testName.equals( attributeName ) )
{
theClass = ClassUtil.getClassFromName( attrsInfo[ i ].getType() );
break;
}
}
return( theClass );
|
public javax.management.Attribute | getValue(javax.management.ObjectName objectName, java.lang.String valueName)
final Object value = getMBS().getAttribute( objectName, valueName);
return( new Attribute( valueName, value ) );
|
public javax.management.Attribute | setValue(javax.management.ObjectName objectName, javax.management.Attribute attr)
if ( attr.getValue() == null )
{
final String msg = DottedNameStrings.getString(
DottedNameStrings.ILLEGAL_TO_SET_NULL_KEY,
attr.getName( ) );
throw new IllegalArgumentException( msg );
}
Attribute actualAttr = null;
Object value = attr.getValue();
if ( value instanceof String )
{
final Class attrClass = getAttributeClass( objectName, attr.getName() );
if ( attrClass == null )
{
final String msg = DottedNameStrings.getString(
DottedNameStrings.ATTRIBUTE_NOT_FOUND_KEY,
attr.getName( ) );
throw new AttributeNotFoundException( attr.getName() );
}
value = coerceToClass( attrClass, (String)value );
actualAttr = new Attribute( attr.getName(), value );
}
else
{
// if not a String, then pass on through
actualAttr = attr;
}
getMBS().setAttribute( objectName, actualAttr);
return( actualAttr );
|