Search in sources :

Example 1 with ConfigurationChecker

use of password.pwm.health.ConfigurationChecker in project pwm by pwm-project.

the class ConfigEditorServlet method restReadChangeLog.

@ActionHandler(action = "readChangeLog")
private ProcessStatus restReadChangeLog(final PwmRequest pwmRequest) throws IOException, PwmUnrecoverableException {
    final ConfigManagerBean configManagerBean = getBean(pwmRequest);
    final Locale locale = pwmRequest.getLocale();
    final HashMap<String, Object> returnObj = new HashMap<>();
    returnObj.put("html", configManagerBean.getStoredConfiguration().changeLogAsDebugString(locale, true));
    returnObj.put("modified", configManagerBean.getStoredConfiguration().isModified());
    try {
        final ConfigurationChecker configurationChecker = new ConfigurationChecker();
        final Configuration config = new Configuration(configManagerBean.getStoredConfiguration());
        final List<HealthRecord> healthRecords = configurationChecker.doHealthCheck(config, pwmRequest.getLocale());
        final HealthData healthData = new HealthData();
        healthData.setOverall("CONFIG");
        healthData.setRecords(password.pwm.ws.server.rest.bean.HealthRecord.fromHealthRecords(healthRecords, locale, config));
        returnObj.put("health", healthData);
    } catch (Exception e) {
        LOGGER.error(pwmRequest, "error generating health records: " + e.getMessage());
    }
    final RestResultBean restResultBean = RestResultBean.withData(returnObj);
    pwmRequest.outputJsonResult(restResultBean);
    return ProcessStatus.Halt;
}
Also used : Locale(java.util.Locale) ConfigurationChecker(password.pwm.health.ConfigurationChecker) HealthData(password.pwm.ws.server.rest.bean.HealthData) Configuration(password.pwm.config.Configuration) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ServletException(javax.servlet.ServletException) PwmUnrecoverableException(password.pwm.error.PwmUnrecoverableException) PwmOperationalException(password.pwm.error.PwmOperationalException) ChaiUnavailableException(com.novell.ldapchai.exception.ChaiUnavailableException) PwmException(password.pwm.error.PwmException) IOException(java.io.IOException) ConfigManagerBean(password.pwm.http.bean.ConfigManagerBean) HealthRecord(password.pwm.health.HealthRecord) RestResultBean(password.pwm.ws.server.RestResultBean)

Aggregations

ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Locale (java.util.Locale)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ServletException (javax.servlet.ServletException)1 Configuration (password.pwm.config.Configuration)1 PwmException (password.pwm.error.PwmException)1 PwmOperationalException (password.pwm.error.PwmOperationalException)1 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)1 ConfigurationChecker (password.pwm.health.ConfigurationChecker)1 HealthRecord (password.pwm.health.HealthRecord)1 ConfigManagerBean (password.pwm.http.bean.ConfigManagerBean)1 RestResultBean (password.pwm.ws.server.RestResultBean)1 HealthData (password.pwm.ws.server.rest.bean.HealthData)1