Search in sources :

Example 1 with AuditingConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType in project midpoint by Evolveum.

the class LoggingDto method init.

private void init(LoggingConfigurationType config) {
    if (config == null) {
        return;
    }
    rootLevel = config.getRootLoggerLevel();
    rootAppender = config.getRootLoggerAppender();
    for (SubSystemLoggerConfigurationType logger : config.getSubSystemLogger()) {
        filters.add(new FilterConfiguration(logger));
    }
    AuditingConfigurationType auditing = config.getAuditing();
    if (auditing != null) {
        setAuditLog(auditing.isEnabled());
        setAuditDetails(auditing.isDetails());
        setAuditAppender(auditing.getAppender() != null && auditing.getAppender().size() > 0 ? auditing.getAppender().get(0) : null);
    }
    for (ClassLoggerConfigurationType logger : config.getClassLogger()) {
        if (ProfilingDto.LOGGER_PROFILING.equals(logger.getPackage())) {
            continue;
        }
        if (componentMap.containsKey(logger.getPackage())) {
            loggers.add(new ComponentLogger(logger));
        } else if (StandardLogger.isStandardLogger(logger.getPackage())) {
            loggers.add(new StandardLogger(logger));
        } else {
            loggers.add(new ClassLogger(logger));
        }
    }
    Collections.sort(loggers, new Comparator<LoggerConfiguration>() {

        @Override
        public int compare(LoggerConfiguration l1, LoggerConfiguration l2) {
            return String.CASE_INSENSITIVE_ORDER.compare(l1.getName(), l2.getName());
        }
    });
    Collections.sort(filters, new Comparator<FilterConfiguration>() {

        @Override
        public int compare(FilterConfiguration f1, FilterConfiguration f2) {
            return String.CASE_INSENSITIVE_ORDER.compare(f1.getName(), f2.getName());
        }
    });
}
Also used : AuditingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) SubSystemLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)

Example 2 with AuditingConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType in project midpoint by Evolveum.

the class LoggingDto method getNewObject.

public LoggingConfigurationType getNewObject() {
    LoggingConfigurationType configuration = new LoggingConfigurationType();
    AuditingConfigurationType audit = new AuditingConfigurationType();
    audit.setEnabled(isAuditLog());
    audit.setDetails(isAuditDetails());
    if (StringUtils.isNotEmpty(getAuditAppender())) {
        audit.getAppender().add(getAuditAppender());
    }
    configuration.setAuditing(audit);
    configuration.setRootLoggerAppender(getRootAppender());
    configuration.setRootLoggerLevel(getRootLevel());
    for (AppenderConfiguration item : getAppenders()) {
        configuration.getAppender().add(item.getConfig());
    }
    for (LoggerConfiguration item : getLoggers()) {
        for (ClassLoggerConfigurationType logger : configuration.getClassLogger()) {
            if (logger.getPackage().equals(item.getName())) {
                throw new IllegalStateException("Logger with name '" + item.getName() + "' is already defined.");
            }
        }
        //TODO : clean up toXmlType() method.. getAppenders() in LogginConfiguration is empty by default..shouldn't it be null?
        if (item.toXmlType() != null) {
            configuration.getClassLogger().add(item.toXmlType());
        }
    }
    for (FilterConfiguration item : getFilters()) {
        for (SubSystemLoggerConfigurationType filter : configuration.getSubSystemLogger()) {
            if (filter.getComponent().name().equals(item.getName())) {
                throw new IllegalStateException("Filter with name '" + item.getName() + "' is already defined.");
            }
        }
        configuration.getSubSystemLogger().add(item.toXmlType());
    }
    for (LoggerConfiguration logger : getLoggers()) {
        logger.setEditing(false);
    }
    for (FilterConfiguration filter : getFilters()) {
        filter.setEditing(false);
    }
    for (AppenderConfiguration appender : getAppenders()) {
        appender.setEditing(false);
    }
    return configuration;
}
Also used : AuditingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) SubSystemLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)

Example 3 with AuditingConfigurationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType in project midpoint by Evolveum.

the class AbstractWebserviceTest method checkAuditEnabled.

private void checkAuditEnabled(SystemConfigurationType configurationType) throws FaultMessage {
    LoggingConfigurationType loggingConfig = configurationType.getLogging();
    AuditingConfigurationType auditConfig = loggingConfig.getAuditing();
    if (auditConfig == null) {
        auditConfig = new AuditingConfigurationType();
        auditConfig.setEnabled(true);
        loggingConfig.setAuditing(auditConfig);
    } else {
        if (BooleanUtils.isTrue(auditConfig.isEnabled())) {
            return;
        }
        auditConfig.setEnabled(true);
    }
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), "logging", ModificationTypeType.REPLACE, loggingConfig);
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    assertSuccess(deltaOpList);
}
Also used : ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Aggregations

AuditingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AuditingConfigurationType)2 ClassLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType)2 SubSystemLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SubSystemLoggerConfigurationType)2 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)1 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)1 LoggingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType)1