Methods Summary |
---|
public java.util.Set | findAllOldCandidates()
final ObjectName pattern = JMXUtil.newObjectName( "com.sun.appserv", JMXUtil.WILD_ALL );
final Set<ObjectName> all = JMXUtil.queryNames( getMBeanServer(), pattern, null );
final Set<ObjectName> results = new HashSet<ObjectName>();
for( final ObjectName objectName : all )
{
if ( shouldSync( objectName ) )
{
results.add( objectName );
}
}
return( results );
|
protected java.util.Set | getIgnoreTypes()
return( Collections.EMPTY_SET );
|
protected java.lang.Class | getImplClass(javax.management.ObjectName newObjectName, javax.management.ObjectName oldObjectName)
Class implClass = super.getImplClass( newObjectName, oldObjectName );
final boolean isJ2EEServer =
Util.getJ2EEType( newObjectName ).equals( J2EETypes.J2EE_SERVER );
if ( isJ2EEServer )
{
// it's a J2EEServer; determine if it's running in the DAS itself
// in which case we need a different impl
final String serverName = Util.getName( newObjectName );
final boolean isAdminServer = serverRunningInDAS( serverName );
if ( isAdminServer )
{
try
{
implClass =
ClassUtil.getClassFromName( "com.sun.enterprise.management.j2ee.DASJ2EEServerImpl");
}
catch (ClassNotFoundException cnfe)
{
try
{
implClass = ClassUtil.getClassFromName(
"com.sun.enterprise.management.j2ee.J2EEServerImpl" );
}
catch( ClassNotFoundException e )
{
throw new RuntimeException( e );
}
}
}
getLogger().fine(
"LoaderOfOld77.getImplClass: Using J2EEServer impl of class: " +
implClass.getName() +
" for server " + serverName );
}
return( implClass );
|
protected java.util.Set | getNeedsSupport()
return( Collections.EMPTY_SET );
|
private java.util.Map | getOld77Props(javax.management.ObjectName oldObjectName)
final Map<String,String> m = new HashMap<String,String>();
for( int i = 0; i < CONTAINMENT_KEYS_77.length; ++i )
{
final String key = CONTAINMENT_KEYS_77[ i ];
final String value = oldObjectName.getKeyProperty( key );
if ( value != null )
{
m.put( key, value );
}
}
return( m );
|
private boolean | hasValidWebModuleName(javax.management.ObjectName objectName)
boolean isValid = true;
final String j2eeType = Util.getJ2EEType( objectName );
// Our WebModule names are of the form //<virtual-server-name>/<web-module-name>.
// some of them are "defective" and lack a <web-module-name> part
// no empty web-module names allowed (bug in underlying MBean naming), see bug #6180648
if ( j2eeType.equals( J2EETypes.SERVLET ) )
{
final String compositeName = objectName.getKeyProperty( J2EETypes.WEB_MODULE );
isValid = isValidCompositeWebModuleName( compositeName );
}
else if (j2eeType.equals( J2EETypes.WEB_SERVICE_ENDPOINT))
{
// check if this web service endpoint belong to EJB module
final String ejbModName = objectName.getKeyProperty( J2EETypes.EJB_MODULE);
if (ejbModName != null)
{
isValid = true;
}
else
{
final String compositeName = objectName.getKeyProperty( J2EETypes.WEB_MODULE );
isValid = isValidCompositeWebModuleName( compositeName );
}
}
else if ( j2eeType.equals( J2EETypes.WEB_MODULE ) )
{
final String compositeName = objectName.getKeyProperty( AMX.NAME_KEY );
isValid = isValidCompositeWebModuleName( compositeName );
}
return( isValid );
|
private boolean | isOld77ObjectName(javax.management.ObjectName objectName)
final String j2eeType = objectName.getKeyProperty( "j2eeType" );
boolean ret = ( j2eeType != null &&
! objectName.getDomain().equals( mAMXJMXDomain ) );
return ret;
|
public boolean | isOldMBean(javax.management.ObjectName objectName)
boolean shouldSync = isOld77ObjectName( objectName );
if ( shouldSync )
{
final String j2eeType = Util.getJ2EEType( objectName );
shouldSync = SYNC_TYPES.contains( j2eeType );
if ( shouldSync && ! hasValidWebModuleName( objectName ) )
{
// the MBean will load just fine, but other downstream problems will occur
shouldSync = false;
getLogger().warning(
"Not registering AMX MBean against old MBean " + StringUtil.quote( objectName ) +
" due to malformed composite WebModule name." );
}
}
return( shouldSync );
|
private boolean | isValidCompositeWebModuleName(java.lang.String compositeName)
boolean valid = false;
try
{
final String webModuleName = WebModuleSupport.extractWebModuleName( compositeName );
// An empty name is valid, too, if it's the default web module.
valid = true;
}
catch( Exception e )
{
}
return valid;
|
protected javax.management.ObjectName | oldToNewObjectName(javax.management.ObjectName oldObjectName)JSR77 has some inconsistent approaches to its containment hierarchy; it omits
implied parents, which causes headaches for generic navigation. This routine
accounts for those issues.
final String j2eeType = Util.getJ2EEType( oldObjectName );
final String j2eeDomainName = getAMXJMXDomainName();
final Map<String,String> propsMap = getOld77Props( oldObjectName );
if ( j2eeType.equals( J2EETypes.J2EE_DOMAIN ) )
{
// name must be changed to match domain
propsMap.put( AMX.NAME_KEY, j2eeDomainName );
}
else if ( j2eeType.equals( J2EETypes.J2EE_SERVER ) )
{
}
else
{
// everything else has a parent
}
final String props = JMXUtil.mapToProps( propsMap );
final ObjectName newName = Util.newObjectName( j2eeDomainName, props );
return( newName );
|
private final boolean | serverRunningInDAS(java.lang.String serverName)
boolean runningInDAS = false;
if ( mIsDAS )
{
// Simplifying assumption: only one server runs in DAS
runningInDAS = true;
}
return( runningInDAS );
|