Methods Summary |
---|
public static com.sun.appserv.management.base.AMX | asAMX(java.lang.Object o)A safe way to cast to AMX.
return AMX.class.cast( o );
|
public static java.lang.String | concatenateProps(java.lang.String props1, java.lang.String props2)
return( JMXUtil.concatenateProps( props1, props2 ) );
|
public static java.lang.String | concatenateProps(java.lang.String props1, java.lang.String props2, java.lang.String props3)
return( concatenateProps( concatenateProps( props1, props2), props3) );
|
public static java.util.Map | createNameMap(java.util.Set amxs)Create a Map keyed by the value of the AMX.NAME_KEY with
value the AMX item.
final Map<String,T> m = new HashMap<String,T>();
for( final T amx : amxs )
{
final String name = amx.getName();
m.put( name, amx );
}
return( m );
|
public static final java.util.Map | createObjectNameMap(java.util.Set objectNames)Create a Map keyed by the value of the AMX.NAME_KEY with
value the ObjectName. Note that if two or more ObjectNames
share the same name, the resulting Map will contain only
one of the original ObjectNames.
final Map<String,ObjectName> m = new HashMap<String,ObjectName>();
for( final ObjectName objectName : objectNames )
{
final String name = getName( objectName );
assert( ! m.containsKey( name ) ) :
"createObjectNameMap: key already present: " + name + " in " + objectName;
m.put( name, objectName );
}
assert( m.keySet().size() == objectNames.size() );
return( Collections.checkedMap(m, String.class, ObjectName.class) );
|
public static java.util.Map | getAMXNotificationData(javax.management.Notification notif)All Notifications emitted by AMX MBeans which are not
standard types defined by JMX place a Map
into the userData field of the Notification. This call
retrieves that Map, which may be null if no additional
data is included.
return Collections.unmodifiableMap(
JMXUtil.getUserDataMapString_Serializable( notif ) );
|
public static java.io.Serializable | getAMXNotificationValue(javax.management.Notification notif, java.lang.String key)Use of generic type form taking Class is preferred.
final Map<String,Serializable> data =
getAMXNotificationData( notif );
if ( data == null )
{
throw new IllegalArgumentException( notif.toString() );
}
if ( ! data.containsKey( key ) )
{
throw new IllegalArgumentException( "Value not found for " + key +
" in " + notif );
}
return data.get( key );
|
public static T | getAMXNotificationValue(javax.management.Notification notif, java.lang.String key, java.lang.Class theClass)Retrieve a particular value associated with the specified
key from an AMX Notification.
final Serializable value = getAMXNotificationValue( notif, key );
return theClass.cast( value );
|
public static Extra | getExtra(com.sun.appserv.management.base.AMX proxy)Get extra information about this {@link AMX}.
'Extra' is not an MBean Attribute; it exists only in the {@link AMX}.
return( (Extra)Proxy.getInvocationHandler( proxy ) );
|
public static java.lang.String | getFullTypeProps(javax.management.ObjectName objectName, java.lang.String fullType)Get properties corresponding to the FullType of this ObjectName.
Its j2eeType/name are included as j2eeType=name, not
as j2eeType=j2eeType,name=name.
final String selfProp = Util.getSelfProp( objectName );
// now add properties for ancestors; skip the last type; it's
// present in the j2eeType/name properties (selfProp)
String ancestorProps = "";
final String[] types = Util.getTypeArray( fullType );
for( int i = 0; i < types.length - 1; ++i )
{
final String key = types[ i ];
final String value = objectName.getKeyProperty( key );
final String prop = Util.makeProp( key, value );
ancestorProps = Util.concatenateProps( ancestorProps, prop );
}
final String props = Util.concatenateProps( selfProp, ancestorProps );
return( props );
|
public static java.lang.String | getJ2EEType(javax.management.ObjectName objectName)
return( objectName.getKeyProperty( AMX.J2EE_TYPE_KEY ) );
|
public static java.lang.String | getName(javax.management.ObjectName objectName)Get the value of the AMX.NAME_KEY property within the ObjectName
or AMX.NO_NAME if not present.
String name = objectName.getKeyProperty( AMX.NAME_KEY );
if ( name == null )
{
name = AMX.NO_NAME;
}
return( name );
|
public static java.util.Set | getNames(java.util.Set amxs)Extract the names from all ObjectNames. The name is the value of the
property NAME_KEY (See {@link AMX}). Note that if two or more ObjectNames
share the same name, the resulting Set will be of smaller size() than
the original.
return getNamesSet( Util.toObjectNames( amxs ) );
|
public static java.lang.String[] | getNamesArray(java.util.Set objectNames)Extract the names from all ObjectNames.
return( JMXUtil.getKeyProperty( AMX.NAME_KEY, objectNames ) );
|
public static java.util.Set | getNamesSet(java.util.Set objectNames)Extract the names from all ObjectNames. The name is the value of the
property NAME_KEY (See {@link AMX}). Note that if two or more ObjectNames
share the same name, the resulting Set will be of smaller size() than
the original.
return TypeCast.checkedStringSet(
JMXUtil.getKeyPropertySet( AMX.NAME_KEY, objectNames ) );
|
public static javax.management.ObjectName | getObjectName(T proxy)Get the ObjectName targeted by this {@link AMX}.
return( getExtra( proxy ).getObjectName() );
|
public static javax.management.ObjectName | getObjectName(java.util.Map candidates, java.lang.String name)Get an ObjectName from a Map of ObjectName where the
values are keyed by name.
final Object item = candidates.get( name );
if ( item == null )
{
throw new IllegalArgumentException( "Not found: " + name );
}
return (ObjectName)item;
|
public static java.util.Set | getPatternKeys(java.lang.String fullType)Get all keys required for an ObjectName pattern which uniquely
identifies the MBean.
final Set<String> requiredKeys = GSetUtil.copySet( PATTERN_PROPS );
// omit the last one, it is the simple type of this MBean, which we've
// already included
final String[] types = Util.getTypeArray( fullType );
for( int i = 0; i < types.length - 1; ++i )
{
requiredKeys.add( types[ i ] );
}
return TypeCast.checkedStringSet( requiredKeys );
|
public static java.lang.String | getSelfProp(javax.management.ObjectName objectName)Extract the j2eeType and name properties and return it as a single property
j2eeType=name
final String j2eeType = objectName.getKeyProperty( AMX.J2EE_TYPE_KEY );
final String name = objectName.getKeyProperty( AMX.NAME_KEY );
return( Util.makeProp( j2eeType, name ) );
|
public static java.lang.String[] | getTypeArray(java.lang.String fullType)Get the FullType as a String[], last element being the j2eeType.
if ( fullType == null )
{
throw new IllegalArgumentException();
}
assert( AMX.FULL_TYPE_DELIM.equals( "." ) );
return( fullType.split( "\\." ) );
|
public static java.lang.String | makeJ2EETypeProp(java.lang.String value)Make an ObjectName property of the form j2eeType=value.
return( makeProp( AMX.J2EE_TYPE_KEY, value ) );
|
public static java.lang.String | makeNameProp(java.lang.String value)Make an ObjectName property of the form name=value.
return( makeProp( AMX.NAME_KEY, value ) );
|
public static java.lang.String | makeProp(java.lang.String name, java.lang.String value)Make an ObjectName property of the form name=value.
return( JMXUtil.makeProp( name, value ) );
|
public static java.lang.String | makeRequiredProps(java.lang.String j2eeType, java.lang.String name)
final String j2eeTypeProp = Util.makeJ2EETypeProp( j2eeType );
final String nameProp = Util.makeNameProp( name );
final String props = Util.concatenateProps( j2eeTypeProp, nameProp );
return( props );
|
public static javax.management.ObjectName | newObjectName(java.lang.String name)Create a new ObjectName, caller is guaranteeing that the name is
well-formed (a RuntimeException will be thrown if not). This avoids
having to catch all sorts of JMX exceptions.
NOTE: Do not call this method if there is not certainty of a well-formed name.
return( JMXUtil.newObjectName( name ) );
|
public static javax.management.ObjectName | newObjectName(java.lang.String domain, java.lang.String props)Build an ObjectName. Calls newObjectName( domain + ":" + props )
return( newObjectName( domain + ":" + props ) );
|
public static javax.management.ObjectName | newObjectNamePattern(java.lang.String domain, java.lang.String props)Build an ObjectName pattern.
return( JMXUtil.newObjectNamePattern( domain, props ) );
|
public static javax.management.ObjectName | newObjectNamePattern(javax.management.ObjectName objectName)Build an ObjectName pattern.
final String props = objectName.getKeyPropertyListString();
return( newObjectNamePattern( objectName.getDomain(), props) );
|
public static void | sleep(long millis)
try
{
Thread.sleep( millis );
}
catch( InterruptedException e )
{
}
|
public static java.util.Set | toObjectNames(java.util.Set amxs)
final Set<ObjectName> objectNames = new HashSet<ObjectName>();
for( final AMX next : amxs )
{
objectNames.add( getObjectName( next ) );
}
return( Collections.checkedSet(objectNames, ObjectName.class) );
|
public static java.util.Map | toObjectNames(java.util.Map amxMap)
final Map<String,ObjectName> m = new HashMap<String,ObjectName>();
for( final String key : amxMap.keySet() )
{
final AMX value = amxMap.get( key );
m.put( key, getExtra( value ).getObjectName() );
}
return( Collections.checkedMap( m, String.class, ObjectName.class) );
|
public static javax.management.ObjectName[] | toObjectNames(com.sun.appserv.management.base.AMX[] amx)
final ObjectName[] objectNames = new ObjectName[ amx.length ];
for( int i = 0; i < objectNames.length; ++i )
{
objectNames[ i ] = amx[ i ] == null ? null : getExtra( amx[ i ] ).getObjectName();
}
return( objectNames );
|