Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.context.support
[Java] Class PluginAwareResourceBundleMessageSource

    java.lang.Object
      org.springframework.context.support.MessageSourceSupport
          org.springframework.context.support.AbstractMessageSource
              org.springframework.context.support.ReloadableResourceBundleMessageSource
                  org.codehaus.groovy.grails.context.support.PluginAwareResourceBundleMessageSource

All Implemented Interfaces:
  GrailsApplicationAware, org.springframework.beans.factory.InitializingBean, PluginManagerAware

    public class PluginAwareResourceBundleMessageSource
    extends org.springframework.context.support.ReloadableResourceBundleMessageSource

A ReloadableResourceBundleMessageSource that is capable of loading message sources from plugins.

Authors:
  Graeme Rocher

Since:
  1.1

Field Summary
`protected GrailsApplication` | `application`
`protected java.util.List` | `pluginBaseNames`
`protected GrailsPluginManager` | `pluginManager`

Method Summary
`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 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` | `getPluginBaseNames()`
`protected 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)`
`void` | `setCacheSeconds(int cacheSeconds)`
`void` | `setGrailsApplication(GrailsApplication grailsApplication)`
`void` | `setPluginBaseNames(java.util.List pluginBaseNames)`
`void` | `setPluginManager(GrailsPluginManager pluginManager)`
`void` | `setResourceLoader(ResourceLoader resourceLoader)`

Methods inherited from class org.springframework.context.support.ReloadableResourceBundleMessageSource
org.springframework.context.support.ReloadableResourceBundleMessageSource#toString(), org.springframework.context.support.ReloadableResourceBundleMessageSource#clearCache(), org.springframework.context.support.ReloadableResourceBundleMessageSource#setResourceLoader(org.springframework.core.io.ResourceLoader), org.springframework.context.support.ReloadableResourceBundleMessageSource#setDefaultEncoding(java.lang.String), org.springframework.context.support.ReloadableResourceBundleMessageSource#setPropertiesPersister(org.springframework.util.PropertiesPersister), org.springframework.context.support.ReloadableResourceBundleMessageSource#setBasename(java.lang.String), org.springframework.context.support.ReloadableResourceBundleMessageSource#setBasenames([Ljava.lang.String;), org.springframework.context.support.ReloadableResourceBundleMessageSource#setFileEncodings(java.util.Properties), org.springframework.context.support.ReloadableResourceBundleMessageSource#setFallbackToSystemLocale(boolean), org.springframework.context.support.ReloadableResourceBundleMessageSource#setCacheSeconds(int), org.springframework.context.support.ReloadableResourceBundleMessageSource#clearCacheIncludingAncestors(), org.springframework.context.support.ReloadableResourceBundleMessageSource#getMessage(org.springframework.context.MessageSourceResolvable, java.util.Locale), org.springframework.context.support.ReloadableResourceBundleMessageSource#getMessage(java.lang.String, [Ljava.lang.Object;, java.lang.String, java.util.Locale), org.springframework.context.support.ReloadableResourceBundleMessageSource#getMessage(java.lang.String, [Ljava.lang.Object;, java.util.Locale), org.springframework.context.support.ReloadableResourceBundleMessageSource#getParentMessageSource(), org.springframework.context.support.ReloadableResourceBundleMessageSource#setParentMessageSource(org.springframework.context.MessageSource), org.springframework.context.support.ReloadableResourceBundleMessageSource#setUseCodeAsDefaultMessage(boolean), org.springframework.context.support.ReloadableResourceBundleMessageSource#setAlwaysUseMessageFormat(boolean), org.springframework.context.support.ReloadableResourceBundleMessageSource#wait(), org.springframework.context.support.ReloadableResourceBundleMessageSource#wait(long), org.springframework.context.support.ReloadableResourceBundleMessageSource#wait(long, int), org.springframework.context.support.ReloadableResourceBundleMessageSource#equals(java.lang.Object), org.springframework.context.support.ReloadableResourceBundleMessageSource#hashCode(), org.springframework.context.support.ReloadableResourceBundleMessageSource#getClass(), org.springframework.context.support.ReloadableResourceBundleMessageSource#notify(), org.springframework.context.support.ReloadableResourceBundleMessageSource#notifyAll()

Methods inherited from class org.springframework.context.support.AbstractMessageSource
org.springframework.context.support.AbstractMessageSource#getMessage(org.springframework.context.MessageSourceResolvable, java.util.Locale), org.springframework.context.support.AbstractMessageSource#getMessage(java.lang.String, [Ljava.lang.Object;, java.lang.String, java.util.Locale), org.springframework.context.support.AbstractMessageSource#getMessage(java.lang.String, [Ljava.lang.Object;, java.util.Locale), org.springframework.context.support.AbstractMessageSource#getParentMessageSource(), org.springframework.context.support.AbstractMessageSource#setParentMessageSource(org.springframework.context.MessageSource), org.springframework.context.support.AbstractMessageSource#setUseCodeAsDefaultMessage(boolean), org.springframework.context.support.AbstractMessageSource#setAlwaysUseMessageFormat(boolean), org.springframework.context.support.AbstractMessageSource#wait(), org.springframework.context.support.AbstractMessageSource#wait(long), org.springframework.context.support.AbstractMessageSource#wait(long, int), org.springframework.context.support.AbstractMessageSource#equals(java.lang.Object), org.springframework.context.support.AbstractMessageSource#toString(), org.springframework.context.support.AbstractMessageSource#hashCode(), org.springframework.context.support.AbstractMessageSource#getClass(), org.springframework.context.support.AbstractMessageSource#notify(), org.springframework.context.support.AbstractMessageSource#notifyAll()

Field Detail

### application

    protected GrailsApplication application

### pluginBaseNames

    protected java.util.List pluginBaseNames

### pluginManager

    protected GrailsPluginManager pluginManager

Method Detail

### afterPropertiesSet

    public void afterPropertiesSet()

### getInlinePluginPath

    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".
  Parameters:
    `grailsPlugin` - The Grails plugin.
  Returns:
    The absolute path to the "inline" plugin or `null` if the plugin is not being used "inline".

### getMergedPluginProperties

    protected PropertiesHolder getMergedPluginProperties(java.util.Locale locale)

  Get a PropertiesHolder that contains the actually visible properties for a Locale, after merging all specified resource bundles. Either fetches the holder from the cache or freshly loads it.

  Only used when caching resource bundle contents forever, i.e. with cacheSeconds < 0. Therefore, merged properties are always cached forever.

### getPluginBaseNames

    public java.util.List getPluginBaseNames()

### getPluginBundles

    protected 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.
  Parameters:
    `grailsPlugin` - The grails plugin that may or may not contain i18n internationalization files.
  Returns:
    An array of `Resource` objects representing the internationalization files or an empty array if no files are found.

### isInlinePlugin

    protected boolean isInlinePlugin(GrailsPlugin grailsPlugin)

  Tests whether or not the Grails plugin is currently being run "inline".
  Parameters:
    `grailsPlugin` - The Grails plugin to test.
  Returns:
    `true` if the plugin is being used "inline" or `false` if the plugin is not being used "inline".

### resolveCode

    return mf;
    protected java.text.MessageFormat resolveCode(java.lang.String code, java.util.Locale locale)

### resolveCodeFromPlugins

    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
  Parameters:
    `code` - The code
    `locale` - The locale
  Returns:
    a MessageFormat

### resolveCodeWithoutArguments

    return msg;
    protected java.lang.String resolveCodeWithoutArguments(java.lang.String code, java.util.Locale locale)

### resolveCodeWithoutArgumentsFromPlugins

    protected java.lang.String resolveCodeWithoutArgumentsFromPlugins(java.lang.String code, java.util.Locale locale)

### setCacheSeconds

    * Attempts to resolve a String for the code from the list of plugin base names
    public void setCacheSeconds(int cacheSeconds)

### setGrailsApplication

    public void setGrailsApplication(GrailsApplication grailsApplication)

### setPluginBaseNames

    public void setPluginBaseNames(java.util.List pluginBaseNames)

### setPluginManager

    public void setPluginManager(GrailsPluginManager pluginManager)

### setResourceLoader

    BuildSettings settings = BuildSettingsHolder.getSettings();
    public void setResourceLoader(ResourceLoader resourceLoader)

Groovy Documentation