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

MonitoringConfigChangeListener

public class MonitoringConfigChangeListener extends Object implements com.sun.enterprise.admin.event.MonitoringLevelChangeEventListener
Provides for the listener that listens for changes done by administrative interface and notifies them dynamically to core systems. This is the bridge between the notification subsystem and monitoring subsystem.
author
Kedar Mhaswade
since
S1AS8.0
version
$Revision: 1.4 $

Fields Summary
private final ChangeHandler
delegate
public static final String
EJB_CONTAINER
All fields actually refer to their counterparts in domain.xml. Actually the ServerTags class is to be reused, but it is auto-generated and there are some optimizations made to it, hence this repetition.
public static final String
WEB_CONTAINER
public static final String
THREAD_POOL
public static final String
ORB
public static final String
TRANSACTION_SERVICE
public static final String
HTTP_SERVICE
public static final String
JDBC_CONN_POOL
public static final String
CONNECTOR_CONN_POOL
public static final String
CONNECTOR_SERVICE
public static final String
JMS_SERVICE
public static final String
JNDI
public static final String
JVM
public static final String
WEBSERVICE_ENDPOINT
Constructors Summary
public MonitoringConfigChangeListener(ChangeHandler delegate)

		this.delegate = delegate;
	
Methods Summary
private voidhandleAllAffectedTypes(java.lang.String component, java.lang.String from, java.lang.String to)

		final MonitoredObjectType[]	types	= name2Types(component);
		final MonitoringLevel		oLevel	= MonitoringLevel.instance(from);
		final MonitoringLevel		nLevel	= MonitoringLevel.instance(to);
		for (int i = 0 ; i < types.length ; i++) {
			delegate.handleChange(types[i], oLevel, nLevel);
		}
	
public synchronized voidmonitoringLevelChanged(com.sun.enterprise.admin.event.MonitoringLevelChangeEvent event)


		//This will be done soon once I start receiving these events. These events have all info.
		//delegate.handleChange (type, from, to);
		final String component	= event.getComponentName();
		final String from		= event.getOldMonitoringLevel();
		final String to			= event.getNewMonitoringLevel();
		
        // sets the event to thread context 
        MonitoringThreadContext.setEventToThreadLocal(event);

		handleAllAffectedTypes(component, from, to);

        // removes the event from thread context
        MonitoringThreadContext.removeEventFromThreadLocal();
	
private com.sun.enterprise.admin.monitor.registry.MonitoredObjectType[]name2Types(java.lang.String component)

		MonitoredObjectType[] types = new MonitoredObjectType[0]; //empty array
		if (EJB_CONTAINER.equals(component)) {
			types = MonitoredObjectType.EJB_TYPES;
		}
		else if (WEB_CONTAINER.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.SERVLET;
		}
		else if (THREAD_POOL.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.THREAD_POOL;
		}
		else if (ORB.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.ORB;
		}
		else if (HTTP_SERVICE.equals(component)) {
			types = MonitoredObjectType.HTTP_SERVICE_TYPES;
		}
		else if (TRANSACTION_SERVICE.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.TRANSACTION_SERVICE;
		}
		else if (JDBC_CONN_POOL.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.JDBC_CONN_POOL;
		}
        else if (CONNECTOR_SERVICE.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.CONNECTOR_SERVICE;
		}
        else if (JVM.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.JVM;
		} else if (WEBSERVICE_ENDPOINT.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.WEBSERVICE_ENDPOINT;
        }
        /**
         * connector-service level will be modified whenever
         * the connector-connection-pool or jms-service is
         * modified, in addition to changes made directly to the
         * connector-service. It therefore makes sense to handle the
         * event only once i.e for connector-service and let the
         * others go unhandled.
        else if (CONNECTOR_CONN_POOL.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.CONNECTOR_SERVICE;
		}
        else if (JMS_SERVICE.equals(component)) {
			types = new MonitoredObjectType[1];
			types[0] = MonitoredObjectType.CONNECTOR_SERVICE;
		}
         */
		return ( types );