FileDocCategorySizeDatePackage
MonitoringImplBase.javaAPI DocGlassfish v2 API5201Fri May 04 22:23:32 BST 2007com.sun.enterprise.management.monitor

MonitoringImplBase

public class MonitoringImplBase extends com.sun.enterprise.management.support.AMXImplBase
Base implementation class for Monitoring MBeans of all stripes; both those that have Stats and those that do not.

Fields Summary
Constructors Summary
public MonitoringImplBase(String j2eeType, com.sun.enterprise.management.support.Delegate delegate)

		super( j2eeType, delegate );
	
public MonitoringImplBase(String j2eeType)

		this( j2eeType, null );
	
Methods Summary
protected final java.lang.StringfixEJBModuleName(java.lang.String moduleName)
For whatever reason the com.sun.appserv MBeans use: =foo.jar,categor=runtime (JSR 77) =foo_jar,category=monitor (monitoring) We want both to be named "foo.jar" for two reasons: (1) for consistency, (2) so that the JSR 77 MBeans can find their corresponding monitors by name.

		final String	JAR	= "jar";
		
		String	result	= moduleName;
		
		if ( moduleName.endsWith( "_" + JAR ) )
		{
			result	= StringUtil.stripSuffix( moduleName, "_" + JAR ) + "." +JAR;
		}
		
		return( result );
	
protected final javax.management.ObjectNamefixEJBModuleName(javax.management.ObjectName objectNameIn, java.lang.String key)

		ObjectName	objectNameOut	= objectNameIn;
		
		final String	origName	= objectNameIn.getKeyProperty( key );
		if ( origName != null )
		{
			final String	fixedName	= fixEJBModuleName( origName );
			
			if ( ! fixedName.equals( origName ) )
			{
				objectNameOut	= JMXUtil.setKeyProperty( objectNameIn, key, fixedName);
			}
		}
		
		if ( ! objectNameOut.equals( objectNameIn ) )
		{
			logFiner( "MonitoringImplBase.fixEJBModuleName: modified " + 
				quote( objectNameIn ) + " => " + quote( objectNameOut ) );
		}
		return( objectNameOut );
	
public java.lang.StringgetGroup()

		return( AMX.GROUP_MONITORING );
	
public javax.management.ObjectNamegetServerRootMonitorObjectName()

	    ObjectName  objectName  = null;
	    
		final String	name	= getObjectName().getKeyProperty( XTypes.SERVER_ROOT_MONITOR );
		if ( name != null )
		{
    		final MonitoringRoot	root	= getDomainRoot().getMonitoringRoot();
    		final ServerRootMonitor	mon	=
    		    (ServerRootMonitor)root.getServerRootMonitorMap().get( name );
		
		    objectName  = Util.getObjectName( mon );
		}
		
		return( objectName );
	
protected javax.management.ObjectNamepreRegisterModifyName(javax.management.MBeanServer server, javax.management.ObjectName nameIn)
See {@link #fixEJBModuleName} for info on why this is being done.

		ObjectName	objectNameOut	= super.preRegisterModifyName( server, nameIn );
		
		if ( nameIn.getKeyProperty( XTypes.EJB_MODULE_MONITOR ) != null )
		{
			objectNameOut	= fixEJBModuleName( objectNameOut, XTypes.EJB_MODULE_MONITOR );
		}
		
		return objectNameOut;