FileDocCategorySizeDatePackage
AdminLocalStringsManager.javaAPI DocGlassfish v2 API7996Fri May 04 22:34:10 BST 2007com.sun.enterprise.admin.util

AdminLocalStringsManager

public class AdminLocalStringsManager extends LocalStringsManager
Implementation of a Admin local string manager as Admin-specific wrapper around LocalStringsManager; Provides access to i18n messages for classes that need them. This particular implementation presents the following resources organization:
  • 1. Resource files share locations with sources (same directories);
  • 2. Base directory is "com.sun.enterprise.admin";
  • 3. Search ONLY in first resource bundle, which found on the way up to basePackage( No additional hiearchical search of value if it is not found in that file)

Fields Summary
static final String
ADMIN_BASE_PACKAGE
static final String
DEFAULT_PROPERTY_FILE_NAME
public static final String
MESSAGES
Messages Property File Type (file name prefix)
public static final String
DESCRIPTIONS
Decriptions Property File Type (file name prefix)
Constructors Summary
public AdminLocalStringsManager(Object callerObject)
Create a string manager that looks for default type properties(MESSAGES) in the package of the callerObject or parent Admin packages.

param
callerObject the caller object (defines starting package for searching)


                                         
      
    
        this(callerObject, DEFAULT_PROPERTY_FILE_NAME);
    
public AdminLocalStringsManager(Object callerObject, String propertyFileName)
Create a string manager that looks for -propertyFileName-.properties in the package of the callerObject or parent Admin packages;
It's supposed that propertyFileName should be one of well-known names, defined by constants: MESSAGES/DESCRIPTIONS/NOTIFICATIONS etc.

param
callerObject The caller object (defines starting package for searching).
param
propertyFileName property file name prefix (e.g. "myStrings");

        super(ADMIN_BASE_PACKAGE, propertyFileName);
        String callerClassPath;
        if(callerObject==null)
            callerClassPath = ADMIN_BASE_PACKAGE; //reffer to base
        else
        {
            callerClassPath = callerObject.getClass().getName();
            callerClassPath = callerClassPath.substring(0, callerClassPath.lastIndexOf('."));
        }
        setFixedResourceBundle(callerClassPath);
    
Methods Summary
public static com.sun.enterprise.admin.util.AdminLocalStringsManagercreateDescriptionsManager(java.lang.Object callerObject)
Convenient Factory class for obtaining a Admin string manager for description type strings.

param
callerObject The caller object (defines starting package for searching).

       return new AdminLocalStringsManager(callerObject, DESCRIPTIONS);
    
public static com.sun.enterprise.admin.util.AdminLocalStringsManagercreateMessagesManager(java.lang.Object callerObject)
Convenient Factory class for obtaining a Admin string manager for message type strings.

param
callerObject The caller object (defines starting package for searching).

       return new AdminLocalStringsManager(callerObject, MESSAGES);
    
public java.lang.StringgetString(java.lang.String key, java.lang.String defaultValue)
Get a localized string.

param
key The name of the resource to fetch
param
defaultValue The default return value if not found
return
The localized string

        return  super.getString(key, defaultValue);
    
public java.lang.StringgetString(java.lang.String key, java.lang.String defaultFormat, java.lang.Object[] args)
Get a local string and format the arguments accordingly.

param
key The key to the local format string
param
defaultFormat The default format if not found in the resources
param
arguments The set of arguments to provide to the formatter
return
A formatted localized string

        return  super.getString(key, defaultFormat, args);
    
public java.lang.StringgetString(java.lang.String key, java.lang.String defaultFormat, java.lang.Object arg1)
Convenience method - getString() overriding for fixed number of formatting arguments.

param
key The key to the local format string
param
defaultFormat The default format if not found in the resources
param
arg1 The first argument to provide to the formatter
return
A formatted localized string

        return  getString(key, defaultFormat, (new Object[]{arg1}));
    
public java.lang.StringgetString(java.lang.String key, java.lang.String defaultFormat, java.lang.Object arg1, java.lang.Object arg2)
Convenience method - getString() overriding for fixed number of formatting arguments.

param
key The key to the local format string
param
defaultFormat The default format if not found in the resources
param
arg1 The first argument to provide to the formatter
param
arg1 The second argument to provide to the formatter
return
A formatted localized string

        return  getString(key, defaultFormat, (new Object[]{arg1, arg2}));
    
public java.lang.StringgetString(java.lang.String key, java.lang.String defaultFormat, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
Convenience method - getString() overriding for fixed number of formatting arguments.

param
key The key to the local format string
param
defaultFormat The default format if not found in the resources
param
arg1 The first argument to provide to the formatter
param
arg2 The second argument to provide to the formatter
param
arg3 The third argument to provide to the formatter
return
A formatted localized string

        return  getString(key, defaultFormat, (new Object[]{arg1, arg2, arg3}));