use of io.vertigo.app.config.xml.XMLAppConfigBuilder in project vertigo by KleeGroup.
the class AppServletStarter method contextInitialized.
/**
* Initialize and start Vertigo Home.
* @param servletContext ServletContext
*/
public void contextInitialized(final ServletContext servletContext) {
final long start = System.currentTimeMillis();
try {
// Initialisation du web context de l'application (porteur des singletons applicatifs)
ServletResourceResolverPlugin.setServletContext(servletContext);
// Création de l'état de l'application
// Lecture des paramètres de configuration
final Map<String, Param> webAppConf = createWebParams(servletContext);
WebAppContextParamPlugin.setParams(webAppConf);
// -----
final Properties bootConf = createBootProperties(servletContext);
Assertion.checkArgument(bootConf.containsKey("boot.applicationConfiguration"), "Param \"boot.applicationConfiguration\" is mandatory, check your .properties or web.xml.");
final XMLAppConfigBuilder appConfigBuilder = new XMLAppConfigBuilder();
appConfigBuilder.beginBoot();
// si présent on récupère le paramétrage du fichier externe de paramétrage log4j
if (bootConf.containsKey(LOG4J_CONFIGURATION_PARAM_NAME)) {
final String logFileName = bootConf.getProperty(LOG4J_CONFIGURATION_PARAM_NAME);
bootConf.remove(LOG4J_CONFIGURATION_PARAM_NAME);
// -----
appConfigBuilder.withLogConfig(new LogConfig(logFileName));
}
final String xmlModulesFileNames = bootConf.getProperty("boot.applicationConfiguration");
final String[] xmlFileNamesSplit = xmlModulesFileNames.split(";");
bootConf.remove("boot.applicationConfiguration");
// -----
appConfigBuilder.withModules(getClass(), bootConf, xmlFileNamesSplit);
// Initialisation de l'état de l'application
app = new AutoCloseableApp(appConfigBuilder.build());
appServletListener.onServletStart(getClass().getName());
} catch (final Exception e) {
LOG.error(e.getMessage(), e);
throw WrappedException.wrap(e, "Problème d'initialisation de l'application");
} finally {
if (LOG.isInfoEnabled()) {
LOG.info("Temps d'initialisation du listener " + (System.currentTimeMillis() - start));
}
}
}
use of io.vertigo.app.config.xml.XMLAppConfigBuilder in project vertigo by KleeGroup.
the class SmartAppConfigBuilder method buildAppConfig.
private static AppConfig buildAppConfig(final Properties conf) {
// Initialisation de l'état de l'application
final XMLAppConfigBuilder appConfigBuilder = new XMLAppConfigBuilder();
if (conf.containsKey("boot.applicationConfiguration")) {
final String xmlModulesFileNames = conf.getProperty("boot.applicationConfiguration");
final String[] xmlFileNamesSplit = xmlModulesFileNames.split(";");
conf.remove("boot.applicationConfiguration");
// -----
appConfigBuilder.withModules(SmartAppConfigBuilder.class, conf, xmlFileNamesSplit);
}
return appConfigBuilder.build();
}
Aggregations