Example usage for java.util ResourceBundle getBundle

List of usage examples for java.util ResourceBundle getBundle

Introduction

In this page you can find the example usage for java.util ResourceBundle getBundle.

Prototype

@CallerSensitive
public static final ResourceBundle getBundle(String baseName) 

Source Link

Document

Gets a resource bundle using the specified base name, the default locale, and the caller module.

Usage

From source file:guiPackage.AllAccomTableModel.java

private List<Accomodation> getValues() {
    mySource = new BasicDataSource();
    mySource.setUrl(ResourceBundle.getBundle("databaseConnection").getString("connection"));
    mySource.setUsername(ResourceBundle.getBundle("databaseConnection").getString("username"));
    mySource.setPassword(ResourceBundle.getBundle("databaseConnection").getString("password"));
    AccomManager mngr = new AccomManagerImpl(mySource);
    return mngr.getAllAccoms();
}

From source file:efx.data.model.DefaultPropertyConversionExceptionHandler.java

@Override
public void process(AbstractModel model, String fieldName, String message) {
    if (StringUtils.isEmpty(message)) {
        message = ResourceBundle.getBundle("efx/resource/message").getString("error.value.invalid");
    }//from   w w  w.ja  v  a2  s. com
    model.setErrorField(fieldName, message);
}

From source file:mx.com.pixup.portal.db.DBConecta.java

/**
 * Lee los parmetros de conexion del archivo JDBC.properties y los guarda en en dbProp
 *///w  w w. ja  v a  2  s .  com
public DBConecta() {
    try {
        ResourceBundle rsb = ResourceBundle.getBundle("setup");
        Enumeration enum1 = rsb.getKeys();
        Properties dbProp = new Properties();
        while (enum1.hasMoreElements()) {
            String sTmp = (String) enum1.nextElement();
            dbProp.setProperty(sTmp, rsb.getString(sTmp));
            //System.out.println("+" + sTmp );
        }
        this.dbProp = dbProp;
        System.out.println(dbProp);

    } catch (Exception e) {
        System.out.println("+" + e.getMessage());
    }

}

From source file:mamo.vanillaVotifier.LanguagePack.java

public LanguagePack(String languagePackName) {
    bundle = ResourceBundle.getBundle(languagePackName);
}

From source file:org.synyx.sample.ResourceBundleMessageSourceTest.java

@Test
public void test_util_resource_bundle_with_ok() {
    ResourceBundle bundle = ResourceBundle.getBundle("ok_messages");
    String msg = bundle.getString("test.1");
    assertEquals("david", msg);
}

From source file:ch.sourcepond.maven.utils.localized.messages.DefaultMessagesFactory.java

@Override
public Messages newMessages(final String pBaseName) {
    notBlank(pBaseName, "baseNames cannot be null or blank");
    return new MessageImpl(ResourceBundle.getBundle(pBaseName));
}

From source file:com.sfs.whichdoctor.export.writer.ExportWriterBase.java

/**
 * Sets the keys./*from w  w  w  . java 2 s.  co  m*/
 *
 * @param keysBundle the new keys bundle reference
 */
protected final void setKeys(final String keysBundle) {
    this.keys = ResourceBundle.getBundle(keysBundle);
}

From source file:com.sfs.beans.SQLBean.java

/**
 * Instantiates a new sQL bean./*from www. j a  va  2  s .c  om*/
 *
 * @param sqlPropertiesName the sql properties name
 */
public SQLBean(final String sqlPropertiesName) {
    /**
     * Loads SQL commands into memory from properties file
     **/
    if (sqlPropertiesName != null) {

        ResourceBundle sqlBundle = ResourceBundle.getBundle(sqlPropertiesName);

        Enumeration<String> keySet = sqlBundle.getKeys();
        while (keySet.hasMoreElements()) {
            String sqlKey = keySet.nextElement();
            String sqlValue = sqlBundle.getString(sqlKey);

            sqlKey = StringUtils.replace(sqlKey, ".", "/");

            if (sqlValue == null) {
                sqlValue = "";
            }
            this.setValue(sqlKey, sqlValue);
        }
    }
}

From source file:org.synyx.sample.ResourceBundleMessageSourceTest.java

@Test
public void test_util_resource_bundle_with_broken() {
    try {/*from  w  w w . j ava 2 s.c o m*/
        ResourceBundle.getBundle("broken_messages");
        fail("Should throw Exception due to wrong format of file");
    } catch (MissingResourceException e) {
        assertTrue(e.getCause() instanceof IllegalArgumentException);
    }
}

From source file:com.aerhard.oxygen.plugin.dbtagger.util.JsonUtil.java

/**
 * Instantiates a new JsonUtil object./*from ww w.  ja v a  2  s .co m*/
 * 
 * @param workspace
 *            oXygen's workspace object.
 */
public JsonUtil(Workspace workspace) {
    this.workspace = workspace;
    i18n = ResourceBundle.getBundle("Tagger");
}