com.ibm.websphere.i18n.context
Interface InvocationInternationalization

All Superinterfaces:
Internationalization

public interface InvocationInternationalization
extends Internationalization

The InvocationInternationalization interface provides methods to get and set Internationalization context elements within Enterprise JavaBean applications; it is one of three interfaces comprising the Internationalization context application programming interface (API).

For more information about the Internationalization context API, see interfaces:

To get invocation context elements, only, an application component first resolves a reference to the UserInternationalization interface, then uses it to get a reference to the InvocationInternationalization interface for reading invocation context.

 UserInternationalization userI18n = null;
 try {
   userI18n = initCtx.lookup("java:comp/websphere/UserInternationalization");
 } catch (javax.naming.NamingException e) {
   // Cannot resolve UserInternationalization interface.
 }
 InvocationInternationalization invocationI18n = null;
 try {
   invocationI18n = userI18n.getInvocationInternationalization();
 } catch (java.lang.IllegalStateException) {
 ...

Use InvocationInternationalization interface throughout component to get and set the invocation locale and time zone elements associated with the current thread.

 java.util.Locale[] invocationLocales = invocationI18n.getLocales();
 java.util.Locale invocationLocale = invocationI18n.getLocale();
 java.util.SimpleTimeZone invocationTimeZone = 
     (java.util.SimpleTimeZone)invocationI18n.getTimeZone();
 ...

The InvocationInternationalization interface behaves slightly differently across various application component types, depending on the applicable context management policy. All application components can get invocation context elements using the InvocationInternationalization interface; but client applications, only, may set invocation context elements.

See interface UserInternationalization for a brief description of the CSI and SSI context management policies.

Under CSI, client applications use InvocationInternationalization methods to get and set invocation context elements. When obtaining an invocation context element, these methods return the element most recently associated with the current thread using the InvocationInternationalization interface, or the default element whenever one is not yet associated.

Under SSI, servlets and Enterprise JavaBeans (EJBs) run under the caller's Internationalization context, only. These components cannot set invocation context elements, and attempts to do so result in a java.lang.IllegalStateException. Servlets and EJBs should use the Internationalization interface for reading context elements.

For complete details regarding the Internationalization Service, including context management policies, visit the IBM WebSphere Application Server InfoCenter and view the information that discusses the Internationalization Service topic within the Enterprise Services 4.0 documentation set.

Note: Although the InvocationInternationalization interface can currently be used within all application component methods, future context management policies may further restrict usage of the interface within EJB callback and servlet lifecycle methods.


Method Summary
 void setLocale(java.util.Locale locale)
          Set the array of locales associated with the current thread to an array of length(1) containing the supplied locale, locale.
 void setLocales(java.util.Locale[] locales)
          Set the array of locales associated with the current thread to the supplied locale array, locales.
 void setTimeZone(java.lang.String timeZoneId)
          Set the time zone associated with the current thread to the java.util.SimpleTimeZone having the supplied ID, timeZoneId.
 void setTimeZone(java.util.TimeZone timeZone)
          Set the time zone associated with the current thread to the supplied simple time zone, timeZone.
 
Methods inherited from interface com.ibm.websphere.i18n.context.Internationalization
getLocale, getLocales, getTimeZone
 

Method Detail

setLocales

public void setLocales(java.util.Locale[] locales)
Set the array of locales associated with the current thread to the supplied locale array, locales.

The supplied locale array may be null or have length(>= 0). When the supplied locale array is null or has length(0), the locale array associated with the current thread is set to an array of length(1) containing the default locale of the process. Null entries may exist within the supplied locale array; however, the service substitutes the default locale of the process for null on remote method invocations.

Parameters:
locales - The supplied array of locales.

setLocale

public void setLocale(java.util.Locale locale)
Set the array of locales associated with the current thread to an array of length(1) containing the supplied locale, locale.

When the supplied locale is null, the array of locales is set to an array of length(1) containing the default locale of the process.

Parameters:
locale - The supplied locale.

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)
Set the time zone associated with the current thread to the supplied simple time zone, timeZone.

If the supplied time zone is not an exact instance of java.util.SimpleTimeZone or is null, time zone is set to the default simple time zone of the process.

Parameters:
timeZone - The supplied time zone, which must be an exact instance of java.util.SimpleTimeZone.

setTimeZone

public void setTimeZone(java.lang.String timeZoneId)
Set the time zone associated with the current thread to the java.util.SimpleTimeZone having the supplied ID, timeZoneId.

If the supplied ID is null or unsupported, that is, does not appear in the list of IDs returned by method java.util.TimeZone.getAvailableIds(), time zone is set to the simple time zone having ID GMT.

Parameters:
timeZoneId - The supplied time zone ID.