|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.beasys.commerce.util.MessageCatalog
A message catalog is a collection of property files that store paired
sets of keyed messages. The MessageCatalog
exposes an API
for accessing catalog messages. Each message catalog property file
obeys the following naming convention:
namespace_[language]_[country]_[variant].properties
The namespace describes the type of messages contained in the property
file, whereas the language, country, and variant describe a locale (as
represented by the Locale
). In order to expose the
messages contained in a message catalog property file, the file must
be included in the classpath.
Each property file contains zero or more lines of the following format:
messageKey.user=[user message]
messageKey.log=[log message]
Both the user and log messages are a description of the message itself;
however, the user message text is targeted at developers, whereas the log
message text is targeted at application administrators. Both the user
and log messages may contain parameter substitution tags for supporting
dynamic message parameter substitution. To do so, use substitution tags of
the form described in the documentation for MessageFormat
.
Example:
message1.log=Could not access account {1,number,integer}.
PropertyResourceBundle
,
MessageFormat
Field Summary | |
protected static java.util.Hashtable |
cachedResourceBundles
|
static java.lang.String |
DEFAULT_MESSAGE
|
static java.lang.String |
DEFAULT_NAMESPACE
|
static java.lang.String |
LOG_MESSAGE_SUFFIX
|
static java.lang.String |
USER_MESSAGE_SUFFIX
|
Constructor Summary | |
MessageCatalog()
|
Method Summary | |
static java.lang.String |
getLogMessage(java.lang.String messageKey)
Retrieves a catalog log message by default namespace and message key. |
static java.lang.String |
getLogMessage(java.lang.String messageKey,
java.lang.Object argument)
Retrieves a catalog log message by default namespace and message key and performs parameter substitution on the target message using the supplied argument. |
static java.lang.String |
getLogMessage(java.lang.String messageKey,
java.lang.Object[] arguments)
Retrieves a catalog log message by default namespace and message key and performs parameter substitution on the target message using the supplied arguments. |
static java.lang.String |
getLogMessage(java.lang.String namespace,
java.lang.String messageKey)
Retrieves a catalog log message by namespace and message key. |
static java.lang.String |
getLogMessage(java.lang.String namespace,
java.lang.String messageKey,
java.lang.Object argument)
Retrieves a catalog log message by namespace and message key and performs parameter substitution on the target message using the supplied argument. |
static java.lang.String |
getLogMessage(java.lang.String namespace,
java.lang.String messageKey,
java.lang.Object[] arguments)
Retrieves a catalog log message by namespace and message key and performs parameter substitution on the target message using the supplied arguments. |
protected static java.lang.String |
getMessage(java.lang.String namespace,
java.lang.String messageKey,
java.lang.String messageKeySuffix,
java.lang.Object[] arguments)
Retrieves a catalog message by namespace, message key, and message key suffix and performs parameter substitution on the target message using the supplied arguments. |
protected static java.util.ResourceBundle |
getResourceBundle(java.lang.String namespace)
Searches the cached resource bundles for the resource bundle of the supplied namespace and locale, and returns it if found. |
static java.lang.String |
getUserMessage(java.lang.String messageKey)
Retrieves a catalog user message by default namespace and message key. |
static java.lang.String |
getUserMessage(java.lang.String messageKey,
java.lang.Object argument)
Retrieves a catalog user message by default namespace and message key and performs parameter substitution on the target message using the supplied argument. |
static java.lang.String |
getUserMessage(java.lang.String messageKey,
java.lang.Object[] arguments)
Retrieves a catalog user message by default namespace and message key and performs parameter substitution on the target message using the supplied arguments. |
static java.lang.String |
getUserMessage(java.lang.String namespace,
java.lang.String messageKey)
Retrieves a catalog user message by namespace and message key. |
static java.lang.String |
getUserMessage(java.lang.String namespace,
java.lang.String messageKey,
java.lang.Object argument)
Retrieves a catalog user message by namespace and message key and performs parameter substitution on the target message using the supplied argument. |
static java.lang.String |
getUserMessage(java.lang.String namespace,
java.lang.String messageKey,
java.lang.Object[] arguments)
Retrieves a catalog user message by namespace and message key and performs parameter substitution on the target message using the supplied arguments. |
static void |
main(java.lang.String[] args)
UT entry point. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static java.util.Hashtable cachedResourceBundles
public static final java.lang.String DEFAULT_NAMESPACE
public static final java.lang.String DEFAULT_MESSAGE
public static final java.lang.String USER_MESSAGE_SUFFIX
public static final java.lang.String LOG_MESSAGE_SUFFIX
Constructor Detail |
public MessageCatalog()
Method Detail |
protected static java.util.ResourceBundle getResourceBundle(java.lang.String namespace)
null
is
returned.null
public static java.lang.String getUserMessage(java.lang.String messageKey)
messageKey
- The key of the target message.public static java.lang.String getUserMessage(java.lang.String messageKey, java.lang.Object argument)
messageKey
- The key of the target message.argument
- The substitution argument.public static java.lang.String getUserMessage(java.lang.String messageKey, java.lang.Object[] arguments)
messageKey
- The key of the target message.arguments
- The substitution arguments.public static java.lang.String getUserMessage(java.lang.String namespace, java.lang.String messageKey)
namespace
- The namespace of the target message.messageKey
- The key of the target message.public static java.lang.String getUserMessage(java.lang.String namespace, java.lang.String messageKey, java.lang.Object argument)
namespace
- The namespace of the target message.messageKey
- The key of the target message.argument
- The substitution argument.public static java.lang.String getUserMessage(java.lang.String namespace, java.lang.String messageKey, java.lang.Object[] arguments)
namespace
- The namespace of the target message.messageKey
- The key of the target message.arguments
- The substitution arguments.public static java.lang.String getLogMessage(java.lang.String messageKey)
messageKey
- The key of the target message.public static java.lang.String getLogMessage(java.lang.String messageKey, java.lang.Object argument)
messageKey
- The key of the target message.argument
- The substitution argument.public static java.lang.String getLogMessage(java.lang.String messageKey, java.lang.Object[] arguments)
messageKey
- The key of the target message.arguments
- The substitution arguments.public static java.lang.String getLogMessage(java.lang.String namespace, java.lang.String messageKey)
namespace
- The namespace of the target message.messageKey
- The key of the target message.public static java.lang.String getLogMessage(java.lang.String namespace, java.lang.String messageKey, java.lang.Object argument)
namespace
- The namespace of the target message.messageKey
- The key of the target message.argument
- The substitution argument.public static java.lang.String getLogMessage(java.lang.String namespace, java.lang.String messageKey, java.lang.Object[] arguments)
namespace
- The namespace of the target message.messageKey
- The key of the target message.arguments
- The substitution arguments.protected static java.lang.String getMessage(java.lang.String namespace, java.lang.String messageKey, java.lang.String messageKeySuffix, java.lang.Object[] arguments)
namespace
- The namespace of the target message.messageKey
- The key of the target message.messageKeySuffix
- The key suffix of the target message.arguments
- The substitution arguments.public static void main(java.lang.String[] args)
args
- The command line arguments.
|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |