|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.messages.providers.ResourceMessageProvider
public class ResourceMessageProvider
Implementation of MessageProvider
that stores messages in resource files
Field Summary | |
---|---|
protected Map<String,List<ResourceBundle>> |
cachedResourceBundles
|
Constructor Summary | |
---|---|
ResourceMessageProvider()
|
Method Summary | |
---|---|
protected Message |
buildMessage(String namespace,
String component,
String key,
String messageText,
String locale)
Helper method to build a Message object from the given parameters |
protected String |
cleanResourceKey(String resourceKey)
Removes any component declaration within the given resource key |
Collection<Message> |
getAllMessagesForComponent(String namespace,
String component,
String locale)
Iterates through the resource bundles for the give namespace (or the application if namespace is not given) and finds all messages that match the given namespace |
protected List<ResourceBundle> |
getCachedResourceBundles(String namespace,
String localeCode)
Retrieves the list of resource bundles for the given namespace or locale from cache if present, otherwise the list is retrieved and then stored in cache for subsequent calls |
Message |
getMessage(String namespace,
String component,
String key,
String locale)
Iterates through the resource bundles for the give namespace (or the application if namespace is not given) and finds the message that matches the given key |
protected List<String> |
getResourceBundleNamesForApplication()
Retrieves the list of configured bundle names for the application |
protected List<String> |
getResourceBundleNamesForNamespace(String namespace)
Retrieves the list of configured bundle names for the namespace |
protected List<ResourceBundle> |
getResourceBundles(List<String> resourceBundleNames,
String localeCode)
Helper method to build a list of resource bundles for the given list of bundle names and locale code |
protected List<ResourceBundle> |
getResourceBundlesForApplication(String localeCode)
Retrieves the configured ResourceBundle instances for the application using the given locale code |
protected List<ResourceBundle> |
getResourceBundlesForNamespace(String namespace,
String localeCode)
Retrieves the configured ResourceBundle instances for the given namespace and locale |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<String,List<ResourceBundle>> cachedResourceBundles
Constructor Detail |
---|
public ResourceMessageProvider()
Method Detail |
---|
public Message getMessage(String namespace, String component, String key, String locale)
If the message is found in more than one bundle, the text from the bundle that is loaded last will be used
If the given component code is the default component, resource keys that do not have a component defined and match the given key will also be considered matches
getMessage
in interface MessageProvider
namespace
- namespace code the message belongs tocomponent
- component code the namespace is associated withkey
- key that identifies the message within the namespace and componentlocale
- locale code for the message to return
MessageProvider.getMessage(java.lang.String, java.lang.String,
java.lang.String, java.lang.String)
public Collection<Message> getAllMessagesForComponent(String namespace, String component, String locale)
If the same resource key is found in more than one bundle, the text from the bundle that is loaded last will be used
If the given component code is the default component, resource keys that do not have a component defined and match the given key will also be considered matches
getAllMessagesForComponent
in interface MessageProvider
namespace
- namespace code the message belongs tocomponent
- component code the namespace is associated withlocale
- locale code for the message to return
MessageProvider.getAllMessagesForComponent(java.lang.String, java.lang.String,
java.lang.String)
protected String cleanResourceKey(String resourceKey)
resourceKey
- resource key to clean
protected Message buildMessage(String namespace, String component, String key, String messageText, String locale)
Message
object from the given parameters
namespace
- namespace for the messagecomponent
- component code for the messagekey
- message keymessageText
- text for the messagelocale
- locale of the message
protected List<ResourceBundle> getCachedResourceBundles(String namespace, String localeCode)
namespace
- namespace to retrieve bundles forlocaleCode
- locale code to use in selecting bundles
protected List<ResourceBundle> getResourceBundlesForNamespace(String namespace, String localeCode)
ResourceBundle
instances for the given namespace and locale
namespace
- namespace to retrieve bundles forlocaleCode
- locale code to use in selecting bundles
protected List<ResourceBundle> getResourceBundlesForApplication(String localeCode)
ResourceBundle
instances for the application using the given locale code
localeCode
- locale code to use in selecting bundles
protected List<ResourceBundle> getResourceBundles(List<String> resourceBundleNames, String localeCode)
For details on how resource bundles are selected given a bundle name and locale code see
ResourceBundle
resourceBundleNames
- list of bundle names to get bundles forlocaleCode
- locale code to use when selecting bundles
protected List<String> getResourceBundleNamesForNamespace(String namespace)
Resource bundle names are configured for a namespace using the property resourceBundleNames
on the corresponding ModuleConfiguration
namespace
- namespace to retrieve configured bundle names for
protected List<String> getResourceBundleNamesForApplication()
Resource bundle names are configured for the application using the configuration property
resourceBundleNames
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |