1 55 56 package org.jboss.axis.utils; 57 58 import org.jboss.axis.i18n.MessageBundle; 59 import org.jboss.axis.i18n.MessagesConstants; 60 61 import java.util.Locale ; 62 import java.util.MissingResourceException ; 63 import java.util.ResourceBundle ; 64 65 71 public class Messages 72 { 73 private static final Class thisClass = Messages.class; 74 75 private static final String projectName = MessagesConstants.projectName; 76 77 private static final String resourceName = MessagesConstants.resourceName; 78 private static final Locale locale = MessagesConstants.locale; 79 80 private static final String packageName = getPackage(thisClass.getName()); 81 private static final ClassLoader classLoader = thisClass.getClassLoader(); 82 83 private static final ResourceBundle parent = 84 (MessagesConstants.rootPackageName == packageName) 85 ? null 86 : MessagesConstants.rootBundle; 87 88 89 92 93 private static final MessageBundle messageBundle = 94 new MessageBundle(projectName, packageName, resourceName, 95 locale, classLoader, parent); 96 97 105 public static String getMessage(String key) 106 throws MissingResourceException 107 { 108 return messageBundle.getMessage(key); 109 } 110 111 120 public static String getMessage(String key, String arg0) 121 throws MissingResourceException 122 { 123 return messageBundle.getMessage(key, arg0); 124 } 125 126 136 public static String getMessage(String key, String arg0, String arg1) 137 throws MissingResourceException 138 { 139 return messageBundle.getMessage(key, arg0, arg1); 140 } 141 142 153 public static String getMessage(String key, String arg0, String arg1, String arg2) 154 throws MissingResourceException 155 { 156 return messageBundle.getMessage(key, arg0, arg1, arg2); 157 } 158 159 171 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) 172 throws MissingResourceException 173 { 174 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); 175 } 176 177 190 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) 191 throws MissingResourceException 192 { 193 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); 194 } 195 196 205 public static String getMessage(String key, String [] args) 206 throws MissingResourceException 207 { 208 return messageBundle.getMessage(key, args); 209 } 210 211 public static ResourceBundle getResourceBundle() 212 { 213 return messageBundle.getResourceBundle(); 214 } 215 216 public static MessageBundle getMessageBundle() 217 { 218 return messageBundle; 219 } 220 221 private static final String getPackage(String name) 222 { 223 return name.substring(0, name.lastIndexOf('.')).intern(); 224 } 225 } 226 | Popular Tags |