//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package kinosearch.webapp;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import kinosearch.webapp.template.FreemakerProcessor;
import kinosearch.webapp.template.TemplateProcessor;

public class WebApp implements ServletContextListener {
    private static boolean _init = false;
    private static TemplateProcessor templateProcessor;

    public static TemplateProcessor getTemplateProcessor() {
        return _init ? templateProcessor : null;
    }

    public static Map<String, Object> getDefaultModel(ServletContext context) {
        Map<String, Object> model = new HashMap();
        model.put(".templatedir", context.getRealPath("WEB-INF"));
        model.put("basedir", context.getContextPath());
        model.put("version", "2.0.7с");
        model.put("rutext", "Поиск кино по пиратским кинотеатрам");
        return model;
    }

    public void contextInitialized(ServletContextEvent sce) {
        templateProcessor = new FreemakerProcessor();
        _init = true;
    }

    public void contextDestroyed(ServletContextEvent sce) {
        _init = false;
    }
}
