public class PluginAwareResourceBundleMessageSource extends org.springframework.context.support.ReloadableResourceBundleMessageSource implements GrailsApplicationAware, PluginManagerAware, org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected GrailsApplication |
application |
protected java.util.List<java.lang.String> |
pluginBaseNames |
protected GrailsPluginManager |
pluginManager |
| Constructor and Description |
|---|
PluginAwareResourceBundleMessageSource() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected java.lang.String |
getInlinePluginPath(GrailsPlugin grailsPlugin)
Returns the absolute path to the provided Grails plugin if it is being used "inline" or
null
if the plugin is not being used "inline". |
protected org.springframework.context.support.ReloadableResourceBundleMessageSource.PropertiesHolder |
getMergedPluginProperties(java.util.Locale locale)
Get a PropertiesHolder that contains the actually visible properties
for a Locale, after merging all specified resource bundles.
|
java.util.List<java.lang.String> |
getPluginBaseNames() |
protected org.springframework.core.io.Resource[] |
getPluginBundles(GrailsPlugin grailsPlugin)
Returns the i18n message bundles for the provided plugin or an empty
array if the plugin does not contain any .properties files in its
grails-app/i18n folder.
|
protected boolean |
isInlinePlugin(GrailsPlugin grailsPlugin)
Tests whether or not the Grails plugin is currently being run "inline".
|
protected java.text.MessageFormat |
resolveCode(java.lang.String code,
java.util.Locale locale) |
protected java.text.MessageFormat |
resolveCodeFromPlugins(java.lang.String code,
java.util.Locale locale)
Attempts to resolve a MessageFormat for the code from the list of plugin base names
|
protected java.lang.String |
resolveCodeWithoutArguments(java.lang.String code,
java.util.Locale locale) |
protected java.lang.String |
resolveCodeWithoutArgumentsFromPlugins(java.lang.String code,
java.util.Locale locale)
Attempts to resolve a String for the code from the list of plugin base names
|
void |
setCacheSeconds(int cacheSeconds) |
void |
setGrailsApplication(GrailsApplication grailsApplication)
This method is called by the
ApplicationContext that
loads the Grails application. |
void |
setPluginBaseNames(java.util.List<java.lang.String> pluginBaseNames) |
void |
setPluginManager(GrailsPluginManager pluginManager)
Sets the plug-in manager on this instance
|
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
void |
setResourceResolver(org.springframework.core.io.support.PathMatchingResourcePatternResolver resourceResolver) |
calculateAllFilenames, calculateFilenamesForLocale, clearCache, clearCacheIncludingAncestors, getMergedProperties, getProperties, loadProperties, refreshProperties, setBasename, setBasenames, setDefaultEncoding, setFallbackToSystemLocale, setFileEncodings, setPropertiesPersister, toStringgetCommonMessages, getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isUseCodeAsDefaultMessage, resolveArguments, setCommonMessages, setParentMessageSource, setUseCodeAsDefaultMessageprotected GrailsApplication application
protected GrailsPluginManager pluginManager
protected java.util.List<java.lang.String> pluginBaseNames
public PluginAwareResourceBundleMessageSource()
public java.util.List<java.lang.String> getPluginBaseNames()
public void setPluginBaseNames(java.util.List<java.lang.String> pluginBaseNames)
public void setGrailsApplication(GrailsApplication grailsApplication)
GrailsApplicationAwareThis method is called by the ApplicationContext that
loads the Grails application. The GrailsApplication instance that represents
the loaded Grails application is injected.
setGrailsApplication in interface GrailsApplicationAwaregrailsApplication - the GrailsApplication object that represents this Grails applicationpublic void setPluginManager(GrailsPluginManager pluginManager)
PluginManagerAwaresetPluginManager in interface PluginManagerAwarepluginManager - The PluginManagerpublic void setResourceResolver(org.springframework.core.io.support.PathMatchingResourcePatternResolver resourceResolver)
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionprotected org.springframework.core.io.Resource[] getPluginBundles(GrailsPlugin grailsPlugin)
grailsPlugin - The grails plugin that may or may not contain i18n internationalization files.Resource objects representing the internationalization files or
an empty array if no files are found.protected boolean isInlinePlugin(GrailsPlugin grailsPlugin)
grailsPlugin - The Grails plugin to test.true if the plugin is being used "inline" or false if the
plugin is not being used "inline".protected java.lang.String getInlinePluginPath(GrailsPlugin grailsPlugin)
null
if the plugin is not being used "inline".grailsPlugin - The Grails plugin.null if the plugin is not being used "inline".protected java.lang.String resolveCodeWithoutArguments(java.lang.String code,
java.util.Locale locale)
resolveCodeWithoutArguments in class org.springframework.context.support.ReloadableResourceBundleMessageSourceprotected java.text.MessageFormat resolveCode(java.lang.String code,
java.util.Locale locale)
resolveCode in class org.springframework.context.support.ReloadableResourceBundleMessageSourceprotected org.springframework.context.support.ReloadableResourceBundleMessageSource.PropertiesHolder getMergedPluginProperties(java.util.Locale locale)
Only used when caching resource bundle contents forever, i.e. with cacheSeconds < 0. Therefore, merged properties are always cached forever.
public void setCacheSeconds(int cacheSeconds)
setCacheSeconds in class org.springframework.context.support.ReloadableResourceBundleMessageSourceprotected java.lang.String resolveCodeWithoutArgumentsFromPlugins(java.lang.String code,
java.util.Locale locale)
code - The codelocale - The localeprotected java.text.MessageFormat resolveCodeFromPlugins(java.lang.String code,
java.util.Locale locale)
code - The codelocale - The localepublic void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader in interface org.springframework.context.ResourceLoaderAwaresetResourceLoader in class org.springframework.context.support.ReloadableResourceBundleMessageSource