psdi.util

Class MessageBundle

  • java.lang.Object
    • psdi.util.MessageBundle


  • public class MessageBundle
    extends java.lang.Object
    MessageBundle holds a list of messages that have all been retrieved from the same messaage file. All messages displayed by the system are held in external files editable by the user for translation and customization purposes. All messages are loaded into a hashtable in memory. There can be many Message bundles active at any one time. There will usually be one per application, but there will also be bundles that may be used by many applications.
    • Constructor Summary

      Constructors 
      Constructor and Description
      MessageBundle() 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Message getMessage(java.lang.String key)
      Get the message object based on the key value passed.
      java.lang.String getName()
      Return the name of the message bundle This is set to the parmaters that is passed to the loadFromFile method.
      void loadFromFile(java.lang.String filename)
      Load the message bundle from a file.
      void loadFromReader(java.io.InputStreamReader reader)
      Load the message bundle from the given reader.
      void loadFromStream(java.io.InputStream inputStream)
      Load the message bundle from the given stream.
      static void main(java.lang.String[] args)
      Main rountine used for testing purposes only Currently this is hard coded to pick up the file test.txt
      java.lang.String toString()
      Used to dump the contents of the message bundle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MessageBundle

        public MessageBundle()
    • Method Detail

      • loadFromFile

        public void loadFromFile(java.lang.String filename)
                          throws java.io.IOException
        Load the message bundle from a file. File name specified should be exclusive of file extension and path. The system will use the Resolver class to identify the appropriate file depending on Locale etc.
        Parameters:
        filename -
        Throws:
        java.io.IOException
      • loadFromStream

        public void loadFromStream(java.io.InputStream inputStream)
                            throws java.io.IOException
        Load the message bundle from the given stream.
        Parameters:
        InputStream -
        Throws:
        java.io.IOException
      • loadFromReader

        public void loadFromReader(java.io.InputStreamReader reader)
                            throws java.io.IOException
        Load the message bundle from the given reader.
        Parameters:
        InputStreamReader -
        Throws:
        java.io.IOException
      • getName

        public java.lang.String getName()
        Return the name of the message bundle This is set to the parmaters that is passed to the loadFromFile method. This is used by the Session class that keys a table of Message Bundles and uses the name to look it up or load it.
      • getMessage

        public Message getMessage(java.lang.String key)
        Get the message object based on the key value passed. Returns a message object if key found, otherwise returns null.
      • toString

        public java.lang.String toString()
        Used to dump the contents of the message bundle
        Overrides:
        toString in class java.lang.Object
      • main

        public static void main(java.lang.String[] args)
                         throws java.lang.Exception
        Main rountine used for testing purposes only Currently this is hard coded to pick up the file test.txt
        Throws:
        java.lang.Exception