package org.maachang.comet.httpd.engine.script;

import org.maachang.comet.conf.IniFile;
import org.maachang.comet.conf.ServiceDef;
import org.maachang.comet.httpd.engine.script.cache.CacheScriptManager;
import org.maachang.comet.httpd.engine.script.cache.CacheTableWrapper;
import org.maachang.comet.httpd.engine.script.cache.StartupScript;
import org.maachang.manager.GlobalManager;

/**
 * リクエストに対する実行用ターゲットスクリプト.
 * 
 * @version 2007/11/28
 * @author masahito suzuki
 * @since MaachangComet 1.03
 */
public class ExecutionStartup {
    
    /**
     * 開始処理.
     */
    public static final void init() throws Exception {
        CacheTableWrapper w = CacheScriptManager.getInstance().getWrapper() ;
        IniFile ini = ( IniFile )GlobalManager.getValue( ServiceDef.MANAGER_BY_CONFIG ) ;
        StartupScript.startup( ini,w ) ;
    }
    
    /**
     * 終了処理.
     */
    public static final void destroy() {
        try {
            CacheTableWrapper w = CacheScriptManager.getInstance().getWrapper() ;
            IniFile ini = ( IniFile )GlobalManager.getValue( ServiceDef.MANAGER_BY_CONFIG ) ;
            StartupScript.shutdown( ini,w ) ;
        } catch( Exception e ) {
        }
    }
    
    
}
