org.openmrs.messagesource.impl
Class MutableResourceBundleMessageSource

java.lang.Object
  extended by org.springframework.context.support.MessageSourceSupport
      extended by org.springframework.context.support.AbstractMessageSource
          extended by org.springframework.context.support.ReloadableResourceBundleMessageSource
              extended by org.openmrs.messagesource.impl.MutableResourceBundleMessageSource
All Implemented Interfaces:
MutableMessageSource, org.springframework.context.ApplicationContextAware, org.springframework.context.HierarchicalMessageSource, org.springframework.context.MessageSource, org.springframework.context.ResourceLoaderAware

public class MutableResourceBundleMessageSource
extends org.springframework.context.support.ReloadableResourceBundleMessageSource
implements MutableMessageSource, org.springframework.context.ApplicationContextAware

ResourceBundleMessageSource extends ReloadableResourceBundleMessageSource to provide the additional features of a MutableMessageSource.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.context.support.ReloadableResourceBundleMessageSource
org.springframework.context.support.ReloadableResourceBundleMessageSource.PropertiesHolder
 
Field Summary
 
Fields inherited from class org.springframework.context.support.MessageSourceSupport
logger
 
Constructor Summary
MutableResourceBundleMessageSource()
           
 
Method Summary
 void addPresentation(PresentationMessage message)
          Adds a presentation message to the source.
 java.util.Collection<java.util.Locale> getLocales()
          Gets the locales for which messages are available from this source.
 PresentationMessage getPresentation(java.lang.String key, java.util.Locale forLocale)
          Gets the PresentationMessage for a particular locale.
 java.util.Collection<PresentationMessage> getPresentations()
          Returns all available messages.
 java.util.Collection<PresentationMessage> getPresentationsInLocale(java.util.Locale locale)
          Gets alll the available messages in a particular locale, packaged as PresentationMessages.
 void merge(MutableMessageSource fromSource, boolean overwrite)
          Merge messages from another source into this source.
 void publishProperties(java.util.Properties props, java.lang.String locale, java.lang.String namespace, java.lang.String name, java.lang.String version)
          Deprecated. use merge(MutableMessageSource, boolean)
 void removePresentation(PresentationMessage message)
          Removes a presentation message from the source.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setBasename(java.lang.String basename)
          Override to obtain a local reference to the basenames.
 void setBasenames(java.lang.String[] basenames)
          Override to obtain a local reference to the basenames.
 void setCacheSeconds(int cacheSeconds)
           
 
Methods inherited from class org.springframework.context.support.ReloadableResourceBundleMessageSource
calculateAllFilenames, calculateFilenamesForLocale, clearCache, clearCacheIncludingAncestors, getMergedProperties, getProperties, loadProperties, refreshProperties, resolveCode, resolveCodeWithoutArguments, setDefaultEncoding, setFallbackToSystemLocale, setFileEncodings, setPropertiesPersister, setResourceLoader, toString
 
Methods inherited from class org.springframework.context.support.AbstractMessageSource
getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isUseCodeAsDefaultMessage, renderDefaultMessage, resolveArguments, setParentMessageSource, setUseCodeAsDefaultMessage
 
Methods inherited from class org.springframework.context.support.MessageSourceSupport
createMessageFormat, formatMessage, isAlwaysUseMessageFormat, setAlwaysUseMessageFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.context.HierarchicalMessageSource
getParentMessageSource, setParentMessageSource
 
Methods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessage
 

Constructor Detail

MutableResourceBundleMessageSource

public MutableResourceBundleMessageSource()
Method Detail

getLocales

public java.util.Collection<java.util.Locale> getLocales()
Description copied from interface: MutableMessageSource
Gets the locales for which messages are available from this source.

Specified by:
getLocales in interface MutableMessageSource
Returns:
available message locales
See Also:
MutableMessageSource.getLocales()

setCacheSeconds

public void setCacheSeconds(int cacheSeconds)
Overrides:
setCacheSeconds in class org.springframework.context.support.ReloadableResourceBundleMessageSource

publishProperties

@Deprecated
public void publishProperties(java.util.Properties props,
                                         java.lang.String locale,
                                         java.lang.String namespace,
                                         java.lang.String name,
                                         java.lang.String version)
Deprecated. use merge(MutableMessageSource, boolean)

Presumes to append the messages to a message.properties file which is already being monitored by the super ReloadableResourceBundleMessageSource. This is a blind, trusting hack.

Specified by:
publishProperties in interface MutableMessageSource
Parameters:
props - key/value properties for the messages
locale - locale in which the messages are expressed
namespace - namespace within which the properties are valid ("" for generic, "module" for modules, etc)
name - unique name for the properties within the namespace
version - version of the properties
See Also:
MutableMessageSource.publishProperties(java.util.Properties, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException
See Also:
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)

getPresentations

public java.util.Collection<PresentationMessage> getPresentations()
Returns all available messages.

Specified by:
getPresentations in interface MutableMessageSource
Returns:
collection of presentation messages
See Also:
MutableMessageSource.getPresentations()

setBasename

public void setBasename(java.lang.String basename)
Override to obtain a local reference to the basenames.

Overrides:
setBasename in class org.springframework.context.support.ReloadableResourceBundleMessageSource
See Also:
ReloadableResourceBundleMessageSource.setBasename(java.lang.String)

setBasenames

public void setBasenames(java.lang.String[] basenames)
Override to obtain a local reference to the basenames.

Overrides:
setBasenames in class org.springframework.context.support.ReloadableResourceBundleMessageSource
See Also:
ReloadableResourceBundleMessageSource.setBasenames(java.lang.String[])

addPresentation

public void addPresentation(PresentationMessage message)
Description copied from interface: MutableMessageSource
Adds a presentation message to the source. This operation should overwrite any existing message which conflicts (has the same code and locale).

Specified by:
addPresentation in interface MutableMessageSource
Parameters:
message - message to add to the source
See Also:
MutableMessageSource.addPresentation(org.openmrs.messagesource.PresentationMessage)

removePresentation

public void removePresentation(PresentationMessage message)
Description copied from interface: MutableMessageSource
Removes a presentation message from the source.

Specified by:
removePresentation in interface MutableMessageSource
Parameters:
message - the message to remove
See Also:
MutableMessageSource.removePresentation(org.openmrs.messagesource.PresentationMessage)

merge

public void merge(MutableMessageSource fromSource,
                  boolean overwrite)
Description copied from interface: MutableMessageSource
Merge messages from another source into this source.

Specified by:
merge in interface MutableMessageSource
Parameters:
fromSource - message source from which messages should be merge
overwrite - whether to overwrite existing messages
See Also:
MutableMessageSource.merge(MutableMessageSource, boolean)

getPresentation

public PresentationMessage getPresentation(java.lang.String key,
                                           java.util.Locale forLocale)
Description copied from interface: MutableMessageSource
Gets the PresentationMessage for a particular locale.

Specified by:
getPresentation in interface MutableMessageSource
Parameters:
key - textual key for the message
forLocale - locale for which to get the message
Returns:
corresponding PresentationMessage, or null if not available
See Also:
MutableMessageSource.getPresentation(java.lang.String, java.util.Locale)

getPresentationsInLocale

public java.util.Collection<PresentationMessage> getPresentationsInLocale(java.util.Locale locale)
Description copied from interface: MutableMessageSource
Gets alll the available messages in a particular locale, packaged as PresentationMessages.

Specified by:
getPresentationsInLocale in interface MutableMessageSource
Parameters:
locale - locale for which to get the messages
Returns:
collection of PresentationMessages in the locale
See Also:
MutableMessageSource.getPresentationsInLocale(java.util.Locale)

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change