Search in sources :

Example 1 with PreferenceMgmtService

use of org.b3log.solo.service.PreferenceMgmtService in project solo by b3log.

the class SoloServletListener method loadPreference.

/**
     * Loads preference.
     *
     * <p>
     * Loads preference from repository, loads skins from skin directory then sets it into preference if the skins
     * changed.
     * </p>
     */
private void loadPreference() {
    Stopwatchs.start("Load Preference");
    LOGGER.debug("Loading preference....");
    final PreferenceQueryService preferenceQueryService = beanManager.getReference(PreferenceQueryService.class);
    JSONObject preference;
    try {
        preference = preferenceQueryService.getPreference();
        if (null == preference) {
            LOGGER.info("Please open browser and visit [" + Latkes.getServePath() + "] to init your Solo, " + "and then enjoy it :-p");
            return;
        }
        final PreferenceMgmtService preferenceMgmtService = beanManager.getReference(PreferenceMgmtService.class);
        preferenceMgmtService.loadSkins(preference);
    } catch (final Exception e) {
        LOGGER.log(Level.ERROR, e.getMessage(), e);
        throw new IllegalStateException(e);
    }
    Stopwatchs.end();
}
Also used : PreferenceQueryService(org.b3log.solo.service.PreferenceQueryService) JSONObject(org.json.JSONObject) PreferenceMgmtService(org.b3log.solo.service.PreferenceMgmtService)

Aggregations

PreferenceMgmtService (org.b3log.solo.service.PreferenceMgmtService)1 PreferenceQueryService (org.b3log.solo.service.PreferenceQueryService)1 JSONObject (org.json.JSONObject)1