1 23 package com.sun.enterprise.admin.util; 24 25 import java.util.ResourceBundle ; 26 import java.util.Locale ; 27 import java.text.MessageFormat ; 28 29 30 40 41 public class AdminLocalStringsManager extends LocalStringsManager 42 { 43 static final String ADMIN_BASE_PACKAGE = "com.sun.enterprise.admin"; 44 static final String DEFAULT_PROPERTY_FILE_NAME = "LocalStrings"; 45 46 47 public static final String MESSAGES = "Messages"; 48 49 public static final String DESCRIPTIONS = "MBeansInfo"; 50 51 56 public AdminLocalStringsManager(Object callerObject) 57 { 58 this(callerObject, DEFAULT_PROPERTY_FILE_NAME); 59 } 60 61 69 public AdminLocalStringsManager(Object callerObject, String propertyFileName) 70 { 71 super(ADMIN_BASE_PACKAGE, propertyFileName); 72 String callerClassPath; 73 if(callerObject==null) 74 callerClassPath = ADMIN_BASE_PACKAGE; else 76 { 77 callerClassPath = callerObject.getClass().getName(); 78 callerClassPath = callerClassPath.substring(0, callerClassPath.lastIndexOf('.')); 79 } 80 setFixedResourceBundle(callerClassPath); 81 } 82 83 87 public static AdminLocalStringsManager createMessagesManager(Object callerObject) 88 { 89 return new AdminLocalStringsManager(callerObject, MESSAGES); 90 } 91 95 public static AdminLocalStringsManager createDescriptionsManager(Object callerObject) 96 { 97 return new AdminLocalStringsManager(callerObject, DESCRIPTIONS); 98 } 99 100 101 107 public String getString( String key, String defaultValue) 108 { 109 return super.getString(key, defaultValue); 110 } 111 112 119 public String getString( String key, String defaultFormat, Object [] args) 120 { 121 return super.getString(key, defaultFormat, args); 122 } 123 124 131 public String getString( String key, String defaultFormat, Object arg1) 132 { 133 return getString(key, defaultFormat, (new Object []{arg1})); 134 } 135 136 144 public String getString( String key, String defaultFormat, Object arg1, Object arg2) 145 { 146 return getString(key, defaultFormat, (new Object []{arg1, arg2})); 147 } 148 149 158 public String getString( String key, String defaultFormat, Object arg1, Object arg2, Object arg3) 159 { 160 return getString(key, defaultFormat, (new Object []{arg1, arg2, arg3})); 161 } 162 } 163 164 | Popular Tags |