Search in sources :

Example 11 with HealthRecord

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

the class ConfigEditorServlet method restDatabaseHealthCheck.

@ActionHandler(action = "databaseHealthCheck")
private ProcessStatus restDatabaseHealthCheck(final PwmRequest pwmRequest) throws IOException, PwmUnrecoverableException {
    final Instant startTime = Instant.now();
    final ConfigManagerBean configManagerBean = getBean(pwmRequest);
    LOGGER.debug(pwmRequest, "beginning restDatabaseHealthCheck");
    final Configuration config = new Configuration(configManagerBean.getStoredConfiguration());
    final List<HealthRecord> healthRecords = DatabaseStatusChecker.checkNewDatabaseStatus(pwmRequest.getPwmApplication(), config);
    final HealthData healthData = HealthRecord.asHealthDataBean(config, pwmRequest.getLocale(), healthRecords);
    final RestResultBean restResultBean = RestResultBean.withData(healthData);
    pwmRequest.outputJsonResult(restResultBean);
    LOGGER.debug(pwmRequest, "completed restDatabaseHealthCheck in " + TimeDuration.fromCurrent(startTime).asCompactString());
    return ProcessStatus.Halt;
}
Also used : HealthData(password.pwm.ws.server.rest.bean.HealthData) ConfigManagerBean(password.pwm.http.bean.ConfigManagerBean) HealthRecord(password.pwm.health.HealthRecord) Configuration(password.pwm.config.Configuration) Instant(java.time.Instant) RestResultBean(password.pwm.ws.server.RestResultBean)

Aggregations

HealthRecord (password.pwm.health.HealthRecord)11 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 Configuration (password.pwm.config.Configuration)4 PwmException (password.pwm.error.PwmException)4 RestResultBean (password.pwm.ws.server.RestResultBean)4 HealthData (password.pwm.ws.server.rest.bean.HealthData)4 IOException (java.io.IOException)3 Instant (java.time.Instant)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 ConfigManagerBean (password.pwm.http.bean.ConfigManagerBean)3 ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)2 Map (java.util.Map)2 ServletException (javax.servlet.ServletException)2 PwmApplication (password.pwm.PwmApplication)2 PwmOperationalException (password.pwm.error.PwmOperationalException)2 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)2 TimeDuration (password.pwm.util.java.TimeDuration)2 PasswordRuleHelper (com.novell.ldapchai.util.PasswordRuleHelper)1