|
Oracle® Globalization Development Kit Java API Reference 10g Release 1(10.1) B10971-01 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.i18n.servlet.localesource.LocaleSource | +--oracle.i18n.servlet.localesource.DBLocaleSource
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:
data-source-name
: the data source name, which information must be in the data source definition file. For example, data-sources.xml
is used for the data source in OC4J. All authentication information should be included in the data sources.locale-source-table
: the user schema table that includes the user locale preferenceuser-column
: the user name column in the user schema table. Usually it is the column for user ID, such as e-mail address, login name, etc.user-key
- the name of key used in the session object in JSP/Java Servlet application. The GDK references to the value associated with this key in the session object to check if the user is authenticated or not. If the value is not null
, it is used to match the value in the user-column
to find the user's locale preference, otherwise the GDK assumes no user is authenticated.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:
locale-column
: the column that includes the ISO localeScenario 2: the user locale preference is stored in the form of Oracle language and Oracle territory names:
language-column
: the column that includes the Oracle language name. This takes precedence over the value in locale-column
.territory-column
: the column that includes the Oracle territory name. This takes precedence over the value in locale-column
.Scenario 3: The user locale preference is stored in the form of Oracle abbreviation language and territory names:
short-language-name
: the column that includes the abbreviation of the Oracle language name. If both language-column
and this are specified, language-column
takes precedence.territory-column
: the column that includes the Oracle territory name. This takes precedence over the value in locale-column
.Additionally, the following attributes may need be specified:
charset-column
: the column that includes the Oracle character set for the client. Note this is not the page character set information.timezone-column
: the column that includes the time zone IDlinguistic-sort-column
: the column that includes the Oracle linguistic sorting namedate-format-column
: the column that includes the short date format masklong-date-format-column
: the column that includes the long date format masktime-format-column
: the column that includes the time format maskdate-time-format-column
: the column that includes the short date and time format masklong-date-time-format-column
: the column that includes the long date and time format masknumber-format-column
: the column that includes the number format maskcurrency-format-column
: the column that includes the currency format maskwriting-direction-column
: the column that includes the writing direction, either LTR
or RTL
iso-currency-column
: the column that includes the ISO 4217 currency IDFor 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.
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 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |