List of usage examples for java.util ResourceBundle getString
public final String getString(String key)
From source file:es.pode.empaquetador.presentacion.basico.asociar.AsociarControllerImpl.java
/** * @see es.pode.empaquetador.presentacion.basico.asociar.AsociarController#selectActionObject(org.apache.struts.action.ActionMapping, es.pode.empaquetador.presentacion.basico.asociar.SelectActionObjectForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */// w w w.j a va 2 s .c om public final java.lang.String selectActionObject(ActionMapping mapping, es.pode.empaquetador.presentacion.basico.asociar.SelectActionObjectForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); String accion = form.getAction(); String resultado = null; if (accion.equals(i18n.getString("portalempaquetado.Aceptar"))) { if (form.getTexto() == null || form.getTexto().equals("")) { if (logger.isDebugEnabled()) logger.debug("el texto embebido es null"); throw new ValidatorException("{portalempaquetado.basico.asociar.embed.error.vacio}"); } resultado = "Aceptar"; } else { resultado = "Cancelar"; form.setTipo("Object"); } return resultado; }
From source file:de.ingrid.external.gemet.GEMETClient.java
public GEMETClient(ResourceBundle gemetProps) { this.serviceUrl = gemetProps.getString("service.url"); }
From source file:de.eod.jliki.users.jsfbeans.UserRegisterBean.java
/** * Adds a new user to the jLiki database.<br/> */// w w w . ja va 2s . co m public final void addNewUser() { final User newUser = new User(this.username, this.password, this.email, this.firstname, this.lastname); final String userHash = UserDBHelper.addUserToDB(newUser); if (userHash == null) { Messages.addFacesMessage(null, FacesMessage.SEVERITY_ERROR, "message.user.register.failed", this.username); return; } UserRegisterBean.LOGGER.debug("Adding user: " + newUser.toString()); final FacesContext fc = FacesContext.getCurrentInstance(); final HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest(); final ResourceBundle mails = ResourceBundle.getBundle("de.eod.jliki.EMailMessages", fc.getViewRoot().getLocale()); final String activateEMailTemplate = mails.getString("user.registration.email"); final StringBuffer url = request.getRequestURL(); final String serverUrl = url.substring(0, url.lastIndexOf("/")); UserRegisterBean.LOGGER.debug("Generated key for user: \"" + userHash + "\""); final String emsLink = serverUrl + "/activate.xhtml?user=" + newUser.getName() + "&key=" + userHash; final String emsLikiName = ConfigManager.getInstance().getConfig().getPageConfig().getPageName(); final String emsEMailText = MessageFormat.format(activateEMailTemplate, emsLikiName, this.firstname, this.lastname, this.username, emsLink); final String emsHost = ConfigManager.getInstance().getConfig().getEmailConfig().getHostname(); final int emsPort = ConfigManager.getInstance().getConfig().getEmailConfig().getPort(); final String emsUser = ConfigManager.getInstance().getConfig().getEmailConfig().getUsername(); final String emsPass = ConfigManager.getInstance().getConfig().getEmailConfig().getPassword(); final boolean emsTSL = ConfigManager.getInstance().getConfig().getEmailConfig().isUseTLS(); final String emsSender = ConfigManager.getInstance().getConfig().getEmailConfig().getSenderAddress(); final Email activateEmail = new SimpleEmail(); activateEmail.setHostName(emsHost); activateEmail.setSmtpPort(emsPort); activateEmail.setAuthentication(emsUser, emsPass); activateEmail.setTLS(emsTSL); try { activateEmail.setFrom(emsSender); activateEmail.setSubject("Activate jLiki Account"); activateEmail.setMsg(emsEMailText); activateEmail.addTo(this.email); activateEmail.send(); } catch (final EmailException e) { UserRegisterBean.LOGGER.error("Sending activation eMail failed!", e); return; } this.username = ""; this.password = ""; this.confirm = ""; this.email = ""; this.firstname = ""; this.lastname = ""; this.captcha = ""; this.termsOfUse = false; this.success = true; Messages.addFacesMessage(null, FacesMessage.SEVERITY_INFO, "message.user.registered", this.username); }
From source file:es.pode.administracion.presentacion.catalogacion.bajaCatalogadores.BajaCatalogadoresControllerImpl.java
/** * @see es.pode.administracion.presentacion.catalogacion.bajaCatalogadores.BajaCatalogadoresController#bajaCatalogadores(org.apache.struts.action.ActionMapping, es.pode.administracion.presentacion.catalogacion.bajaCatalogadores.BajaCatalogadoresForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///from w w w.j a v a 2 s. co m public final void bajaCatalogadores(ActionMapping mapping, es.pode.administracion.presentacion.catalogacion.bajaCatalogadores.BajaCatalogadoresForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String listaId = request.getParameter("listaId"); if (log.isDebugEnabled()) log.debug("los ids de usuario que se quieren eliminar son " + listaId); Object[] objeto = listaId.split(" "); ResourceBundle ficheroRecursos = null; try { SrvAdminUsuariosService srvAdminUsuariosService = this.getSrvAdminUsuariosService(); ValidaBajaGrupoTrabajoVO validaBaja = srvAdminUsuariosService.bajaGrupoTrabajo(obtenerIds(objeto)); Locale locale = request.getLocale(); ficheroRecursos = this.getFicherRecursos(locale); form.setDescripcionBaja(ficheroRecursos.getString(validaBaja.getDescripcion())); form.setGruposTrabajoBorrados(validaBaja.getItemsDeleted()); } catch (Exception e) { log.error("Se ha producido un error al eliminar el usuario " + e); throw new ValidatorException("{errors.borrarUsuario}"); } }
From source file:com.silverwrist.dynamo.xmlrpc.Validator1Suite.java
public String getMethodHelp(Request r, String method) throws FaultCode { Integer disp = (Integer) (DISPATCH_MAP.get(method)); if (disp == null) throw new XmlRpcMethodNotFound(method); ResourceBundle b = ResourceBundle.getBundle("com.silverwrist.dynamo.xmlrpc.XmlRpcMessages", Locale.getDefault()); return b.getString(HELP_RESOURCES[disp.intValue()]); }
From source file:com.streamreduce.datasource.BootstrapDatabaseDataPopulator.java
private void bootstrapSystemInfo() { ResourceBundle resourceBundle = ResourceBundle.getBundle("application"); SystemInfo systemStatus = systemStatusDAO.getLatest(); if (systemStatus == null) { systemStatus = new SystemInfo(); }//from ww w. ja v a 2 s . c o m systemStatus.setAppVersion(resourceBundle.getString("nodeable.version")); systemStatus.setBuildNumber(resourceBundle.getString("nodeable.build")); systemStatusDAO.save(systemStatus); }
From source file:es.pode.modificador.presentacion.configurar.objetos.buscar.BuscarObjetoControllerImpl.java
/** * @see es.pode.modificador.presentacion.configurar.objetos.buscar.BuscarObjetoController#selectAction(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.configurar.objetos.buscar.SelectActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *///from w w w .j av a 2 s.c o m public final java.lang.String selectAction(ActionMapping mapping, es.pode.modificador.presentacion.configurar.objetos.buscar.SelectActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute(ConstantesAgrega.DEFAULT_LOCALE); ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale); String volver = "Volver"; String buscar = i18n.getString("buscarObjeto.Buscar"); String action = form.getAction(); if (action == null) { return volver; } if (action.equals(buscar)) { // Guarda datos bsqueda en sesin BusquedaSession sesion = getBusquedaSession(request); boolean alMenosUnParametro = false; boolean parteFecha = false; if (vacia(form.getIdioma())) { throw new ValidatorException("{buscarObjeto.msgErrorIdioma}"); } if (!vacia(form.getAutor())) { alMenosUnParametro = true; } if (!vacia(form.getIdentificador())) { alMenosUnParametro = true; } if (!vacia(form.getTitulo())) { alMenosUnParametro = true; } if (fechaValida( form.getAnyoDesde())/*&&fechaValida(form.getDiaDesde())&&fechaValida(form.getMesDesde())*/) { alMenosUnParametro = true; parteFecha = true; } if (fechaValida( form.getAnyoHasta())/*&&fechaValida(form.getDiaHasta())&&fechaValida(form.getMesHasta())*/) { alMenosUnParametro = true; parteFecha = true; } if (fechaValida(form.getDiaDesde())) { alMenosUnParametro = true; parteFecha = true; } if (fechaValida(form.getDiaHasta())) { alMenosUnParametro = true; parteFecha = true; } if (fechaValida(form.getMesDesde())) { alMenosUnParametro = true; parteFecha = true; } if (fechaValida(form.getMesHasta())) { alMenosUnParametro = true; parteFecha = true; } //Si al menos uno de los campos de una fecha se ha introducido, se da error si falta otro if (parteFecha) { if (!fechaValida(form.getDiaDesde())) { throw new ValidatorException("{buscarObjeto.msgErrorDiaDesde}"); } else if (!fechaValida(form.getMesDesde())) { throw new ValidatorException("{buscarObjeto.msgErrorMesDesde}"); } else if (!fechaValida(form.getAnyoDesde())) { throw new ValidatorException("{buscarObjeto.msgErrorAnyoDesde}"); } else if (!fechaValida(form.getDiaHasta())) { throw new ValidatorException("{buscarObjeto.msgErrorDiaHasta}"); } else if (!fechaValida(form.getMesHasta())) { throw new ValidatorException("{buscarObjeto.msgErrorMesHasta}"); } else if (!fechaValida(form.getAnyoHasta())) { throw new ValidatorException("{buscarObjeto.msgErrorAnyoHasta}"); } } if (!alMenosUnParametro) { throw new ValidatorException("{buscarObjeto.exception}"); } //Vuelco el form a la sesion sesion.setAutor(form.getAutor()); sesion.setIdentificador(form.getIdentificador()); sesion.setTitulo(form.getTitulo()); sesion.setIdioma(form.getIdioma()); if (fechaValida(form.getDiaDesde()) && fechaValida(form.getMesDesde()) && fechaValida(form.getAnyoDesde()) && fechaValida(form.getDiaHasta()) && fechaValida(form.getMesHasta()) && fechaValida(form.getAnyoHasta())) { //Comprobaciones de la fecha SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); format.setLenient(false); String guion = "-"; int dayFrom, dayTo, yearFrom, yearTo, monthFrom, monthTo; try { dayFrom = Integer.valueOf(form.getDiaDesde()).intValue(); dayTo = Integer.valueOf(form.getDiaHasta()).intValue(); yearFrom = Integer.valueOf(form.getAnyoDesde()).intValue(); yearTo = Integer.valueOf(form.getAnyoHasta()).intValue(); monthFrom = Integer.valueOf(form.getMesDesde()).intValue(); monthTo = Integer.valueOf(form.getMesHasta()).intValue(); } catch (Exception e) { throw new ValidatorException("{buscarObjetos.msgErrorFormato}"); } StringBuffer fechaFromStr = new StringBuffer(); fechaFromStr.append(dayFrom).append(guion).append(monthFrom).append(guion).append(yearFrom); Date fechaFrom; Date fechaTo; try { fechaFrom = format.parse(fechaFromStr.toString()); StringBuffer fechaToStr = new StringBuffer(); fechaToStr.append(dayTo).append(guion).append(monthTo).append(guion).append(yearTo); fechaTo = format.parse(fechaToStr.toString()); if (fechaTo.before(fechaFrom)) { throw new ValidatorException("{buscarObjetos.msgErrorFormato}"); } } catch (Exception e) { throw new ValidatorException("{buscarObjetos.msgErrorFormato}"); } //Saco ahora campos de fecha a sesion String[] partes = format.format(fechaFrom).split("-"); sesion.setDiaDesde(partes[0]); sesion.setMesDesde(partes[1]); sesion.setAnyoDesde(partes[2]); partes = format.format(fechaTo).split("-"); sesion.setDiaHasta(partes[0]); sesion.setMesHasta(partes[1]); sesion.setAnyoHasta(partes[2]); } else { //Actualizamos los campos de fecha en sesion aunque no sean buenos sesion.setDiaDesde(form.getDiaDesde()); sesion.setMesDesde(form.getMesDesde()); sesion.setAnyoDesde(form.getAnyoDesde()); sesion.setDiaHasta(form.getDiaHasta()); sesion.setMesHasta(form.getMesHasta()); sesion.setAnyoHasta(form.getAnyoHasta()); } sesion.setResultados(null); return "Buscar"; } return volver; }
From source file:com.adr.taskexecutor.ui.TaskExecutorRemote.java
/** This method is called from within the constructor to * initialize the form./*w w w . jav a2 s. co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jURL = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jLoggingLevel = new javax.swing.JComboBox(); jTrace = new javax.swing.JCheckBox(); jStats = new javax.swing.JCheckBox(); setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10)); java.util.ResourceBundle bundle = java.util.ResourceBundle .getBundle("com/adr/taskexecutor/ui/i18n/messages"); // NOI18N jLabel1.setText(bundle.getString("label.serverurl")); // NOI18N jLabel2.setText(bundle.getString("label.logginglevel")); // NOI18N jTrace.setText(bundle.getString("label.trace")); // NOI18N jStats.setSelected(true); jStats.setText(bundle.getString("label.statistics")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jURL, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTrace, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLoggingLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jStats, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1).addComponent(jURL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(jLoggingLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jTrace) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jStats))); }
From source file:io.github.swagger2markup.internal.document.builder.DefinitionsDocumentBuilder.java
public DefinitionsDocumentBuilder(Swagger2MarkupConverter.Context context, Swagger2MarkupExtensionRegistry extensionRegistry, Path outputPath) { super(context, extensionRegistry, outputPath); ResourceBundle labels = ResourceBundle.getBundle("io/github/swagger2markup/lang/labels", config.getOutputLanguage().toLocale()); DEFINITIONS = labels.getString("definitions"); POLYMORPHISM_COLUMN = labels.getString("polymorphism.column"); DISCRIMINATOR_COLUMN = labels.getString("polymorphism.discriminator"); POLYMORPHISM_NATURE = new HashMap<ObjectTypePolymorphism.Nature, String>() { {//from w ww . ja va2 s.com put(ObjectTypePolymorphism.Nature.COMPOSITION, labels.getString("polymorphism.nature.COMPOSITION")); put(ObjectTypePolymorphism.Nature.INHERITANCE, labels.getString("polymorphism.nature.INHERITANCE")); } }; TYPE_COLUMN = labels.getString("type_column"); if (config.isSeparatedDefinitionsEnabled()) { if (logger.isDebugEnabled()) { logger.debug("Create separated definition files is enabled."); } Validate.notNull(outputPath, "Output directory is required for separated definition files!"); } else { if (logger.isDebugEnabled()) { logger.debug("Create separated definition files is disabled."); } } }
From source file:JAXRSaveClassificationScheme.java
/** * Creates a classification scheme and saves it to the * registry.//ww w .ja v a2s .c o m * * @param username the username for the registry * @param password the password for the registry */ public void executePublish(String username, String password) { RegistryService rs = null; BusinessLifeCycleManager blcm = null; BusinessQueryManager bqm = null; try { rs = connection.getRegistryService(); blcm = rs.getBusinessLifeCycleManager(); bqm = rs.getBusinessQueryManager(); System.out.println("Got registry service, query " + "manager, and life cycle manager"); // Get authorization from the registry PasswordAuthentication passwdAuth = new PasswordAuthentication(username, password.toCharArray()); HashSet<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>(); creds.add(passwdAuth); connection.setCredentials(creds); System.out.println("Established security credentials"); ResourceBundle bundle = ResourceBundle.getBundle("JAXRExamples"); // Create classification scheme InternationalString sn = blcm.createInternationalString(bundle.getString("postal.scheme.name")); InternationalString sd = blcm.createInternationalString(bundle.getString("postal.scheme.description")); ClassificationScheme postalScheme = blcm.createClassificationScheme(sn, sd); /* * Find the uddi-org:types classification scheme defined * by the UDDI specification, using well-known key id. */ String uuid_types = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4"; ClassificationScheme uddiOrgTypes = (ClassificationScheme) bqm.getRegistryObject(uuid_types, LifeCycleManager.CLASSIFICATION_SCHEME); if (uddiOrgTypes != null) { InternationalString cn = blcm .createInternationalString(bundle.getString("postal.classification.name")); Classification classification = blcm.createClassification(uddiOrgTypes, cn, bundle.getString("postal.classification.value")); postalScheme.addClassification(classification); /* * Set link to location of postal scheme (fictitious) * so others can look it up. If the URI were valid, we * could use the createExternalLink method. */ ExternalLink externalLink = (ExternalLink) blcm.createObject(LifeCycleManager.EXTERNAL_LINK); externalLink.setValidateURI(false); externalLink.setExternalURI(bundle.getString("postal.scheme.link")); InternationalString is = blcm.createInternationalString(bundle.getString("postal.scheme.linkdesc")); externalLink.setDescription(is); postalScheme.addExternalLink(externalLink); // Add scheme and save it to registry // Retrieve key if successful Collection<ClassificationScheme> schemes = new ArrayList<ClassificationScheme>(); schemes.add(postalScheme); BulkResponse br = blcm.saveClassificationSchemes(schemes); if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) { System.out.println("Saved PostalAddress " + "ClassificationScheme"); Collection schemeKeys = br.getCollection(); for (Object k : schemeKeys) { Key key = (Key) k; System.out.println("The postalScheme key is " + key.getId()); System.out.println( "Use this key as the scheme uuid " + "in the postalconcepts.xml file\n and as the " + "argument to JAXRPublishPostal and " + "JAXRQueryPostal"); } } else { Collection exceptions = br.getExceptions(); for (Object e : exceptions) { Exception exception = (Exception) e; System.err.println("Exception on save: " + exception.toString()); } } } else { System.out.println("uddi-org:types not found. Unable to " + "save PostalAddress scheme."); } } catch (JAXRException jaxe) { jaxe.printStackTrace(); } finally { // At end, close connection to registry if (connection != null) { try { connection.close(); } catch (JAXRException je) { } } } }