Search in sources :

Example 76 with ResourceBundle

use of java.util.ResourceBundle in project OpenAM by OpenRock.

the class DevicePrintModule method init.

/**
     * {@inheritDoc}
     */
@Override
public void init(Subject subject, Map sharedState, Map options) {
    userName = (String) sharedState.get(getUserKey());
    if (StringUtils.isEmpty(userName)) {
        ResourceBundle bundle = amCache.getResBundle(AUTH_MODULE_NAME, getLoginLocale());
        DEBUG.warning(bundle.getString("authModuleNotSetUpWithUsername"));
    }
    AMIdentityRepository amIdentityRepository = getAMIdentityRepository(getRequestOrg());
    AMIdentity amIdentity = getIdentity();
    HOTPService hotpService = moduleInitialiser.getHOTPService(getLoginLocale(), amCache, userName, amIdentityRepository, options);
    devicePrintAuthenticationService = moduleInitialiser.getDevicePrintAuthenticationService(amIdentity, getHttpServletRequest(), hotpService, options);
}
Also used : AMIdentity(com.sun.identity.idm.AMIdentity) AMIdentityRepository(com.sun.identity.idm.AMIdentityRepository) HOTPService(com.sun.identity.authentication.modules.hotp.HOTPService) ResourceBundle(java.util.ResourceBundle)

Example 77 with ResourceBundle

use of java.util.ResourceBundle in project OpenAM by OpenRock.

the class AMResBundleCacher method getBundle.

/**
     * Gets resource bundle
     *
     * @param name of bundle
     * @param locale of bundle
     * @return resource bundle
     */
public static ResourceBundle getBundle(String name, Locale locale) {
    AMResourceBundleCache cache = AMResourceBundleCache.getInstance();
    ResourceBundle rb = cache.getResBundle(name, locale);
    if (rb == null) {
        rb = cache.getResBundle(AMAdminConstants.DEFAULT_RB, locale);
    }
    return rb;
}
Also used : ResourceBundle(java.util.ResourceBundle)

Example 78 with ResourceBundle

use of java.util.ResourceBundle in project OpenAM by OpenRock.

the class AMResourceBundleCache method getResBundle.

/**
     * Gets resource bundle from cache
     *
     * @param name of bundle
     * @param locale of bundle
     * @return resource bundle
     */
public ResourceBundle getResBundle(String name, Locale locale) {
    ResourceBundle resBundle = null;
    Map map = (Map) mapBundles.get(name);
    if (map != null) {
        resBundle = (ResourceBundle) map.get(locale);
    }
    if (resBundle == null) {
        try {
            resBundle = ResourceBundle.getBundle(name, locale);
        } catch (MissingResourceException mre) {
            resBundle = getResourceFromDS(name, locale);
        }
        synchronized (mapBundles) {
            if (map == null) {
                map = new HashMap(5);
                mapBundles.put(name, map);
            }
            map.put(locale, resBundle);
        }
    }
    return resBundle;
}
Also used : HashMap(java.util.HashMap) MissingResourceException(java.util.MissingResourceException) ISResourceBundle(com.sun.identity.common.ISResourceBundle) ResourceBundle(java.util.ResourceBundle) Map(java.util.Map) HashMap(java.util.HashMap)

Example 79 with ResourceBundle

use of java.util.ResourceBundle in project OpenAM by OpenRock.

the class AMSDKBundle method getBundleFromHash.

private static ResourceBundle getBundleFromHash(String locale) {
    ResourceBundle rb = (ResourceBundle) strLocaleBundles.get(locale);
    if (rb == null) {
        rb = com.sun.identity.shared.locale.Locale.getResourceBundle(BUNDLE_NAME, locale);
        if (rb == null) {
            rb = profileBundle;
        }
        strLocaleBundles.put(locale, rb);
    }
    return rb;
}
Also used : ResourceBundle(java.util.ResourceBundle)

Example 80 with ResourceBundle

use of java.util.ResourceBundle in project OpenAM by OpenRock.

the class AMSDKBundle method getBundleFromHash.

static ResourceBundle getBundleFromHash(java.util.Locale locale) {
    ResourceBundle rb = (ResourceBundle) localeBundles.get(locale);
    if (rb == null) {
        rb = ResourceBundle.getBundle(BUNDLE_NAME, locale);
        if (rb == null) {
            rb = profileBundle;
        }
        localeBundles.put(locale, rb);
    }
    return rb;
}
Also used : ResourceBundle(java.util.ResourceBundle)

Aggregations

ResourceBundle (java.util.ResourceBundle)1189 Locale (java.util.Locale)180 MissingResourceException (java.util.MissingResourceException)150 Test (org.junit.Test)100 ArrayList (java.util.ArrayList)71 HashMap (java.util.HashMap)70 IOException (java.io.IOException)67 PropertyResourceBundle (java.util.PropertyResourceBundle)56 URL (java.net.URL)48 File (java.io.File)47 Map (java.util.Map)45 InputStream (java.io.InputStream)43 Enumeration (java.util.Enumeration)34 HashSet (java.util.HashSet)30 Test (org.junit.jupiter.api.Test)30 ActionMessage (org.apache.struts.action.ActionMessage)29 MessageFormat (java.text.MessageFormat)28 ListResourceBundle (java.util.ListResourceBundle)28 Set (java.util.Set)26 Preferences (java.util.prefs.Preferences)21