Search in sources :

Example 1 with PluginManager

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());
}
Also used : PluginManager(org.b3log.latke.plugin.PluginManager) UpgradeService(org.b3log.solo.service.UpgradeService) Transaction(org.b3log.latke.repository.Transaction) OptionRepository(org.b3log.solo.repository.OptionRepository)

Aggregations

PluginManager (org.b3log.latke.plugin.PluginManager)1 Transaction (org.b3log.latke.repository.Transaction)1 OptionRepository (org.b3log.solo.repository.OptionRepository)1 UpgradeService (org.b3log.solo.service.UpgradeService)1