use of org.ovirt.engine.core.common.queries.GetConfigurationValueParameters in project ovirt-engine by oVirt.
the class AsyncDataProvider method getConfigurationValueBoolean.
public void getConfigurationValueBoolean(AsyncQuery<Boolean> aQuery, ConfigValues configVal) {
aQuery.converterCallback = new DefaultValueConverter<>(Boolean.TRUE);
getConfigFromCache(new GetConfigurationValueParameters(configVal, getDefaultConfigurationVersion()), aQuery);
}
use of org.ovirt.engine.core.common.queries.GetConfigurationValueParameters in project ovirt-engine by oVirt.
the class AsyncDataProvider method getNumOfMonitorList.
public void getNumOfMonitorList(AsyncQuery<List<Integer>> aQuery) {
aQuery.converterCallback = source -> {
ArrayList<Integer> nums = new ArrayList<>();
if (source != null) {
Iterable numEnumerable = (Iterable) source;
Iterator numIterator = numEnumerable.iterator();
while (numIterator.hasNext()) {
nums.add(Integer.parseInt(numIterator.next().toString()));
}
}
return nums;
};
getConfigFromCache(new GetConfigurationValueParameters(ConfigValues.ValidNumOfMonitors, getDefaultConfigurationVersion()), aQuery);
}
use of org.ovirt.engine.core.common.queries.GetConfigurationValueParameters in project ovirt-engine by oVirt.
the class CurrentFilter method findApplicationMode.
private ApplicationMode findApplicationMode(String sessionId) {
GetConfigurationValueParameters parameters = new GetConfigurationValueParameters(ConfigValues.ApplicationMode, ConfigCommon.defaultConfigurationVersion);
parameters.setSessionId(sessionId);
QueryReturnValue result = backend.runPublicQuery(QueryType.GetConfigurationValue, parameters);
return ApplicationMode.from(result.getReturnValue());
}
use of org.ovirt.engine.core.common.queries.GetConfigurationValueParameters in project ovirt-engine by oVirt.
the class WelcomeServlet method doGet.
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException {
log.debug("Entered WelcomeServlet");
String reauthenticate = (String) request.getSession(true).getAttribute(WelcomeUtils.REAUTHENTICATE);
if (StringUtils.isEmpty(reauthenticate)) {
Map<String, Object> deployedResponse = isSsoWebappDeployed();
if (deployedResponse.containsKey(WelcomeUtils.ERROR_DESCRIPTION)) {
request.getSession(true).setAttribute(WelcomeUtils.ERROR_DESCRIPTION, deployedResponse.get(WelcomeUtils.ERROR_DESCRIPTION));
request.getSession(true).setAttribute(WelcomeUtils.ERROR, deployedResponse.get(WelcomeUtils.ERROR));
}
}
String authCode = (String) request.getSession(true).getAttribute(WelcomeUtils.AUTH_CODE);
String token = (String) request.getSession(true).getAttribute(WelcomeUtils.TOKEN);
String errorDescription = (String) request.getSession(true).getAttribute(WelcomeUtils.ERROR_DESCRIPTION);
if (StringUtils.isNotEmpty(token) && !isSessionValid(request, token)) {
request.getSession(true).removeAttribute(WelcomeUtils.TOKEN);
request.getSession(true).removeAttribute(WelcomeUtils.SSO_USER);
request.getSession(true).removeAttribute(WelcomeUtils.CAPABILITY_CREDENTIALS_CHANGE);
token = "";
}
if (authCode == null && StringUtils.isEmpty(errorDescription) && StringUtils.isEmpty(reauthenticate)) {
if (StringUtils.isNotEmpty(request.getParameter(WelcomeUtils.ERROR)) && !WelcomeUtils.ERR_OVIRT_CODE_NOT_AUTHENTICATED.equals(request.getParameter(WelcomeUtils.ERROR))) {
request.getSession(true).setAttribute(WelcomeUtils.ERROR_DESCRIPTION, request.getParameter(WelcomeUtils.ERROR_DESCRIPTION));
request.getSession(true).setAttribute(WelcomeUtils.ERROR, request.getParameter(WelcomeUtils.ERROR));
}
String url = WelcomeUtils.getLoginUrl(engineUri, identityScope);
log.debug("redirecting to {}", url);
response.sendRedirect(url);
} else {
request.getSession(true).removeAttribute(WelcomeUtils.REAUTHENTICATE);
log.debug("Displaying Welcome Page");
try {
setUserNameForMenu(request, token);
} catch (Exception ex) {
log.debug("Unable to set request attributed for user menu", ex);
log.error("Unable to set request attributed for user menu: {}", ex.getMessage());
}
request.setAttribute(LOCALE_KEYS, UnsupportedLocaleHelper.getDisplayedLocales(LocaleFilter.getLocaleKeys()));
String oVirtVersion = backend.runPublicQuery(QueryType.GetConfigurationValue, new GetConfigurationValueParameters(ConfigValues.ProductRPMVersion, ConfigCommon.defaultConfigurationVersion)).getReturnValue();
request.setAttribute("sso_credential_change_url", getCredentialsChangeUrl(request));
request.setAttribute(VERSION, oVirtVersion != null ? oVirtVersion : "myVersion");
request.setAttribute(SECTIONS, brandingManager.getWelcomeSections((Locale) request.getAttribute(LocaleFilter.LOCALE)));
log.debug("Including to ovirt-engine.jsp");
RequestDispatcher dispatcher = request.getRequestDispatcher(WelcomeUtils.WELCOME_PAGE_JSP_URI);
response.setContentType("text/html;charset=UTF-8");
if (dispatcher != null) {
dispatcher.include(request, response);
}
}
log.debug("Exiting WelcomeServlet");
}
use of org.ovirt.engine.core.common.queries.GetConfigurationValueParameters in project ovirt-engine by oVirt.
the class CORSSupportFilter method getBackendParameter.
private Object getBackendParameter(final ConfigValues key) throws ServletException {
final GetConfigurationValueParameters parameters = new GetConfigurationValueParameters();
parameters.setConfigValue(key);
parameters.setVersion(ConfigCommon.defaultConfigurationVersion);
QueryReturnValue value = backend.runPublicQuery(QueryType.GetConfigurationValue, parameters);
if (!value.getSucceeded()) {
throw new ServletException("Can't get value of backend parameter \"" + key + "\".");
}
return value.getReturnValue();
}
Aggregations