public void init() throws ServletException { int maxWaitSeconds = 5; // a default try { ServletContext context = getServletContext(); // init engine reference _engine = (EngineGateway) context.getAttribute("engine"); if (_engine == null) { Class<? extends YEngine> engineImpl = getEngineImplClass(); boolean persist = getBooleanFromContext("EnablePersistence"); boolean enableHbnStats = getBooleanFromContext("EnableHibernateStatisticsGathering"); _engine = new EngineGatewayImpl(engineImpl, persist, enableHbnStats); _engine.setActualFilePath(context.getRealPath("/")); context.setAttribute("engine", _engine); } // set flag to disable logging (only if false) - enabled with persistence by // default String logStr = context.getInitParameter("EnableLogging"); if ((logStr != null) && logStr.equalsIgnoreCase("false")) { _engine.disableLogging(); } // add the reference to the default worklist _engine.setDefaultWorklist(context.getInitParameter("DefaultWorklist")); // set flag for generic admin account (only if set to true) String allowAdminID = context.getInitParameter("AllowGenericAdminID"); if ((allowAdminID != null) && allowAdminID.equalsIgnoreCase("true")) { _engine.setAllowAdminID(true); } // set the path to external db gateway plugin classes (if any) String pluginPath = context.getInitParameter("ExternalPluginsPath"); ExternalDBGatewayFactory.setExternalPaths(pluginPath); PredicateEvaluatorFactory.setExternalPaths(pluginPath); // override the max time that initialisation events wait for between // final engine init and server start completion int maxWait = StringUtil.strToInt(context.getInitParameter("InitialisationAnnouncementTimeout"), -1); if (maxWait >= 0) maxWaitSeconds = maxWait; // read the current version properties _engine.initBuildProperties( context.getResourceAsStream("/WEB-INF/classes/version.properties")); // init any 3rd party observer gateways String gatewayStr = context.getInitParameter("ObserverGateway"); if (gatewayStr != null) { // split multiples on the semi-colon (if any) for (String gateway : gatewayStr.split(";")) { registerObserverGateway(gateway); } } } catch (YPersistenceException e) { _log.fatal("Failure to initialise runtime (persistence failure)", e); throw new UnavailableException("Persistence failure"); } if (_engine != null) { _engine.notifyServletInitialisationComplete(maxWaitSeconds); } else { _log.fatal( "Failed to initialise Engine (unspecified failure). Please " + "consult the logs for details"); throw new UnavailableException("Unspecified engine failure"); } }