com.sage.orion.sdata.servlet
Class LanguageResource

java.lang.Object
  extended by com.sage.orion.sdata.servlet.LanguageResource
All Implemented Interfaces:
ILanguageResource

public final class LanguageResource
extends java.lang.Object
implements ILanguageResource

A utility class that provides the service of getting a single language resource string

First, use LanguageResource.getInstance(). initialize(SDataProvider sdataProvider) to initialize the instance of this class. (This initialization is usually done by the SDataServlet class on its initialization, so Accpac and SWT Services resource kinds don't need to do this initialization.)

Then, use LanguageResource.getInstance(). getMessage(String version, String language, String id) or LanguageResource.getInstance(). getMessage(String version, String language, String category, String id) to get the resource string in the specified language. Note that this utility class will take care of trimming the arguments and lower-casing the version and language arguments.


Method Summary
static LanguageResource getInstance()
           
 java.lang.String getMessage(java.lang.String version, java.lang.String language, java.lang.String id)
          Get the message for the given version, language and id.
 java.lang.String getMessage(java.lang.String version, java.lang.String language, java.lang.String category, java.lang.String id)
          Get the message for the given version, language, category and id.
 void initialize(SDataProvider sdataProvider)
          Handle any initialization required by this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LanguageResource getInstance()
Returns:
The unique instance of this class.

initialize

public void initialize(SDataProvider sdataProvider)
Handle any initialization required by this class.

Parameters:
sdataProvider - The SDataProvider that provides the data for the language resource string lookup. Currently this should be the SWT Services provider.

getMessage

public java.lang.String getMessage(java.lang.String version,
                                   java.lang.String language,
                                   java.lang.String id)
Get the message for the given version, language and id.

Specified by:
getMessage in interface ILanguageResource
Parameters:
version - the version of the resource, e.g. "ap60a"
language - the language code of the resource, e.g. "eng"
id - the id of the resource, e.g. "titlForm"
Returns:
The message for the given version, language and id. Or a string indicating that there was an error if any error occurred.

getMessage

public java.lang.String getMessage(java.lang.String version,
                                   java.lang.String language,
                                   java.lang.String category,
                                   java.lang.String id)
Get the message for the given version, language, category and id.

Specified by:
getMessage in interface ILanguageResource
Parameters:
version - the version of the resource, e.g. "ap60a"
language - the language code of the resource, e.g. "eng"
category - the category that the resource belongs to, e.g. "ap1200"
id - the id of the resource, e.g. "titlForm"
Returns:
The message for the given version, language, category and id. Or a string indicating that there was an error if any error occurred.


Copyright © 2011 Sage Software, Inc. All rights reserved.