1 16 17 package org.apache.axis.utils; 18 19 import org.apache.axis.i18n.MessageBundle; 20 import org.apache.axis.i18n.MessagesConstants; 21 22 import java.util.Locale ; 23 import java.util.MissingResourceException ; 24 import java.util.ResourceBundle ; 25 26 33 public class Messages { 34 private static final Class thisClass = Messages.class; 35 36 private static final String projectName = MessagesConstants.projectName; 37 38 private static final String resourceName = MessagesConstants.resourceName; 39 private static final Locale locale = MessagesConstants.locale; 40 41 private static final String packageName = getPackage(thisClass.getName()); 42 private static final ClassLoader classLoader = thisClass.getClassLoader(); 43 44 private static final ResourceBundle parent = 45 (MessagesConstants.rootPackageName == packageName) 46 ? null 47 : MessagesConstants.rootBundle; 48 49 50 51 52 private static final MessageBundle messageBundle = 53 new MessageBundle(projectName, packageName, resourceName, 54 locale, classLoader, parent); 55 56 63 public static String getMessage(String key) 64 throws MissingResourceException 65 { 66 return messageBundle.getMessage(key); 67 } 68 69 77 public static String getMessage(String key, String arg0) 78 throws MissingResourceException 79 { 80 return messageBundle.getMessage(key, arg0); 81 } 82 83 92 public static String getMessage(String key, String arg0, String arg1) 93 throws MissingResourceException 94 { 95 return messageBundle.getMessage(key, arg0, arg1); 96 } 97 98 108 public static String getMessage(String key, String arg0, String arg1, String arg2) 109 throws MissingResourceException 110 { 111 return messageBundle.getMessage(key, arg0, arg1, arg2); 112 } 113 114 125 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) 126 throws MissingResourceException 127 { 128 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); 129 } 130 131 143 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) 144 throws MissingResourceException 145 { 146 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); 147 } 148 149 157 public static String getMessage(String key, String [] args) 158 throws MissingResourceException 159 { 160 return messageBundle.getMessage(key, args); 161 } 162 163 public static ResourceBundle getResourceBundle() { 164 return messageBundle.getResourceBundle(); 165 } 166 167 public static MessageBundle getMessageBundle() { 168 return messageBundle; 169 } 170 171 private static final String getPackage(String name) { 172 return name.substring(0, name.lastIndexOf('.')).intern(); 173 } 174 } 175 | Popular Tags |