use of org.ovirt.engine.core.utils.EngineLocalConfig in project ovirt-engine by oVirt.
the class ContextSensitiveHelpMappingServlet method getManualDir.
/**
* Get the configured manual directory from the servlet config.
*/
protected String getManualDir(ServletConfig config) {
EngineLocalConfig engineLocalConfig = EngineLocalConfig.getInstance();
String manualDir = ServletUtils.getAsAbsoluteContext(getServletContext().getContextPath(), engineLocalConfig.expandString(// $NON-NLS-1$ //$NON-NLS-2$
config.getInitParameter(MANUAL_DIR_KEY).replaceAll("%\\{", "\\${")));
return manualDir;
}
use of org.ovirt.engine.core.utils.EngineLocalConfig in project ovirt-engine by oVirt.
the class EngineMonitorService method reportServerStatus.
/**
* Analyzes server status and reports upon its status by configuration as needed:<br>
* If compares the current server status to the latest one. <br>
* if status was changed, adds an events to audit_log to represent the concrete event, else, <br>
* if is a repetition of previous status, checks the {@link #repeatNonResponsiveNotification} flag to<br>
* determine whether a user configured getting repeatable notifications or not.
* @param isResponsive
* current server status
*/
private void reportServerStatus(boolean isResponsive) {
boolean statusChanged;
boolean lastServerStatus = isServerUp;
isServerUp = isResponsive;
statusChanged = lastServerStatus ^ isResponsive;
// reports for any server status change or in case of configure for repeatable notification
if (statusChanged || repeatNonResponsiveNotification) {
if (isResponsive) {
// if server is up, report only if its status was changed from non responsive.
if (statusChanged) {
insertEventIntoAuditLogSafe(AuditLogType.VDC_START, AuditLogSeverity.NORMAL, ENGINE_RESPONDING_MESSAGE, "Failed auditing event down (for responsive server).");
}
} else {
// reports an error for non responsive server
EngineLocalConfig config = EngineLocalConfig.getInstance();
if (config.getEngineUpMark().exists()) {
// assumed crash, since engine up file is still there
insertEventIntoAuditLogSafe(AuditLogType.VDC_STOP, AuditLogSeverity.ERROR, ENGINE_NOT_RESPONDING_ERROR, "Failed auditing event up (for crashed non responsive server).");
} else {
insertEventIntoAuditLogSafe(AuditLogType.VDC_STOP, AuditLogSeverity.WARNING, ENGINE_NOT_RESPONDING_ERROR, "Failed auditing event up (for stopped non responsive server).");
}
}
}
}
use of org.ovirt.engine.core.utils.EngineLocalConfig in project ovirt-engine by oVirt.
the class AddGlusterWebhookInternalCommand method getWebhookUrl.
private String getWebhookUrl() {
EngineLocalConfig config = EngineLocalConfig.getInstance();
URL servletUrl;
try {
if (config.isHttpsEnabled()) {
servletUrl = config.getExternalHttpsUrl(WEBHOOK_SERVLET_PATH);
} else {
servletUrl = config.getExternalHttpUrl(WEBHOOK_SERVLET_PATH);
}
return servletUrl.toExternalForm();
} catch (MalformedURLException exception) {
log.debug("Failed to get engine webhook url", exception);
return null;
}
}
use of org.ovirt.engine.core.utils.EngineLocalConfig in project ovirt-engine by oVirt.
the class SsoOAuthServiceUtils method setClientIdSecretBasicAuthHeader.
private static void setClientIdSecretBasicAuthHeader(HttpUriRequest request) {
EngineLocalConfig config = EngineLocalConfig.getInstance();
byte[] encodedBytes = Base64.encodeBase64(String.format("%s:%s", config.getProperty("ENGINE_SSO_CLIENT_ID"), config.getProperty("ENGINE_SSO_CLIENT_SECRET")).getBytes());
request.setHeader(FiltersHelper.Constants.HEADER_AUTHORIZATION, String.format("Basic %s", new String(encodedBytes)));
}
Aggregations