1   package org.wcb.resources;
2   
3   import java.util.ResourceBundle;
4   import java.util.Locale;
5   import java.util.MissingResourceException;
6   
7   /**
8    * <small>
9    * Copyright (c)  2006  wbogaardt.
10   * Permission is granted to copy, distribute and/or modify this document
11   * under the terms of the GNU Free Documentation License, Version 1.2
12   * or any later version published by the Free Software Foundation;
13   * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
14   * Texts.  A copy of the license is included in the section entitled "GNU
15   * Free Documentation License".
16   * <p/>
17   * $File:  $ <br>
18   * $Change:  $ submitted by $Author: wbogaardt $ at $DateTime: Apr 10, 2006 3:12:38 PM $ <br>
19   * </small>
20   *
21   * @author wbogaardt
22   * @version 1
23   *          Date: Apr 10, 2006
24   *          Time: 3:12:38 PM
25   */
26  
27  public class MessageResourceRegister {
28  
29      private static final String PATH = "org.wcb.resources.";
30      private static MessageResourceRegister instanceValue;
31      private ResourceBundle rbInternationalization;
32  
33      private MessageResourceRegister() {         
34          Locale currentLocal = new Locale("en", "US");
35          try
36          {
37              rbInternationalization = ResourceBundle.getBundle(PATH
38                      + "jPilotResource", currentLocal, MessageResourceRegister.class.getClassLoader());
39          }
40          catch (MissingResourceException mre) {
41              System.err.println("No resource bundle found" + mre);
42          }
43      }
44  
45      /**
46       * Gets an instance val of this register.
47       * @return The instance.
48       */
49      public static MessageResourceRegister getInstance() {
50          if (instanceValue == null) {
51              instanceValue = new MessageResourceRegister();
52          }
53          return instanceValue;
54      }
55  
56      /**
57       * The value for the key requested.
58       * @param key The key
59       * @return String text value.
60       */
61      public String getValue(String key) {
62          return rbInternationalization.getString(key);
63      }
64  }