public HealthStateType update(ServerHealthState serverHealthState) { HealthStateType type = serverHealthState.getType(); if (serverHealthState.getLogLevel() == HealthStateLevel.OK) { if (serverHealth.containsKey(type)) { serverHealth.remove(type); } return null; } else { serverHealth.put(type, serverHealthState); return type; } }
public int getHttpCode() { return getType().getHttpCode(); }
public static JsonAction from(ServerHealthState serverHealthState) { if (serverHealthState.isSuccess()) { return jsonCreated(new LinkedHashMap()); } Map<String, Object> jsonLog = new LinkedHashMap<>(); jsonLog.put(ERROR_FOR_JSON, serverHealthState.getDescription()); return new JsonAction(serverHealthState.getType().getHttpCode(), jsonLog); }
public boolean containsError(HealthStateType type, HealthStateLevel level) { ServerHealthStates allLogs = logs(); for (ServerHealthState log : allLogs) { if (log.getType().equals(type) && log.getLogLevel() == level) { return true; } } return false; }
@Override public void onConfigChange(CruiseConfig newCruiseConfig) { for (ServerHealthState state : serverHealthService.logs()) { HealthStateScope currentScope = state.getType().getScope(); if (currentScope.isForJob()) { serverHealthService.removeByScope(currentScope); } } }
public void onConfigChange(CruiseConfig newCruiseConfig) { Set<HealthStateScope> materialScopes = toHealthStateScopes(newCruiseConfig.getAllUniqueMaterials()); for (ServerHealthState state : serverHealthService.logs()) { HealthStateScope currentScope = state.getType().getScope(); if (currentScope.isForMaterial() && !materialScopes.contains(currentScope)) { serverHealthService.removeByScope(currentScope); } } }
public boolean matchesSafely(ServerHealthService item) { for (ServerHealthState serverHealthState : item.logs()) { if (serverHealthState.getType().equals(healthStateType)) { entry = serverHealthState; return false; } } return true; }
@Override public void onEntityConfigChange(PipelineConfig pipelineConfig) { for (ServerHealthState state : serverHealthService.logs()) { HealthStateScope currentScope = state.getType().getScope(); if (currentScope.isForJob()) { String[] split = currentScope.getScope().split("/"); if (split.length > 0 && new CaseInsensitiveString(split[0]).equals(pipelineConfig.name())) { serverHealthService.removeByScope(currentScope); } } } } }
public boolean matchesSafely(ServerHealthService item) { allLogs = item.logs(); for (ServerHealthState serverHealthState : allLogs) { if (serverHealthState.getType().equals(healthStateType)) { entry = serverHealthState; } } if (!(entry != null)) { return false; } else { levelMatches = healthStateLevel == null || healthStateLevel.equals(entry.getLogLevel()); messageMatches = message == null || message.equals(entry.getMessage()); return levelMatches && messageMatches; } }