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:org.openehealth.coala.converter.PXSDateConverterTest.java

/**
 * @throws java.lang.Exception// w ww  .  j  av a 2  s.  c  o m
 */
@Before
public void setUp() throws Exception {
    ResourceBundle properties = ResourceBundle.getBundle("coala-document");
    longPattern = properties.getString("coala.consent.longdatepattern");
    shortPattern = properties.getString("coala.consent.shortdatepattern");

    GregorianCalendar cal = new GregorianCalendar();
    cal.set(Calendar.YEAR, 2011);
    cal.set(Calendar.MONTH, Calendar.JANUARY);
    cal.set(Calendar.DAY_OF_MONTH, 15);
    cal.set(Calendar.HOUR, 3);
    cal.set(Calendar.MINUTE, 36);
    cal.set(Calendar.SECOND, 50);
    cal.set(Calendar.MILLISECOND, 0);
    referenceDateLong = cal.getTime();

    cal = new GregorianCalendar();
    cal.set(Calendar.YEAR, 2011);
    cal.set(Calendar.MONTH, Calendar.JANUARY);
    cal.set(Calendar.DAY_OF_MONTH, 15);
    cal.set(Calendar.HOUR, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    referenceDateShort = cal.getTime();

}

From source file:org.hil.dao.BaseDaoTestCase.java

public BaseDaoTestCase() {
    // Since a ResourceBundle is not required for each class, just
    // do a simple check to see if one exists
    String className = this.getClass().getName();

    try {//from w  w  w . ja v  a2  s  . co m
        rb = ResourceBundle.getBundle(className);
    } catch (MissingResourceException mre) {
        //log.warn("No resource bundle found for: " + className);
    }
}

From source file:com.gisgraphy.service.impl.BaseManagerMockTestCase.java

public BaseManagerMockTestCase() {
    // Since a ResourceBundle is not required for each class, just
    // do a simple check to see if one exists
    String className = this.getClass().getName();

    try {//from  ww  w  . j a v a 2 s.  co  m
        rb = ResourceBundle.getBundle(className);
    } catch (MissingResourceException mre) {
        // log.warn("No resource bundle found for: " + className);
    }
}

From source file:org.openmrs.contrib.metadatarepository.service.BaseManagerTestCase.java

/**
 * Default constructor will set the ResourceBundle if needed.
 *///w  w w.j av a  2 s  .c o m
public BaseManagerTestCase() {
    // Since a ResourceBundle is not required for each class, just
    // do a simple check to see if one exists
    String className = this.getClass().getName();

    try {
        rb = ResourceBundle.getBundle(className);
    } catch (MissingResourceException mre) {
        // log.warn("No resource bundle found for: " + className);
    }
}

From source file:com.siapa.managedbean.SsOpcionesManagedBean.java

@Override
public void save(ActionEvent event) {
    String msg = ResourceBundle.getBundle("/crudbundle")
            .getString(SsOpciones.class.getSimpleName() + "Updated");
    getSelected().setUsuarioUltimamodificacion(getUsuario());
    getSelected().setFechaUltimamodificacion(new Date());
    persist(PersistAction.UPDATE, msg);/* ww w.  j  ava2s.  com*/
    if (!isValidationFailed()) {
        items = null; // Invalidate list of items to trigger re-query.
    }
}

From source file:guiPackage.AllAccomComboBoxModel.java

@Override
public Object getElementAt(int index) {
    BasicDataSource mySource = new BasicDataSource();
    mySource.setUrl(ResourceBundle.getBundle("databaseConnection").getString("connection"));
    mySource.setUsername(ResourceBundle.getBundle("databaseConnection").getString("username"));
    mySource.setPassword(ResourceBundle.getBundle("databaseConnection").getString("password"));

    GuestManager guestMngr = new GuestManagerImpl(mySource);
    RoomManager roomMngr = new RoomManagerImpl(mySource);
    return (String) (myValues.get(index).getAccomId() + ": "
            + guestMngr.getGuest(myValues.get(index).getGuestId()).getName() + ", "
            + roomMngr.getRoom(myValues.get(index).getRoomId()).getRoomNumber() + " ("
            + myValues.get(index).getStartDate() + " - " + myValues.get(index).getEndDate() + ")");
}

From source file:carstore.CarCustomizer.java

private void init(String bundleName) {
    FacesContext context = FacesContext.getCurrentInstance();

    if (log.isDebugEnabled()) {
        log.debug("Loading bundle: " + bundleName + ".");
    }//from w  ww.j  av a2  s.  c o m
    bundle = ResourceBundle.getBundle(bundleName);
}

From source file:com.ibm.amc.data.ErrorResponseTest.java

@Test
public void testUserAction() {
    ResourceBundle bundle = ResourceBundle.getBundle(Constants.CWZBA_BUNDLE_NAME);
    assertTrue(responseJson.contains("\"userAction\":\"" + bundle.getString(KEY + ".useraction") + "\""));
}

From source file:descriptionmaker.photobucket.AlbumUploader.java

public void setUp() throws Exception {

    /*System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
    System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug"); */

    api = new PhotobucketAPI();
    api.setOauthConsumerKey(ResourceBundle.getBundle("consumer").getString("oauth.consumer"));
    api.setOauthConsumerSecret(ResourceBundle.getBundle("consumer").getString("oauth.consumer.key"));
}

From source file:it.infn.ct.security.utilities.LDAPUtils.java

private static DirContext getAuthContext(String userCN, String password, boolean dedicatedAdminUser)
        throws NamingException {
    ResourceBundle rb = ResourceBundle.getBundle("ldap");
    Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, rb.getString("url"));
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    if (dedicatedAdminUser) {
        env.put(Context.SECURITY_PRINCIPAL, rb.getString("bindDN"));
        env.put(Context.SECURITY_CREDENTIALS, rb.getString("bindPass"));
    } else {//  w w  w  .  j av  a 2  s .  c  om
        env.put(Context.SECURITY_PRINCIPAL, "cn=" + userCN + "," + rb.getString("peopleRoot"));
        env.put(Context.SECURITY_CREDENTIALS, password);
    }

    return new InitialDirContext(env);

}