Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | The Adapter Definition | Creating Resource Bundles | Creating Resource Bundles Class With Example
 
Creating Resource Bundles Class With Example
*To create a resource bundle implementation class
1. Create a class by extending the base class java.util.ListResourceBundle in the same Java package that you created for WmAdapter implementation class. For example: com\mycompany\adapter\myadapter.
Note:
You must create your class in the same adapterPackageName\code\source folder in which you created your WmAdapter implementation class in the webMethods package you created using Designer.
In the example, the MyAdapterResource class in folder com\wm\MyAdapter. In the example, the Java package created is com\wm\MyAdapter.

package com.wm.MyAdapter;

import java.util.ListResourceBundle;
import com.wm.adk.ADKGLOBAL;

public class MyAdapterResource extends ListResourceBundle implements MyAdapterConstants{

static final String IS_PKG_NAME = "/MyAdapter/";

static final Object[][] _contents = {
// adapter type display name.
{ADAPTER_NAME + ADKGLOBAL.RESOURCEBUNDLEKEY_DISPLAYNAME, "My Adapter"}
// adapter type descriptions.
,{ADAPTER_NAME + ADKGLOBAL.RESOURCEBUNDLEKEY_DESCRIPTION,
"Adapter for MyAdapter Server (a Sample System)"}
// adapter type vendor.
,{ADAPTER_NAME + ADKGLOBAL.RESOURCEBUNDLEKEY_VENDORNAME, "Software AG"}
//Copyright URL Page
,{ADAPTER_NAME + ADKGLOBAL.RESOURCEBUNDLEKEY_THIRDPARTYCOPYRIGHTURL,
IS_PKG_NAME + "copyright.html"}
//Copyright Encoding
,{ADAPTER_NAME + ADKGLOBAL.RESOURCEBUNDLEKEY_COPYRIGHTENCODING, "UTF-8"}
//About URL Page
,{ADAPTER_NAME + ADKGLOBAL.RESOURCEBUNDLEKEY_ABOUT, IS_PKG_NAME + "About.html"}
//Release Notes URL Page
,{ADAPTER_NAME + ADKGLOBAL.RESOURCEBUNDLEKEY_RELEASENOTEURL, IS_PKG_NAME + "ReleaseNotes.html"}
};

protected Object[][] getContents() {
// TODO Auto-generated method stub
return _contents;
}
}
2. You can create multiple resource bundle classes.
Use the following naming convention to create multiple resource bundle classes:
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:
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 subclass, create resource bundle lookup keys.
4. Specify the adapter’s default resource bundle in your WmAdapter implementation class. You can return the name of your default resource bundle using the getAdapterResourceBundleName method in your WmAdapter implementation class.
In the example, the MyAdapter class's getAdapterResourceBundleName method returns the constant ADAPTER_SOURCE_BUNDLE_NAME, which is initialized in interface MyAdapterConstants interface.
Example of getAdapterResourceBundleName method in MyAdapter class:

@Override
public String getAdapterResourceBundleName() {
// TODO Auto-generated method stub
return ADAPTER_SOURCE_BUNDLE_NAME;
}
Example ofADAPTER_SOURCE_BUNDLE_NAME constant in MyAdapterConstants interface:

static final String ADAPTER_SOURCE_BUNDLE_NAME =
"com.wm.MyAdapter.MyAdapterResource";
5. Create the reference pages for copyright, and index page for the adapter in adapterPackageName/pub folder.
*In the adapters administrative interface, select About, the about page appears with the display name, description and copyright.
*In the Integration Server Administrator, select Packages > MyAdapter > Home, the index page appears.
Note:
You must create your reference pages in the same adapterPackageName/pub folder in the webMethods package you created using Designer.