|
Oracle® Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-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
The DBLocaleSource
class is the predefined database locale source that accesses a user profile table including user locale preferences. All user profile information can be specified in the GDK application configuration file. Default caching : This locale source is cached in the session by default
The database locale source should use the special tag <db-locale-source>
to include the user profile information in the list of the locale determination rule. The following attributes are required:
data-source-name
: the data source name that must be included 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 preference.user-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 the key used in the session object in the JSP/Java Servlet application. The GDK references 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 the locale must be specified in one of the following parameters depending on the scenario:
Scenario 1: If the user locale preference is stored in the form of ISO locale, use:
locale-column
: the column that includes the ISO localeScenario 2: If the user locale preference is stored in the form of Oracle language and Oracle territory names, use:
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: If the user locale preference is stored in the form of Oracle abbreviation language and territory names, use:
short-language-name
: the column that includes the abbreviation of the Oracle language name. If both language-column
and short-language-name
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 to 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 ID.linguistic-sort-column
: the column that includes the Oracle linguistic sorting name.date-format-column
: the column that includes the short date format mask.long-date-format-column
: the column that includes the long date format mask.time-format-column
: the column that includes the time format mask.date-time-format-column
: the column that includes the short date and time format mask.long-date-time-format-column
: the column that includes the long date and time format mask.number-format-column
: the column that includes the number format mask.currency-format-column
: the column that includes the currency format mask.writing-direction-column
: the column that includes the writing direction, either LTR
or RTL
.iso-currency-column
: the column that includes the ISO 4217 currency ID.For example, assuming the user locale and time zone preferences are used for globalized operations, the user schema table is 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 )
The data source file has the following 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 the following:
<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 provides 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 2 (10.2) Part No. B14224-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |