db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r527034 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/types/DataValueFactory.java iapi/types/DataValueFactoryImpl.java impl/db/BasicDatabase.java
Date Tue, 10 Apr 2007 05:24:35 GMT
Author: mamta
Date: Mon Apr  9 22:24:34 2007
New Revision: 527034

URL: http://svn.apache.org/viewvc?view=rev&rev=527034
Log:
Adding a new api on DVF which will make Locale object available to DVF. This new api on DVF
will get called by the boot method of 
BasicDatabase after BasicDatabase has finished booting DVF. This Locale will be either the
Locale obtained from the territory attribute 
supplied by the user on the JDBC url at database create time or if user didn't provide the
territory attribute at database create time, 
then it will be set to the default JVM locale. This Locale object will be used by DVF to construct
the Collator object if user has requested 
territory based collation. 
The new api looks as follows
        void setLocale(Locale localeOfTheDatabase); 


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java?view=diff&rev=527034&r1=527033&r2=527034
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java Mon
Apr  9 22:24:34 2007
@@ -29,6 +29,7 @@
 import java.sql.Time;
 import java.sql.Timestamp;
 
+import java.util.Locale;
 
 /**
  * This interface is how we get constant data values of different types.
@@ -671,4 +672,19 @@
          * that value.
          */
         XMLDataValue            getNullXML(XMLDataValue dataValue);
+
+        /**
+         * Set the locale on DVF. This method gets called by the boot method of
+         * BasicDatabase after BasicDatabase has finished booting DVF. This 
+         * Locale will be either the Locale obtained from the territory 
+         * attribute supplied by the user on the JDBC url at database create 
+         * time or if user didn't provide the territory attribute at database
+         * create time, then it will be set to the default JVM locale. The 
+         * Locale object will be used to construct the Collator object if user 
+         * has requested territory based collation.
+         *
+         * @param localeOfTheDatabase Use this object to construct the 
+         *   Collator object
+         */
+        void setLocale(Locale localeOfTheDatabase);
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java?view=diff&rev=527034&r1=527033&r2=527034
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
Mon Apr  9 22:24:34 2007
@@ -46,8 +46,9 @@
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.util.Properties;
 
+import java.util.Properties;
+import java.util.Locale;
 
 import org.apache.derby.iapi.db.DatabaseContext;
 import org.apache.derby.iapi.services.context.ContextService;
@@ -62,6 +63,9 @@
 abstract class DataValueFactoryImpl implements DataValueFactory, ModuleControl
 {
         LocaleFinder localeFinder;
+        //BasicDatabase first boots DVF in it's boot method and then sets 
+        //this databaseLocale in DVF.
+    	private Locale databaseLocale;
 
         DataValueFactoryImpl()
         {
@@ -1077,6 +1081,11 @@
             dataValue.setToNull();
             return dataValue;
         }
+    }
+
+    /** @see DataValueFactory#setLocale(Locale) */
+    public void setLocale(Locale localeOfTheDatabase){
+    	databaseLocale = localeOfTheDatabase;
     }
 
         // RESOLVE: This is here to find the LocaleFinder (i.e. the Database)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java?view=diff&rev=527034&r1=527033&r2=527034
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java Mon Apr  9
22:24:34 2007
@@ -172,10 +172,20 @@
 		// validation is separated from AccessFactory, therefore from store
 		bootValidation(create, startParams);
 		
-		// boot the type factpry before store to ensure any dynamically
+		// boot the type factory before store to ensure any dynamically
 		// registered types (DECIMAL) are there before logical undo recovery might need them.
 		Monitor.bootServiceModule(create, this,
-					org.apache.derby.iapi.reference.ClassName.DataValueFactory, startParams);
+				org.apache.derby.iapi.reference.ClassName.DataValueFactory, startParams);
+/*		DataValueFactory dvf = (DataValueFactory) Monitor.bootServiceModule(create, this,
+				org.apache.derby.iapi.reference.ClassName.DataValueFactory, startParams);
+		//After booting the DVF, set the Locale information into it. This 
+		//Locale will be either the Locale obtained from the territory 
+		//attribute supplied by the user on the JDBC url at database create 
+		//time or if user didn't provide the territory attribute at database
+		//create time, then it will be set to the default JVM locale. If user 
+		//has requested territory based collation then a Collator object will
+		//be constructed from this Locale object. 
+		dvf.setLocale(databaseLocale);*/
 
 		bootStore(create, startParams);
 



Mime
View raw message