Search in sources :

Example 1 with ComponentType

use of io.jans.as.model.common.ComponentType in project jans by JanssenProject.

the class StatService method init.

public boolean init() {
    try {
        final Set<ComponentType> enabledComponents = appConfiguration.getEnabledComponentTypes();
        if (!enabledComponents.isEmpty() && !enabledComponents.contains(ComponentType.STAT)) {
            log.trace("Stat service is not enabled.");
            return false;
        }
        log.info("Initializing Stat Service");
        initNodeId();
        if (StringUtils.isBlank(nodeId)) {
            log.error("Failed to initialize stat service. statNodeId is not set in configuration.");
            return false;
        }
        if (StringUtils.isBlank(getBaseDn())) {
            log.error("Failed to initialize stat service. 'stat' base dn is not set in configuration.");
            return false;
        }
        final Date now = new Date();
        prepareMonthlyBranch(now);
        log.trace("Monthly branch created: {}", monthlyDn);
        setupCurrentEntry(now);
        log.info("Initialized Stat Service");
        initialized = true;
        return true;
    } catch (Exception e) {
        log.error("Failed to initialize Stat Service.", e);
        return false;
    }
}
Also used : ComponentType(io.jans.as.model.common.ComponentType) Date(java.util.Date) EntryPersistenceException(io.jans.orm.exception.EntryPersistenceException)

Aggregations

ComponentType (io.jans.as.model.common.ComponentType)1 EntryPersistenceException (io.jans.orm.exception.EntryPersistenceException)1 Date (java.util.Date)1