FileDocCategorySizeDatePackage
EngineConfig.javaAPI DocGlassfish v2 API6256Fri May 04 22:32:30 BST 2007org.apache.catalina.startup

EngineConfig

public final class EngineConfig extends Object implements org.apache.catalina.LifecycleListener
Startup event listener for a Engine that configures the properties of that Engine, and the associated defined contexts.
author
Craig R. McClanahan
version
$Revision: 1.3 $ $Date: 2007/05/05 05:32:29 $

Fields Summary
private int
debug
The debugging detail level for this component.
private org.apache.catalina.Engine
engine
The Engine we are associated with.
private static final org.apache.catalina.util.StringManager
sm
The string resources for this package.
Constructors Summary
Methods Summary
public intgetDebug()
Return the debugging detail level for this component.



    // ------------------------------------------------------------- Properties


                 
       

        return (this.debug);

    
public voidlifecycleEvent(org.apache.catalina.LifecycleEvent event)
Process the START event for an associated Engine.

param
event The lifecycle event that has occurred


        // Identify the engine we are associated with
        try {
            engine = (Engine) event.getLifecycle();
            if (engine instanceof StandardEngine) {
                int engineDebug = ((StandardEngine) engine).getDebug();
                if (engineDebug > this.debug)
                    this.debug = engineDebug;
            }
        } catch (ClassCastException e) {
            log(sm.getString("engineConfig.cce", event.getLifecycle()), e);
            return;
        }

        // Process the event that has occurred
        if (event.getType().equals(Lifecycle.START_EVENT))
            start();
        else if (event.getType().equals(Lifecycle.STOP_EVENT))
            stop();

    
private voidlog(java.lang.String message)
Log a message on the Logger associated with our Engine (if any)

param
message Message to be logged


        Logger logger = null;
        if (engine != null)
            logger = engine.getLogger();
        if (logger != null)
            logger.log("EngineConfig: " + message);
        else
            System.out.println("EngineConfig: " + message);

    
private voidlog(java.lang.String message, java.lang.Throwable throwable)
Log a message on the Logger associated with our Engine (if any)

param
message Message to be logged
param
throwable Associated exception


        Logger logger = null;
        if (engine != null)
            logger = engine.getLogger();
        if (logger != null)
            logger.log("EngineConfig: " + message, throwable);
        else {
            System.out.println("EngineConfig: " + message);
            System.out.println("" + throwable);
            throwable.printStackTrace(System.out);
        }

    
public voidsetDebug(int debug)
Set the debugging detail level for this component.

param
debug The new debugging detail level


        this.debug = debug;

    
private voidstart()
Process a "start" event for this Engine.


        if (debug > 0)
            log(sm.getString("engineConfig.start"));

    
private voidstop()
Process a "stop" event for this Engine.


        if (debug > 0)
            log(sm.getString("engineConfig.stop"));