use of org.b3log.latke.plugin.PluginManager in project solo by b3log.
the class SoloServletListener method contextInitialized.
@Override
public void contextInitialized(final ServletContextEvent servletContextEvent) {
// For Latke IoC
Latkes.setScanPath("org.b3log.solo");
super.contextInitialized(servletContextEvent);
Stopwatchs.start("Context Initialized");
beanManager = Lifecycle.getBeanManager();
// Upgrade check (https://github.com/b3log/solo/issues/12040)
final UpgradeService upgradeService = beanManager.getReference(UpgradeService.class);
upgradeService.upgrade();
JdbcRepository.dispose();
// Set default skin, loads from preference later
Skins.setDirectoryForTemplateLoading(Option.DefaultPreference.DEFAULT_SKIN_DIR_NAME);
final OptionRepository optionRepository = beanManager.getReference(OptionRepositoryImpl.class);
final Transaction transaction = optionRepository.beginTransaction();
try {
loadPreference();
if (transaction.isActive()) {
transaction.commit();
}
} catch (final Exception e) {
if (transaction.isActive()) {
transaction.rollback();
}
}
registerEventProcessor();
final PluginManager pluginManager = beanManager.getReference(PluginManager.class);
pluginManager.load();
LOGGER.info("Solo is running [" + Latkes.getServePath() + "]");
Stopwatchs.end();
LOGGER.log(Level.DEBUG, "Stopwatch: {0}{1}", Strings.LINE_SEPARATOR, Stopwatchs.getTimingStat());
}
Aggregations