FileDocCategorySizeDatePackage
JavaEEServiceEngineLifeCycle.javaAPI DocGlassfish v2 API6858Fri May 04 22:30:24 BST 2007com.sun.enterprise.jbi.serviceengine.bridge

JavaEEServiceEngineLifeCycle

public class JavaEEServiceEngineLifeCycle extends Object implements com.sun.appserv.server.ServerLifecycle
author
Manisha Umbarje

Fields Summary
private static Logger
logger
public String
DEFAULT_COMPONENT_NAME
Constructors Summary
public JavaEEServiceEngineLifeCycle()
Creates a new instance of JavaEEServiceEngineLifeCycle

    
    
           
      
    
Methods Summary
public voidonInitialization(com.sun.enterprise.server.ServerContext sc)
Server is initializing subsystems and setting up the runtime environment. Prepare for the beginning of active use of the public methods of this subsystem. This method is called before any of the public methods of this subsystem are utilized.

param
sc ServerContext the server runtime context.
exception
IllegalStateException if this subsystem has already been started
exception
ServerLifecycleException if this subsystem detects a fatal error that prevents this subsystem from being used

        logger.log(Level.FINEST, "se_lifecycle_initializing");
        /*ApplicationLoaderEventNotifier.getInstance().
                        addListener(ApplicationLoaderEventListenerImpl.getInstance());*/
        
    
public voidonReady(com.sun.enterprise.server.ServerContext sc)
Server has complted loading the applications and is ready to serve requests.

param
sc ServerContext the server runtime context.
exception
ServerLifecycleException if this subsystem detects a fatal error that prevents this subsystem from being used

        
        
        
        Installer installer =
                ServiceEngineObjectFactoryImpl.getInstance().
                createInstaller();
        if(installer.isJBIInstalled()) {
            installer.setComponentName(DEFAULT_COMPONENT_NAME);
            try {
                boolean installedFlag = installer.isComponentInstalled();
                logger.log(Level.FINE, "Is Java EE Service Engine installed " + installedFlag);
                
                if(ServiceEngineUtil.isServiceEngineEnabled()) {
                    //Assumption here is if service engine is already installed,
                    // It will be resumed in its state by the JBI framework
                    if(!installedFlag) {
                        installer.install(null);
                        installer.start();
                    }
                }else {
                    logger.log(Level.FINEST, "Java EE Service Engine is disabled");
                    if(installedFlag) {
                        // If service engine is disabled, stop the service engine
                        try {
                            installer.stop();
                        } catch(Exception e) {
                        }
                    }
                }
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    
public voidonShutdown()
Server is shutting down applications

exception
ServerLifecycleException if this subsystem detects a fatal error that prevents this subsystem from being used

    
public voidonStartup(com.sun.enterprise.server.ServerContext sc)
Server is starting up applications

param
sc ServerContext the server runtime context.
exception
ServerLifecycleException if this subsystem detects a fatal error that prevents this subsystem from being used

        logger.log(Level.FINEST, "se_lifecycle_starting");
    
public voidonTermination()
Server is terminating the subsystems and the runtime environment. Gracefully terminate the active use of the public methods of this subsystem. This method should be the last one called on a given instance of this subsystem.

exception
ServerLifecycleException if this subsystem detects a fatal error that prevents this subsystem from being used