Oracle® Globalization Development Kit Java API Reference
10g Release 1(10.1)

B10971-01

oracle.i18n.servlet.localesource
Class DBLocaleSource

java.lang.Object
  |
  +--oracle.i18n.servlet.localesource.LocaleSource
        |
        +--oracle.i18n.servlet.localesource.DBLocaleSource
All Implemented Interfaces:
Serializable

public class DBLocaleSource
extends LocaleSource

DBLocaleSource is the pre-defined database locale source that accesses a user profile table including user locale preferences. All user profile information can be specified the GDK application configuration file.

The database locale source should use the special tag <db-locale-source> to include the user profile information in the list of locale determination rule. The following attributes require to be specified:

The attributes for locale also requires to be specified in either the following parameters:

Scenario 1: the user locale preference is stored in the form of ISO locale:



Scenario 2: the user locale preference is stored in the form of Oracle language and Oracle territory names:



Scenario 3: The user locale preference is stored in the form of Oracle abbreviation language and territory names:



Additionally, the following attributes may need be specified:



For example, assuming the user locale and time zone preferences are used for globalized operations, the user schema table would be specified as follows:

 create table user_profile
 (
   userid varchar2(100) primary key, -- user id
   ... (various user information)
   locale  varchar2(10), -- user locale preference, e.g., ja-JP
   timezone varchar2(50) -- user time zone preference, e.g., America/Los_Angeles
 )

and the data source file has the connection information:

 <data-source class="com.evermind.sql.DriverManagerDataSource" 
   name="OracleDS"
   location="jdbc/OracleCoreDS" 
   xa-location="jdbc/xa/OracleXADS"
   ejb-location="jdbc/OracleDS"
   connection-driver="oracle.jdbc.driver.OracleDriver"
   username="yourapp"
   password="<db password>"
   url="jdbc:oracle:thin:@localhost:1521:orcl" 
   inactivity-timeout="30"
   />

The locale determination rule would become as follows:

 <locale-determine-rule>
   <locale-source 
    data-source-name="jdbc/OracleCoreDS" 
    locale-source-table="user_profiles"
    user-key="userinfo" 
    user-column="userid"
    locale-column="locale" 
    timezone-column="timezone" 
  >oracle.i18n.servlet.localesource.DBLocaleSource<locale-source>
  <locale-source>oracle.i18n.servlet.localesource.HttpAcceptLanguage<locale-source>
 <locale-determine-rule>

Also the application should provide the authentication filter that specifies "userinfo" to either the user id or null in the session object so that the database locale source object can determine if the user is authenticated or not.

Since:
10.1.0.2
See Also:
Serialized Form

Nested Class Summary

 

Nested classes inherited from class oracle.i18n.servlet.localesource.LocaleSource
LocaleSource.Alignment, LocaleSource.Parameter, LocaleSource.WritingDirection

 

Methods inherited from class oracle.i18n.servlet.localesource.LocaleSource
equals, getAttribute, getCharacterSet, getCollator, getCurrencyFormat, getDateFormat, getDateTimeFormat, getISOCurrency, getLocale, getLocaleSourceClass, getNumberFormat, getTimeFormat, getTimeZone, getWritingDirection, hashCode, isCached, isReadOnly, load, setAttribute, setCharacterSet, setCollator, setCurrencyFormat, setDateFormat, setDateTimeFormat, setISOCurrency, setLocale, setLocale, setLocaleSourceClass, setNumberFormat, setTimeFormat, setTimeZone, setWritingDirection, store

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

 


Oracle® Globalization Development Kit Java API Reference
10g Release 1(10.1)

B10971-01

Copyright © 2003 Oracle Corporation. All Rights Reserved.