/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }
protected String localizeCounterName(String counterName) { return ResourceBundles.getCounterName(FileSystemCounter.class.getName(), counterName, counterName); }
/** * Get the counter display name * @param group the counter group name for the counter * @param counter the counter name to lookup * @param defaultValue of the counter * @return the counter display name */ public static String getCounterName(String group, String counter, String defaultValue) { return getValue(group, counter, ".name", defaultValue); } }
/** * Create a new counter group * @param name of the group * @param limits the counters limits policy object * @return a new counter group */ public G newGroup(String name, Limits limits) { return newGroup(name, ResourceBundles.getCounterGroupName(name, name), limits); }
@Override public String getDisplayName() { if (displayName == null) { displayName = ResourceBundles.getCounterGroupName(getName(), "File System Counters"); } return displayName; }
/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }
@Override public String getDisplayName() { if (displayName == null) { displayName = ResourceBundles.getCounterGroupName(getName(), "File System Counters"); } return displayName; }
protected String localizeCounterName(String counterName) { return ResourceBundles.getCounterName(FileSystemCounter.class.getName(), counterName, counterName); }
/** * Get the counter group display name * @param group the group name to lookup * @param defaultValue of the group * @return the group display name */ public static String getCounterGroupName(String group, String defaultValue) { return getValue(group, "CounterGroupName", "", defaultValue); }
/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }
@Override public String getDisplayName() { if (displayName == null) { displayName = ResourceBundles.getCounterGroupName(getName(), "File System Counters"); } return displayName; }
protected String localizeCounterName(String counterName) { return ResourceBundles.getCounterName(FileSystemCounter.class.getName(), counterName, counterName); }
/** * Get the counter display name * @param group the counter group name for the counter * @param counter the counter name to lookup * @param defaultValue of the counter * @return the counter display name */ public static String getCounterName(String group, String counter, String defaultValue) { return getValue(group, counter, ".name", defaultValue); } }
/** * Get a resource given bundle name and key * @param <T> type of the resource * @param bundleName name of the resource bundle * @param key to lookup the resource * @param suffix for the key to lookup * @param defaultValue of the resource * @return the resource or the defaultValue * @throws ClassCastException if the resource found doesn't match T */ @SuppressWarnings("unchecked") public static synchronized <T> T getValue(String bundleName, String key, String suffix, T defaultValue) { T value; try { ResourceBundle bundle = getBundle(bundleName); value = (T) bundle.getObject(getLookupKey(key, suffix)); } catch (Exception e) { return defaultValue; } return value; }
@Override public String getDisplayName() { if (displayName == null) { displayName = ResourceBundles.getCounterGroupName(getName(), "File System Counters"); } return displayName; }
protected String localizeCounterName(String counterName) { return ResourceBundles.getCounterName(FileSystemCounter.class.getName(), counterName, counterName); }
/** * Get the counter group display name * @param group the group name to lookup * @param defaultValue of the group * @return the group display name */ public static String getCounterGroupName(String group, String defaultValue) { return getValue(group, "CounterGroupName", "", defaultValue); }
/** * Create a new counter group * @param name of the group * @param limits the counters limits policy object * @return a new counter group */ public G newGroup(String name, Limits limits) { return newGroup(name, ResourceBundles.getCounterGroupName(name, name), limits); }
private synchronized T findCounterImpl(String counterName, boolean create) { T counter = counters.get(counterName); if (counter == null && create) { String localized = ResourceBundles.getCounterName(getName(), counterName, counterName); return addCounterImpl(counterName, localized, 0); } return counter; }
/** * Get the counter display name * @param group the counter group name for the counter * @param counter the counter name to lookup * @param defaultValue of the counter * @return the counter display name */ public static String getCounterName(String group, String counter, String defaultValue) { return getValue(group, counter, ".name", defaultValue); } }