Creating Resource Bundles
A resource bundle typically contains all display strings and messages used by the adapter at run time and at design time. A resource bundle is specific to particular locale. If you plan to run your adapter in multiple locales, you can include multiple, locale-specific resource bundles. Doing this enables you to internationalize an adapter quickly, without having to change any code in the adapter. An adapter must have one or more resource bundles.
A resource bundle consists of lookup keys that provide locale-specific objects (normally text strings). A lookup key consists of a constant provided by the ADKGLOBAL class (a class provided by the ADK's API) combined with your adapter's class name or a parameter name. For a list of these constants, see
Resource Bundle Lookup Keys.
For example, the ADK uses the following lookup key whenever the display name of the adapter is required. (Assume that the method MyAdapter.getAdapterName will return the class name MyAdapter.)
MyAdapter.class.getName() + ADKGLOBAL.RESOURCEBUNDLEKEY_DISPLAYNAME
The following lookup key produces a description for a parameter named password, which is used to configure a connection pool:
"password" + ADKGLOBAL.RESOURCEBUNDLEKEY_DESCRIPTION
The adapter automatically references lookup keys to provide text for the following elements of your adapter:
The display names, property descriptions, and online help links of the:
Adapter definition
Connection types
Adapter service templates
Polling notification templates
Parameters used to configure nodes
Metadata group names
Log entries
Exception text
Note:
You may also make explicit use of a resource bundle to localize other data, such as resource domain values, especially if those values are known at development time (for example, a list of known record status values). In these cases, the strategy for key composition is left to your discretion. For more information, see
Using Resource Bundles with Resource Domain
Values. Resource domain values are discussed in detail in
Resource Domains.
To create a resource bundle implementation class
1. Extend the java.util.ListResourceBundle base class.
In the example shown in
Adapter Definition Implementation
Classes, this class is MyAdapterResourceBundle. You should create your class in the same directory in which you created your WmAdapter implementation class.
If you create multiple resource bundle classes, use the following naming convention:
ResourceBundleName ResourceBundleName_locale
For example, a default resource bundle and a corresponding locale-specific bundle for use in Japan might be named:
MyAdapterResourceBundle
MyAdapterResourceBundle_ja
For more information about resource bundle naming conventions, see the Javadoc for java.util.ResourceBundle.
Note:
You specify the adapter’s default resource bundle in your WmAdapter implementation class (see
Describing the Adapter to
Integration Server). For each resource bundle lookup, the adapter uses the default resource bundle if a bundle specific to the target locale is not available.
3. In your WmAdapter implementation class, return the name of your default resource bundle using the getAdapterResourceBundleName method. For an example, see
Example WmAdapter Implementation
Class.