FileDocCategorySizeDatePackage
ApplicationClientModuleLoader.javaAPI DocGlassfish v2 API8449Fri May 04 22:35:40 BST 2007com.sun.enterprise.server

ApplicationClientModuleLoader

public class ApplicationClientModuleLoader extends AbstractLoader
Application client loader loads and unloads stand alone Application client module.
author
Sreenivas Munnangi
since
JDK1.4

Fields Summary
private com.sun.enterprise.deployment.ApplicationClientDescriptor
acDescriptor
static Logger
_logger
private com.sun.enterprise.server.event.ApplicationLoaderEventNotifier
appLoaderEventNotifier
Constructors Summary
ApplicationClientModuleLoader(String modID, ClassLoader parentClassLoader, com.sun.enterprise.instance.AppclientModulesManager acModulesManager)
ApplicationClientModuleLoader loads one module.

param
modID the name of the Application client module
param
parentClassLoader the parent class loader
param
acModulesManager the application client module mgr


                                                   
       
              

        super(modID, parentClassLoader, acModulesManager);

	setDescriptor();

         try {
             this.application = acModulesManager.getDescriptor(modID, parentClassLoader, false);
             appLoaderEventNotifier =
                 ApplicationLoaderEventNotifier.getInstance();
         } catch (ConfigException ce) {
             _logger.log(Level.SEVERE,"loader.error_while_loading_app_desc",
                         ce);
         }
    
Methods Summary
voidcreateLeafMBean(com.sun.enterprise.deployment.Descriptor descriptor)
Create jsr77 mBeans for ejbs within this module


	return;
    
voidcreateLeafMBeans()
Create jsr77 mBeans for ejbs within this module


	return;
    
voidcreateRootMBean()
Create jsr77 root mBean


	try {
            Switch.getSwitch().getManagementObjectManager().registerAppClient(
		acDescriptor,
		this.configManager.getInstanceEnvironment().getName(),
		this.configManager.getLocation(this.id));
	} catch (Exception e) {
	    throw new MBeanException(e);
	}
    
voiddeleteLeafAndRootMBeans()
Delete jsr77 mBeans for the module and its' components

        deleteLeafMBeans();
        deleteRootMBean();
    
voiddeleteLeafMBean(com.sun.enterprise.deployment.Descriptor descriptor)
Delete jsr77 mBeans for ejbs within this module


	return;
    
voiddeleteLeafMBeans()
Delete jsr77 mBeans for ejbs within this module


	return;
    
voiddeleteRootMBean()
Delete jsr77 root mBean


        Switch.getSwitch().getManagementObjectManager().unregisterAppClient(
		acDescriptor,
		this.configManager.getInstanceEnvironment().getName());
    
booleandoLoad(boolean jsr77)
Loads the app client. Although the app client logic is not actually loaded into the app server, there may be some components interested in the load operation, so notify them.

param
jsr77 create jsr77 mBeans if true
return
true if load is successful

 	notifyAppClientEvent(ApplicationClientEvent.BEFORE_APPLICATION_CLIENT_LOAD);
 
        notifyAppClientEvent(ApplicationClientEvent.AFTER_APPLICATION_CLIENT_LOAD);
         
	return true;
    
private com.sun.enterprise.deployment.ApplicationClientDescriptorgetApplicationClientDescriptor()

	ApplicationClientDescriptor appCD = null;
	try {
            Application app = configManager.getDescriptor(this.id, null, false);
            appCD = (ApplicationClientDescriptor) app.getStandaloneBundleDescriptor();
        } catch(ConfigException ex) {
            _logger.log(Level.WARNING,"Failed to get the ApplicationClientDescriptor");
        }
	return appCD;
    
protected voidnotifyAppClientEvent(int eventType)
Notifies interested listeners of the load or unload operation.

param
the type of event to broadcast

 	ApplicationClientEvent event = new ApplicationClientEvent(eventType,
 		getApplication(), getClassLoader(), getConfigContext());
 	appLoaderEventNotifier.notifyListeners(event);
     
private voidsetDescriptor()

	acDescriptor = getApplicationClientDescriptor();
    
voidsetState(int state)
Set state for the root mBean


	return;
    
booleanunload(boolean jsr77)
Unloads the app client. Because no code is actually loaded into the server for app clients, there is none to unload. Still, notify any interested listeners.

param
jsr77 delete jsr77 mBeans if true
return
true if unload is successful

 	notifyAppClientEvent(ApplicationClientEvent.BEFORE_APPLICATION_CLIENT_UNLOAD);
 
        configManager.unregisterDescriptor(id);
         
        notifyAppClientEvent(ApplicationClientEvent.AFTER_APPLICATION_CLIENT_UNLOAD);
        return true;