com.sap.aii.af.service.administration.api.i18n

Class ResourceBundleLocalizationCallback

java.lang.Object
  extended by com.sap.aii.af.service.administration.api.i18n.ResourceBundleLocalizationCallback
All Implemented Interfaces:
AdapterCallback, LocalizationCallback

public class ResourceBundleLocalizationCallback
extends Object
implements LocalizationCallback

Provides a resource-bundle-based localization callback (i.e. an implementation of LocalizationCallback) for registration with the Adapter Framework.

This implementation will look up any string it receives for localization through localizeString in a given resource bundle and return the lookup result (or the original string if the lookup failed) as localized string.

See Also:
LocalizationCallback, ResourceBundle

Constructor Summary
ResourceBundleLocalizationCallback(String rbName, ClassLoader classLoader)
          Constructs a ResourceBundleLocalizationCallback instance with a class loader used to load the resource bundle.
 
Method Summary
 String localizeString(String source, Locale targetLocale)
          Requests an adapter to localize a given string into a target locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundleLocalizationCallback

public ResourceBundleLocalizationCallback(String rbName,
                                          ClassLoader classLoader)
Constructs a ResourceBundleLocalizationCallback instance with a class loader used to load the resource bundle. Make sure to specify a class loader (typically the adapter's class loader that can be obtained by calling getClass().getClassLoader() on any of the classes that make up the adapter) that the resource bundle is actually visible in.

Parameters:
rbName - the base name of the resource bundle to use
classLoader - the class loader to use when loading the resource bundle
See Also:
ResourceBundle
Method Detail

localizeString

public String localizeString(String source,
                             Locale targetLocale)
                      throws LocalizationNotPossibleException
Description copied from interface: LocalizationCallback
Requests an adapter to localize a given string into a target locale.

If the adapter is unable to support the requested target locale, the source string should be localized into English. If English is not available as a target locale either, the adapter needs to throw a LocalizationNotPossibleException.

Specified by:
localizeString in interface LocalizationCallback
Parameters:
source - the string to be localized
targetLocale - the target locale to localize the string to
Returns:
the localized string
Throws:
LocalizationNotPossibleException - if the string could not be localized
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] SAP_XIAF [sap.com] com.sap.aii.af.svc.facade api BC-XI


Copyright 2011 SAP AG Complete Copyright Notice