FileDocCategorySizeDatePackage
ApplicationEvent.javaAPI DocGlassfish v2 API5538Fri May 04 22:35:44 BST 2007com.sun.enterprise.server.event

ApplicationEvent

public class ApplicationEvent extends Object
ApplicationEvents are sent before/after an application is loaded/unloaded. Listeners that are interested in getting ApplicationLaoderEvents can register with the ApplicationLoaderEventNotifier as follows: ApplicationLoaderEventNotifier notifier = ApplicationLoaderEventNotifier.getInstance(); notifier.addListener(listener); Application events are sent even when StandaloneModules are deployed / undeployed. ApplicationEvent.getApplication().isVirtual() will return true for stand-alone modules and false otherwise. Generally, APPLICATION events are sent in the following order a) BEFORE_APPLICATION_LOADED b) AFTER_APPLICATION_LOADED c) BEFORE_APPLICATION_UNLOADED d) AFTER_APPLICATION_UNLOADED Note:- There are some cases, when AFTER_APPLICATION_LOADED and BEFORE_APPLICATION_UNLOAD will not be sent to listeners. In particular, if an Ejb cannot be loaded successfully then no AFTER_APPLICATION_LOADED and BEFORE_APPLICATION_UNLOAD will be sent to the listeners.

Fields Summary
public static final int
BEFORE_APPLICATION_LOAD
public static final int
AFTER_APPLICATION_LOAD
public static final int
BEFORE_APPLICATION_UNLOAD
public static final int
AFTER_APPLICATION_UNLOAD
private int
eventType
private com.sun.enterprise.deployment.Application
application
private ClassLoader
loader
private com.sun.enterprise.config.ConfigContext
configContext
Constructors Summary
public ApplicationEvent(int eventType, com.sun.enterprise.deployment.Application application, ClassLoader loader, com.sun.enterprise.config.ConfigContext configContext)


        
	       
    
	this.eventType = eventType;
	this.application = application;
	this.loader = loader;
        this.configContext = configContext;
    
Methods Summary
public com.sun.enterprise.deployment.ApplicationgetApplication()

	return this.application;
    
public java.lang.ClassLoadergetClassLoader()

	return this.loader;
    
public com.sun.enterprise.config.ConfigContextgetConfigContext()

        return this.configContext;
    
public intgetEventType()

	return this.eventType;
    
public java.lang.StringtoString()

        StringBuffer sbuf = new StringBuffer("AppEvent: ");
        return toString(sbuf);
    
protected java.lang.StringtoString(java.lang.StringBuffer sbuf)
Appends event info to the already-instantiated StringBuffer argument.

param
StringBuffer already created and, optionally, already containing a prefix identfying which type of event this is.

	switch (eventType) {
	    case BEFORE_APPLICATION_LOAD:
		sbuf.append("BEFORE_LOAD -> ");
		break;
	    case AFTER_APPLICATION_LOAD:
		sbuf.append("AFTER_LOAD -> ");
		break;
	    case BEFORE_APPLICATION_UNLOAD:
		sbuf.append("BEFORE_UNLOAD -> ");
		break;
	    case AFTER_APPLICATION_UNLOAD:
		sbuf.append("AFTER_UNLOAD -> ");
		break;
	    default:
		//
	}

	if (application != null) {
	    sbuf.append(application.getRegistrationName());
	}
	return sbuf.toString();