List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:com.googlecode.jtiger.modules.ecside.resource.TableResourceBundle.java
private String findResource(ResourceBundle resourceBundle, String code) { String result = null;/*w w w . j ava 2 s . c om*/ if (resourceBundle == null) { return result; } try { result = resourceBundle.getString(code); } catch (MissingResourceException e) { // nothing we can do so eat the message } return result; }
From source file:ec.com.ebos.web.master.jsf.bean.TechnicalInfo.java
public void initialize() { try {/*from ww w. j a v a 2s .c o m*/ ResourceBundle rb = ResourceBundle.getBundle(Constantes.DOMAIN_NAME + ".admin.resources.ebosconfig"); String strAppProps = rb.getString("application.properties"); int lastBrace = strAppProps.indexOf("}"); strAppProps = strAppProps.substring(1, lastBrace); Map<String, String> appProperties = new HashMap<String, String>(); String[] appProps = strAppProps.split("[\\s,]+"); for (String appProp : appProps) { String[] keyValue = appProp.split("="); if (keyValue != null && keyValue.length > 1) { appProperties.put(keyValue[0], keyValue[1]); } } version = appProperties.get("ebos.version"); spring = "Spring: " + appProperties.get("spring.version"); hibernate = "Hibernate: " + appProperties.get("hibernate.version"); primeFaces = "PrimeFaces: " + appProperties.get("primefaces.version"); primeFacesExt = "PrimeFaces Extensions: " + appProperties.get("primefaces-extensions.version"); jsfImpl = "JSF: " + appProperties.get("jsf-impl") + " " + appProperties.get("jsfVersion"); server = "Server: " + ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext()) .getServerInfo(); DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Calendar calendar = Calendar.getInstance(); if (appProperties.containsKey("timestamp")) { calendar.setTimeInMillis(Long.valueOf(appProperties.get("timestamp"))); } buildTime = "Build time: " + formatter.format(calendar.getTime()); mojarra = appProperties.get("jsf-impl").contains("mojarra"); //mfenoglio process new and updated components this.proccessNewsComponents(appProperties.get("primefaces-extensions.new-components"), appProperties.get("primefaces-extensions.updated-components")); } catch (MissingResourceException e) { LOGGER.warning("Resource bundle 'ebosconfig' was not found"); } }
From source file:org.shredzone.cilla.admin.login.LoginBean.java
/** * Tries to login the user with the given credentials. * * @return name of the admin index page if the login was successful, {@code null} if * the login was not successful. *//*from w ww . ja v a 2 s . c om*/ public String login() { try { remoteLoginService.login(getUserName(), getPassword()); } catch (AuthenticationException ex) { log.error("Authentication failed, user: '" + getUserName() + "', password: '********'", ex); FacesContext ctx = FacesContext.getCurrentInstance(); Locale loc = ctx.getViewRoot().getLocale(); ResourceBundle bundle = ResourceBundle.getBundle(ctx.getApplication().getMessageBundle(), loc); FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, bundle.getString("login.failed"), ex.getMessage()); ctx.addMessage(null, message); return null; } return "/admin/index.xhtml"; }
From source file:org.codehaus.mojo.chronos.chart.SummaryThroughputChartSource.java
public JFreeChart getChart(ResourceBundle bundle, ReportConfig config) { XYPlot throughputPlot = createThroughputPlot(bundle, config); XYPlot threadCountPlot = createThreadCountPlot(bundle, config); String label = bundle.getString("chronos.label.throughput.time"); SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); DateAxis timeAxis = ChartUtil.createTimeAxis(label, dateFormat); CombinedDomainXYPlot combineddomainxyplot = ChartUtil.createCombinedPlot(timeAxis, throughputPlot, threadCountPlot);//from w w w . j av a2 s . c o m return new JFreeChart(bundle.getString("chronos.label.throughput"), combineddomainxyplot); }
From source file:es.pode.modificador.presentacion.configurar.cambios.modificar.ModificarTerminoControllerImpl.java
/** * @see es.pode.modificador.presentacion.configurar.cambios.modificar.ModificarTerminoController#selectAction(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.configurar.cambios.modificar.SelectActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */// www .j a v a 2 s . c o m public final java.lang.String selectAction(ActionMapping mapping, es.pode.modificador.presentacion.configurar.cambios.modificar.SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String origen = form.getAction(); String result = ""; java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); // Introduzco en el objeto de sesion la opcion elegida if (origen.equals(i18n.getString("modificarTermino.aceptar"))) { result = "Aceptar"; } else if (origen.equals(i18n.getString("modificarTermino.volver"))) { result = "Volver"; } else if (origen.equals(i18n.getString("modificarTermino.cancelar"))) { result = "Cancelar"; } return result; }
From source file:io.github.swagger2markup.internal.document.builder.SecurityDocumentBuilder.java
public SecurityDocumentBuilder(Swagger2MarkupConverter.Context context, Swagger2MarkupExtensionRegistry extensionRegistry, Path outputPath) { super(context, extensionRegistry, outputPath); ResourceBundle labels = ResourceBundle.getBundle("io/github/swagger2markup/lang/labels", config.getOutputLanguage().toLocale()); SECURITY = labels.getString("security"); TYPE = labels.getString("security_type"); NAME = labels.getString("security_name"); IN = labels.getString("security_in"); FLOW = labels.getString("security_flow"); AUTHORIZATION_URL = labels.getString("security_authorizationUrl"); TOKEN_URL = labels.getString("security_tokenUrl"); }
From source file:eu.optimis.tf.sp.service.SPOperation.java
public String getHistoricTrust(String providerId) { String historic = ""; // String historicHeader = "<trust xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"; String historicBody = ""; // try { // TrecIPTrustDAO iptdao = new TrecIPTrustDAO(); // List<IpTrust> iptlst = iptdao.getIPTrusts(providerId); // /*ww w . ja v a 2 s.c o m*/ // for (IpTrust ipt : iptlst){ // historicBody = historicBody + "<value>" + (ipt.getIpTrust() * rate) // + "</value>"; // } // String historicEnd = "</trust>"; // historic = historicHeader + historicBody + historicEnd; // return historic; // } catch (Exception e) { ResourceBundle rb = ResourceBundle.getBundle("trustframework", Locale.getDefault()); try { String url = rb.getString("db.sp.host"); String user = rb.getString("db.user"); String password = rb.getString("db.pass"); Driver myDriver = new com.mysql.jdbc.Driver(); DriverManager.registerDriver(myDriver); Connection conn = DriverManager.getConnection(url, user, password); // Get a statement from the connection Statement stmt = conn.createStatement(); // Execute the query ResultSet rs = stmt.executeQuery( "SELECT `ip_trust` FROM `ip_trust` WHERE `ip_id` = '" + providerId + "' limit 100"); // Loop through the result set while (rs.next()) { // historicBody = historicBody + "<value>" + (Double.valueOf(rs.getString(1)) * rate) // + "</value>"; historicBody = historicBody + (Double.valueOf(rs.getString(1)) * rate) + ","; } // Close the result set, statement and the connection rs.close(); stmt.close(); conn.close(); return historicBody; } catch (SQLException e1) { System.out.println("Error: unable to load infrastructure provider trust"); return ""; } // } }
From source file:es.pode.administracion.presentacion.estructuraseducativas.tesauros.alta.AltaTesaurosControllerImpl.java
public String submit(ActionMapping mapping, SubmitForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String resultado = ""; String action = form.getAction(); // String idioma=((Locale)request.getSession().getAttribute("org.apache.struts.action.LOCALE")).getLanguage(); // ResourceBundle i18n = ResourceBundle.getBundle("application-resources_"+idioma); Locale locale = (Locale) request.getSession().getAttribute("org.apache.struts.action.LOCALE"); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); if (action != null) { if (action.equals(i18n.getString("estructuras.aceptar"))) { resultado = "ACEPTAR"; } else if (action.equals(i18n.getString("estructuras.cancelar"))) resultado = "CANCELAR"; }// w w w. j av a2s . c o m return resultado; }
From source file:es.pode.administracion.presentacion.estructuraseducativas.tesauros.alta.AltaTesaurosControllerImpl.java
public String submitAdvertencia(ActionMapping mapping, SubmitAdvertenciaForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String resultado = ""; String action = form.getAction(); // String idioma=((Locale)request.getSession().getAttribute("org.apache.struts.action.LOCALE")).getLanguage(); // ResourceBundle i18n = ResourceBundle.getBundle("application-resources_"+idioma); Locale locale = (Locale) request.getSession().getAttribute("org.apache.struts.action.LOCALE"); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); if (action != null) { if (action.equals(i18n.getString("estructuras.aceptar"))) { resultado = "ACEPTAR"; } else if (action.equals(i18n.getString("estructuras.cancelar"))) resultado = "CANCELAR"; }//w ww. j a v a2s . c o m return resultado; }
From source file:mx.redhat.jbpm.CustomType.FileCustomType.java
@Override public String getDescription(Locale locale) { ResourceBundle bundle = ResourceBundle.getBundle("mx.redhat.jbpm.messages", locale); return bundle.getString("description"); }