uk.org.ogsadai.common.msgs
Class DAIResourceBundle

java.lang.Object
  |
  +--uk.org.ogsadai.common.msgs.DAIResourceBundle

public class DAIResourceBundle
extends java.lang.Object

Manages the OGSA-DAI message bundle and allows to register other message bundles at runtime. The entries from any registered message bundle will be aggregated into a java.util.Properties object. For a given key, a value will be obtained by searching through the OGSA-DAI message bundle first and then, if a match could not be found, searching in any other registered message bundles.

Author:
The OGSA-DAI Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private static DAILogger LOG
          DAILogger object for logging in this class.
private static java.lang.String MAIN_MESSAGE_BUNDLE
          name of the main OGSA-DAI message properties file
private  java.util.PropertyResourceBundle mMainBundle
          main OGSA-DAI message bundle
private  java.util.Properties mProperties
          aggregated message bundle
 
Constructor Summary
DAIResourceBundle()
          Constructs a new resource bundle and loads the OGSA-DAI messages and any internationalization packages.
 
Method Summary
 java.lang.String getString(java.lang.String key)
          Searches for the property with the specified key in the message bundle.
 void registerResourceBundle(java.lang.String baseName, java.util.Locale locale)
          Tries to obtain a property resource bundle from a resource base name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
See Also:
Constant Field Values

LOG

private static DAILogger LOG
DAILogger object for logging in this class.


MAIN_MESSAGE_BUNDLE

private static final java.lang.String MAIN_MESSAGE_BUNDLE
name of the main OGSA-DAI message properties file

See Also:
Constant Field Values

mMainBundle

private java.util.PropertyResourceBundle mMainBundle
main OGSA-DAI message bundle


mProperties

private java.util.Properties mProperties
aggregated message bundle

Constructor Detail

DAIResourceBundle

public DAIResourceBundle()
Constructs a new resource bundle and loads the OGSA-DAI messages and any internationalization packages.

Throws:
java.util.MissingResourceException - if the main message bundle cannot be found
Method Detail

registerResourceBundle

public void registerResourceBundle(java.lang.String baseName,
                                   java.util.Locale locale)
Tries to obtain a property resource bundle from a resource base name. If this succeeds all entries from the resource bundle are retrieved and added to the mProperties member variable.

Parameters:
baseName - base name of the resource properties bundle
locale - the current locale
Throws:
java.lang.IllegalArgumentException - if the baseName is null
java.util.MissingResourceException - if a resource with the specified base name cannot be found

getString

public java.lang.String getString(java.lang.String key)
Searches for the property with the specified key in the message bundle.

Parameters:
key - a property key
Returns:
the value in the message bundle with the specified key value or null if no value could be found