Java Doc for ResourceBundleMessageSource.java in  » J2EE » spring-framework-2.0.6 » org » springframework » context » support » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.context.support 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.context.support.AbstractMessageSource
      org.springframework.context.support.ResourceBundleMessageSource

ResourceBundleMessageSource
public class ResourceBundleMessageSource extends AbstractMessageSource implements BeanClassLoaderAware(Code)
org.springframework.context.MessageSource implementation that accesses resource bundles using specified basenames. This class relies on the underlying JDK's java.util.ResourceBundle implementation, in combination with the JDK's standard message parsing provided by java.text.MessageFormat .

This MessageSource caches both the accessed ResourceBundle instances and the generated MessageFormats for each message. It also implements rendering of no-arg messages without MessageFormat, as supported by the AbstractMessageSource base class. The caching provided by this MessageSource is significantly faster than the built-in caching of the java.util.ResourceBundle class.

Unfortunately, java.util.ResourceBundle caches loaded bundles forever: Reloading a bundle during VM execution is not possible. As this MessageSource relies on ResourceBundle, it faces the same limitation. Consider ReloadableResourceBundleMessageSource for an alternative that is capable of refreshing the underlying bundle files.
author:
   Rod Johnson
author:
   Juergen Hoeller
See Also:   ResourceBundleMessageSource.setBasenames
See Also:   ReloadableResourceBundleMessageSource
See Also:   java.util.ResourceBundle
See Also:   java.text.MessageFormat





Method Summary
protected  ResourceBundledoGetBundle(String basename, Locale locale)
     Obtain the resource bundle for the given basename and Locale.
protected  ClassLoadergetBundleClassLoader()
     Return the ClassLoader to load resource bundles with.
protected  MessageFormatgetMessageFormat(ResourceBundle bundle, String code, Locale locale)
     Return a MessageFormat for the given bundle and code, fetching already generated MessageFormats from the cache.
protected  ResourceBundlegetResourceBundle(String basename, Locale locale)
     Return a ResourceBundle for the given basename and code, fetching already generated MessageFormats from the cache.
protected  MessageFormatresolveCode(String code, Locale locale)
     Resolves the given message code as key in the registered resource bundles, using a cached MessageFormat instance per message code.
protected  StringresolveCodeWithoutArguments(String code, Locale locale)
     Resolves the given message code as key in the registered resource bundles, returning the value found in the bundle as-is (without MessageFormat parsing).
public  voidsetBasename(String basename)
     Set a single basename, following java.util.ResourceBundle conventions: essentially, a fully-qualified classpath location.
public  voidsetBasenames(String[] basenames)
     Set an array of basenames, each following java.util.ResourceBundle conventions: essentially, a fully-qualified classpath location.
public  voidsetBeanClassLoader(ClassLoader classLoader)
    
public  voidsetBundleClassLoader(ClassLoader classLoader)
     Set the ClassLoader to load resource bundles with.
public  StringtoString()
     Show the configuration of this MessageSource.



Method Detail
doGetBundle
protected ResourceBundle doGetBundle(String basename, Locale locale) throws MissingResourceException(Code)
Obtain the resource bundle for the given basename and Locale.
Parameters:
  basename - the basename to look for
Parameters:
  locale - the Locale to look for the corresponding ResourceBundle
throws:
  MissingResourceException - if no matching bundle could be found
See Also:   java.util.ResourceBundle.getBundle(Stringjava.util.LocaleClassLoader)
See Also:   ResourceBundleMessageSource.getBundleClassLoader()



getBundleClassLoader
protected ClassLoader getBundleClassLoader()(Code)
Return the ClassLoader to load resource bundles with.

Default is the containing BeanFactory's bean ClassLoader.
See Also:   ResourceBundleMessageSource.setBundleClassLoader




getMessageFormat
protected MessageFormat getMessageFormat(ResourceBundle bundle, String code, Locale locale) throws MissingResourceException(Code)
Return a MessageFormat for the given bundle and code, fetching already generated MessageFormats from the cache.
Parameters:
  bundle - the ResourceBundle to work on
Parameters:
  code - the message code to retrieve
Parameters:
  locale - the Locale to use to build the MessageFormat the resulting MessageFormat, or null if no messagedefined for the given code
throws:
  MissingResourceException - if thrown by the ResourceBundle



getResourceBundle
protected ResourceBundle getResourceBundle(String basename, Locale locale)(Code)
Return a ResourceBundle for the given basename and code, fetching already generated MessageFormats from the cache.
Parameters:
  basename - the basename of the ResourceBundle
Parameters:
  locale - the Locale to find the ResourceBundle for the resulting ResourceBundle, or null if nonefound for the given basename and Locale



resolveCode
protected MessageFormat resolveCode(String code, Locale locale)(Code)
Resolves the given message code as key in the registered resource bundles, using a cached MessageFormat instance per message code.



resolveCodeWithoutArguments
protected String resolveCodeWithoutArguments(String code, Locale locale)(Code)
Resolves the given message code as key in the registered resource bundles, returning the value found in the bundle as-is (without MessageFormat parsing).



setBasename
public void setBasename(String basename)(Code)
Set a single basename, following java.util.ResourceBundle conventions: essentially, a fully-qualified classpath location. If it doesn't contain a package qualifier (such as org.mypackage), it will be resolved from the classpath root.

Messages will normally be held in the "/lib" or "/classes" directory of a web application's WAR structure. They can also be held in jar files on the class path.

Note that ResourceBundle names are effectively classpath locations: As a consequence, the JDK's standard ResourceBundle treats dots as package separators. This means that "test.theme" is effectively equivalent to "test/theme", just like it is for programmatic java.util.ResourceBundle usage.
See Also:   ResourceBundleMessageSource.setBasenames
See Also:   java.util.ResourceBundle.getBundle(String)




setBasenames
public void setBasenames(String[] basenames)(Code)
Set an array of basenames, each following java.util.ResourceBundle conventions: essentially, a fully-qualified classpath location. If it doesn't contain a package qualifier (such as org.mypackage), it will be resolved from the classpath root.

The associated resource bundles will be checked sequentially when resolving a message code. Note that message definitions in a previous resource bundle will override ones in a later bundle, due to the sequential lookup.

Note that ResourceBundle names are effectively classpath locations: As a consequence, the JDK's standard ResourceBundle treats dots as package separators. This means that "test.theme" is effectively equivalent to "test/theme", just like it is for programmatic java.util.ResourceBundle usage.
See Also:   ResourceBundleMessageSource.setBasename
See Also:   java.util.ResourceBundle.getBundle(String)




setBeanClassLoader
public void setBeanClassLoader(ClassLoader classLoader)(Code)



setBundleClassLoader
public void setBundleClassLoader(ClassLoader classLoader)(Code)
Set the ClassLoader to load resource bundles with.

Default is the containing BeanFactory's org.springframework.beans.factory.BeanClassLoaderAware bean ClassLoader , or the default ClassLoader determined by org.springframework.util.ClassUtils.getDefaultClassLoader if not running within a BeanFactory.




toString
public String toString()(Code)
Show the configuration of this MessageSource.



Fields inherited from org.springframework.context.support.AbstractMessageSource
final protected Log logger(Code)(Java Doc)

Methods inherited from org.springframework.context.support.AbstractMessageSource
protected MessageFormat createMessageFormat(String msg, Locale locale)(Code)(Java Doc)
protected String formatMessage(String msg, Object[] args, Locale locale)(Code)(Java Doc)
protected String getDefaultMessage(String code)(Code)(Java Doc)
final public String getMessage(String code, Object[] args, String defaultMessage, Locale locale)(Code)(Java Doc)
final public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException(Code)(Java Doc)
final public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException(Code)(Java Doc)
protected String getMessageFromParent(String code, Object[] args, Locale locale)(Code)(Java Doc)
protected String getMessageInternal(String code, Object[] args, Locale locale)(Code)(Java Doc)
public MessageSource getParentMessageSource()(Code)(Java Doc)
protected boolean isAlwaysUseMessageFormat()(Code)(Java Doc)
protected boolean isUseCodeAsDefaultMessage()(Code)(Java Doc)
protected String renderDefaultMessage(String defaultMessage, Object[] args, Locale locale)(Code)(Java Doc)
protected Object[] resolveArguments(Object[] args, Locale locale)(Code)(Java Doc)
abstract protected MessageFormat resolveCode(String code, Locale locale)(Code)(Java Doc)
protected String resolveCodeWithoutArguments(String code, Locale locale)(Code)(Java Doc)
public void setAlwaysUseMessageFormat(boolean alwaysUseMessageFormat)(Code)(Java Doc)
public void setParentMessageSource(MessageSource parent)(Code)(Java Doc)
public void setUseCodeAsDefaultMessage(boolean useCodeAsDefaultMessage)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.