/** * 该方法用于执行配置文件中配置的自动启动项 * * @param reader * @throws Exception */ void load(ConfigReader reader) throws Exception { InfoRestart[] infos = (InfoRestart[]) reader.getRestarts().toArray(new InfoRestart[0]); if (infos == null) return; // 先设置Locale信息 InfoLocale infoLocale = reader.getLocale(); Locale locale; if (infoLocale != null) { if (infoLocale.getVariant() != null) locale = new Locale(infoLocale.getLanguage(), infoLocale.getCountry(), infoLocale.getVariant()); else if (infoLocale.getCountry() != null) locale = new Locale(infoLocale.getLanguage(), infoLocale.getCountry()); else locale = new Locale(infoLocale.getLanguage()); } else locale = Locale.CHINA; Context.setLocale(locale); /** =====Restart init==== BaseDAO.init FactoryManager.init CacheManager.init */ for (int i = 0; i < infos.length; i++) { if (log.isInfoEnabled()) { log.info("[E5Load]restart:" + infos[i].getInvokeClass()); log.info("[E5Load]." + infos[i].getInvokeMethod()); } Class myClass = Class.forName(infos[i].getInvokeClass()); Method method = myClass.getMethod(infos[i].getInvokeMethod(), null); if (Modifier.isStatic(method.getModifiers())) method.invoke(null, null); else method.invoke(myClass.newInstance(), null); log.info("[E5Load]restart ok."); } // DBSession Init log.info("[E5Load]DBSession registering..."); for (int i = 0; i < reader.getDBSessions().size(); i++) { InfoDBSession db = (InfoDBSession) reader.getDBSessions().get(i); DBSessionFactory.registerDB(db.getName(), db.getImplementation()); } log.info("[E5Load]DBSession registered."); // ID Init for (int i = 0; i < reader.getIDs().size(); i++) { InfoID id = (InfoID) reader.getIDs().get(i); EUID.registerID(id.getName(), id.getType(), id.getParam()); } log.info("[E5Load]EUID registered."); }