Methods Summary |
---|
private void | add(TypeData typeData)
final String j2eeType = typeData.getJ2EEType();
final TypeInfo info = new TypeInfo( typeData );
mTypeToInfoMap.put( j2eeType, info );
|
public java.lang.String[] | getContaineeByChain(java.lang.String j2eeType)Get the contained-by chain for the specified j2eeType. Calling
this is only legal for j2eeTypes for which Type.isSubType() is false.
TypeInfo info = getInfo( j2eeType );
if ( info.isSubType() )
{
throw new IllegalArgumentException( "j2eeType is a subtype: " + j2eeType );
}
final List<String> list = new ArrayList<String>();
String containedByType = null;
while ( (containedByType = info.getContainedByJ2EEType()) != null )
{
list.add( containedByType );
info = getInfo( containedByType );
}
Collections.reverse( list );
return( ListUtil.toStringArray( list ) );
|
private static javax.management.MBeanAttributeInfo[] | getExtraAttributeInfos()A design decision was to not include certain Attributes or pseuod-Attributes directly
in AMX, so these fields are separated out into 'Extra'. However, some of these
are real Attributes that do need to be present in the MBeanInfo supplied by each
MBean.
final MBeanAttributeInfo[] extraInfos =
JMXUtil.interfaceToMBeanInfo( Extra.class ).getAttributes();
// remove items that are client-side constructs; not real Attributes
final Map<String,MBeanAttributeInfo> m = JMXUtil.attributeInfosToMap( extraInfos );
for( int i = 0; i < EXTRA_REMOVALS.length; ++i )
{
m.remove( EXTRA_REMOVALS[ i ] );
}
final MBeanAttributeInfo[] result = new MBeanAttributeInfo[ m.values().size() ];
m.values().toArray( result );
return( result );
|
public TypeInfo | getInfo(java.lang.String j2eeType)
if ( j2eeType == null )
{
throw new IllegalArgumentException( "null" );
}
final TypeInfo info = (TypeInfo)mTypeToInfoMap.get( j2eeType );
if ( info == null )
{
throw new IllegalArgumentException( j2eeType );
}
return( info );
|
public static com.sun.enterprise.management.support.TypeInfos | getInstance()
// 'INSTANCE' must be 'volatile' !
if ( INSTANCE != null )
{
return INSTANCE;
}
// this is not the problematic "double null check"; 'INSTANCE' is volatile above
synchronized( TypeInfos.class )
{
if ( INSTANCE == null )
{
INSTANCE = new TypeInfos();
}
}
return INSTANCE;
|
public java.lang.String[] | getJ2EETypeChain(javax.management.ObjectName objectName)Get the j2eeType chain for the specified ObjectName. The last element
is the same as the j2eeType of the ObjectName supplied; preceeding
types, if present, are its parent types.
final String j2eeType = Util.getJ2EEType( objectName );
if ( j2eeType == null )
{
throw new IllegalArgumentException( objectName.toString() );
}
TypeInfo info = getInfo( j2eeType );
if ( info == null )
{
throw new IllegalArgumentException( "uknown j2eeType: " + j2eeType );
}
final List<String> list = new ArrayList<String>();
list.add( j2eeType );
while ( info.isSubType() )
{
final Set<String> possibleParentTypes = info.getLegalParentJ2EETypes();
String parentJ2EEType = null;
if ( possibleParentTypes.size() == 1 )
{
parentJ2EEType = GSetUtil.getSingleton( possibleParentTypes );
}
else
{
parentJ2EEType = JMXUtil.findKey( possibleParentTypes, objectName );
}
if ( parentJ2EEType == null )
{
throw new IllegalArgumentException(
"MBean: " + objectName +
" does not have any of the possible parent keys: {" +
toString( possibleParentTypes ) + "}" );
}
list.add( parentJ2EEType );
info = getInfo( parentJ2EEType );
}
// list is in reverse order; child, parent, parent's parent, etc. Reverse it
// so that child is last
Collections.reverse( list );
return( ListUtil.toStringArray( list ) );
|
public java.util.Set | getJ2EETypes()Return the keys by which all TypeInfos are mapped.
return( mTypeToInfoMap.keySet( ) );
|
private static java.util.logging.Logger | getLogger()
return java.util.logging.Logger.getLogger( com.sun.logging.LogDomains.ADMIN_LOGGER );
|
public javax.management.MBeanInfo | getMBeanInfoForInterface(java.lang.Class theInterface)
// does not need to be synchronized
return mMBeanInfos.get( theInterface );
|
private void | initChildAndContaineeTypes()
final Set<String> keys = getJ2EETypes();
for( final String childJ2EEType : keys )
{
final TypeInfo info = getInfo( childJ2EEType );
if ( info.isSubType() )
{
initParentsForChildType( info );
}
else // may be contained in something
{
final String containedByJ2EEType = info.getContainedByJ2EEType();
if ( containedByJ2EEType != null )
{
final TypeInfo parentInfo = getInfo( containedByJ2EEType );
parentInfo.addContaineeJ2EEType( childJ2EEType );
}
}
}
|
private void | initData()
final Object[] data = DATA;
for( int i = 0; i < data.length; ++i )
{
final TypeData typeData = (TypeData)data[ i ];
assert( ! mTypeToInfoMap.containsKey( typeData.getJ2EEType() )) :
"init(): type already exists: " + typeData.getJ2EEType();
try
{
add( typeData );
}
catch( final ClassNotFoundException e )
{
// this should never occur in a release version, so need need to I18n it; it's
// for development warning.
getLogger().warning( "SKIPPING AMX type--missing implementation class for: " +
typeData.getJ2EEType() );
}
}
|
private void | initMap()Initialize a mapping of j2eeTypes to TypeInfo
initData();
initChildAndContaineeTypes();
|
private void | initParentsForChildType(TypeInfo info)
if ( info.isSubType() )
{
final Set possibleParents = info.getLegalParentJ2EETypes();
final Iterator parentTypeIter = possibleParents.iterator();
while ( parentTypeIter.hasNext() )
{
final String parentJ2EEType = (String)parentTypeIter.next();
final TypeInfo parentInfo = getInfo( parentJ2EEType );
parentInfo.addChildJ2EEType( info.getJ2EEType() );
}
}
|
private void | populateMBeanInfos()
final MBeanAttributeInfo[] extra = getExtraAttributeInfos();
// create the MBeanInfo from the interfaces
for( final TypeInfo typeInfo: mTypeToInfoMap.values() )
{
final Class theInterface = typeInfo.getInterface();
final MBeanInfo info =
MBeanInfoConverter.getInstance().convert( theInterface, extra );
mMBeanInfos.put( theInterface, info );
}
|
public java.lang.String | toString()
final StringBuffer buf = new StringBuffer();
final Set<String> keys = getJ2EETypes();
for( final String j2eeType : keys )
{
final TypeInfo info = getInfo( j2eeType );
buf.append( info.toString() );
buf.append( "\n" );
}
return( buf.toString() );
|
private java.lang.String | toString(java.lang.Object o)
return( SmartStringifier.toString( o ) );
|