FileDocCategorySizeDatePackage
MonitoringConfigurationHandler.javaAPI DocGlassfish v2 API13224Fri May 04 22:24:20 BST 2007com.sun.enterprise.admin.monitor.registry.spi.reconfig

MonitoringConfigurationHandler

public class MonitoringConfigurationHandler extends Object
author
Kedar Mhaswade
since
S1AS8.0
version
$Revision: 1.4 $

Fields Summary
private static Logger
logger
private static com.sun.enterprise.util.i18n.StringManager
sm
Constructors Summary
private MonitoringConfigurationHandler()

	  
	
Methods Summary
public static com.sun.enterprise.admin.monitor.registry.MonitoringLevelgetLevel(com.sun.enterprise.admin.monitor.registry.MonitoredObjectType objType)

		MonitoringLevel level = null;
		if (objType == MonitoredObjectType.APPLICATION	||
		objType == MonitoredObjectType.EJBMODULE	||
		objType == MonitoredObjectType.ROOT		||
		objType == MonitoredObjectType.STANDALONE_EJBMODULE ||
		objType == MonitoredObjectType.STANDALONE_WEBMODULE)
			level = MonitoringLevel.HIGH; //actually does not matter
		else if (objType == MonitoredObjectType.ENTITY_BEAN	||
		objType == MonitoredObjectType.BEAN_CACHE	||
		objType == MonitoredObjectType.BEAN_METHOD	||
		objType == MonitoredObjectType.BEAN_POOL	||
		objType == MonitoredObjectType.STATEFUL_BEAN	||
		objType == MonitoredObjectType.STATELESS_BEAN	||
		objType == MonitoredObjectType.MESSAGE_DRIVEN_BEAN ||
		objType == MonitoredObjectType.BEAN_METHODS ||
        objType == MonitoredObjectType.SESSION_STORE ||
        objType == MonitoredObjectType.TIMERS)
			level = getLevelFor(MonitoringConfigChangeListener.EJB_CONTAINER); // depends on config of ejb-container
		else if (objType == MonitoredObjectType.HTTP_LISTENER	||
		objType == MonitoredObjectType.VIRTUAL_SERVER ||
        objType == MonitoredObjectType.REQUEST ||
        objType == MonitoredObjectType.FILE_CACHE ||
        objType == MonitoredObjectType.PWC_THREAD_POOL ||
        objType == MonitoredObjectType.KEEP_ALIVE ||
        objType == MonitoredObjectType.DNS ||
        objType == MonitoredObjectType.CONNECTION_QUEUE ||
		objType == MonitoredObjectType.HTTP_SERVICE)
			return getLevelFor(MonitoringConfigChangeListener.HTTP_SERVICE); // depends on config of http-service
		else if (objType == MonitoredObjectType.SERVLET)
			level = getLevelFor(MonitoringConfigChangeListener.WEB_CONTAINER); // depends on config of web-container
		else if (objType == MonitoredObjectType.WEBMODULE)
			level = getLevelFor(MonitoringConfigChangeListener.WEB_CONTAINER); // depends on config of web-container
		else if (objType == MonitoredObjectType.CONNECTOR_CONN_POOL ||
                 objType == MonitoredObjectType.CONNECTOR_WORKMGMT ||
                 objType == MonitoredObjectType.JMS_SERVICE)
			level = getLevelFor(MonitoringConfigChangeListener.CONNECTOR_SERVICE); // depends on config connector-service
		else if (objType == MonitoredObjectType.JDBC_CONN_POOL)
			level = getLevelFor(MonitoringConfigChangeListener.JDBC_CONN_POOL); // depends on config of jdbc-pool
		else if (objType == MonitoredObjectType.JVM)
			level = getLevelFor(MonitoringConfigChangeListener.JVM);
		else if (objType == MonitoredObjectType.ORB ||
		objType == MonitoredObjectType.CONNECTION_MANAGERS ||
		objType == MonitoredObjectType.CONNECTION_MANAGER)
			level = getLevelFor(MonitoringConfigChangeListener.ORB); // depends on config of orb
		else if (objType == MonitoredObjectType.THREAD_POOL)
			level = getLevelFor(MonitoringConfigChangeListener.THREAD_POOL); // depends on config of threa-pool
		else if (objType == MonitoredObjectType.TRANSACTION_SERVICE)
			level = getLevelFor(MonitoringConfigChangeListener.TRANSACTION_SERVICE); // depends on config
        else if (objType == MonitoredObjectType.JNDI)
			level = getLevelFor(MonitoringConfigChangeListener.JNDI);
        else if (objType == MonitoredObjectType.WEBSERVICE_ENDPOINT)
			level =
            getLevelFor(MonitoringConfigChangeListener.WEBSERVICE_ENDPOINT);
		else
			logger.finer("Received  a MonitoringObjectType: " + objType + " for which there is no configuration in domain.xml - Returning NULL");
		return ( level );
	
private static com.sun.enterprise.admin.monitor.registry.MonitoringLevelgetLevelFor(java.lang.String name)
Gets the MonitoringLevel the "old way" i.e. from Config Beans. This will have to change.

		if (MonitoringConfigChangeListener.EJB_CONTAINER.equals(name))
			return ( ConfigGetter.getEjbContainerLevel() );
		else if (MonitoringConfigChangeListener.WEB_CONTAINER.equals(name))
			return ( ConfigGetter.getWebContainerLevel() );
		else if (MonitoringConfigChangeListener.HTTP_SERVICE.equals(name))
			return ( ConfigGetter.getHttpServiceLevel() );
		else if (MonitoringConfigChangeListener.TRANSACTION_SERVICE.equals(name))
			return ( ConfigGetter.getTransactionServiceLevel() );
		else if (MonitoringConfigChangeListener.ORB.equals(name))
			return ( ConfigGetter.getOrbLevel() );
		else if (MonitoringConfigChangeListener.THREAD_POOL.equals(name))
			return ( ConfigGetter.getThreadPoolLevel() );
		else if (MonitoringConfigChangeListener.JDBC_CONN_POOL.equals(name))
			return ( ConfigGetter.getJdbcConnectionPoolLevel() );
		else if (MonitoringConfigChangeListener.CONNECTOR_CONN_POOL.equals(name))
			return ConfigGetter.getConnectorServiceLevel();
        else if (MonitoringConfigChangeListener.CONNECTOR_SERVICE.equals(name))
			return ConfigGetter.getConnectorServiceLevel();
        else if (MonitoringConfigChangeListener.JMS_SERVICE.equals(name))
			return ConfigGetter.getConnectorServiceLevel();
        else if (MonitoringConfigChangeListener.JVM.equals(name))
            return ConfigGetter.getJvmLevel();
        else if (MonitoringConfigChangeListener.WEBSERVICE_ENDPOINT.equals(name)) {
            // XXX read the config for this particular web service endpoint
            // and return its monitoring level.
            return MonitoringLevel.LOW;
        }
		logger.finer("No configuration in domain.xml for the string: " + name);
		return ( null );
	
public static booleanshouldRegisterMBean(com.sun.enterprise.admin.monitor.registry.MonitoredObjectType type)

		final MonitoringLevel levelFromConfig = getLevel(type);

		return ( levelFromConfig == MonitoringLevel.LOW || levelFromConfig == MonitoringLevel.HIGH );