1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.juddi.config;
19
20 import java.util.ResourceBundle;
21 import java.util.Locale;
22
23
24
25
26 public class ResourceConfig {
27 public static final String GLOBAL_MESSAGES_FILE = "messages";
28
29 private static final ResourceBundle globalMessages;
30
31 static {
32 try {
33 globalMessages = ResourceBundle.getBundle(GLOBAL_MESSAGES_FILE, Locale.getDefault());
34 }
35 catch (Throwable t) {
36 System.err.println("Initial configuration failed:" + t);
37 throw new ExceptionInInitializerError(t);
38 }
39 }
40
41 public static String getGlobalMessage(String key) {
42 String msg = null;
43 if (globalMessages != null) {
44 if (key != null && key.length() > 0)
45 msg = globalMessages.getString(key);
46 }
47 if (msg != null && msg.length() > 0)
48 return msg;
49
50 return key;
51 }
52 }