db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r470362 - in /db/derby/code/trunk/java/engine/org/apache/derby: impl/store/build.xml impl/store/raw/data/BaseDataFileFactory.java impl/store/raw/data/BaseDataFileFactoryJ4.java impl/store/raw/data/RAFContainerFactory.java modules.properties
Date Thu, 02 Nov 2006 13:47:30 GMT
Author: kahatlen
Date: Thu Nov  2 05:47:30 2006
New Revision: 470362

URL: http://svn.apache.org/viewvc?view=rev&rev=470362
Log:
DERBY-801 (partial) Allow parallel access to data files

Use Derby's own module loading mechanism to load RAFContainer4.
Patch contributed by Anders Morken.

Added:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactoryJ4.java
  (with props)
Removed:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainerFactory.java
Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/modules.properties

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/build.xml?view=diff&rev=470362&r1=470361&r2=470362
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/build.xml Thu Nov  2 05:47:30
2006
@@ -54,6 +54,7 @@
       </classpath>
       <include name="${derby.dir}/impl/store/**"/>
       <exclude name="${derby.dir}/impl/store/raw/data/RAFContainer4.java"/>
+      <exclude name="${derby.dir}/impl/store/raw/data/BaseDataFileFactoryJ4.java"/>
     </javac>
   </target>
   <target name="compile_impl_store_14" depends="compile_impl_store">
@@ -74,6 +75,7 @@
         <pathelement path="${java14compile.classpath}"/>
       </classpath>
       <include name="${derby.dir}/impl/store/raw/data/RAFContainer4.java"/>
+      <include name="${derby.dir}/impl/store/raw/data/BaseDataFileFactoryJ4.java"/>
     </javac>
   </target>
 </project>

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java?view=diff&rev=470362&r1=470361&r2=470362
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Thu Nov  2 05:47:30 2006
@@ -122,7 +122,7 @@
 
 **/
 
-public final class BaseDataFileFactory
+public class BaseDataFileFactory
     implements DataFactory, CacheableFactory, ModuleControl, ModuleSupportable, PrivilegedExceptionAction
 {
 
@@ -235,9 +235,6 @@
     private File            backupRoot;
     private String[]        bfilelist;
 
-	// Creates RAFContainer instances tailored to the running VM
-	private RAFContainerFactory rafContainerFactory = new RAFContainerFactory();
-
 	/*
 	** Constructor
 	*/
@@ -1443,25 +1440,33 @@
 	}
 
     /**
-     * Return the Class of the Containers to be produced by this factory.
+     * Produces new container objects.
      * <p>
      * Concrete implementations of a DataFactory must implement this routine
-     * to indicate what kind of containers are produced.  For instance
-     * the DataFileFactory produce RAFContainer's.
+     * to indicate what kind of containers are produced. This class produces
+     * file-based containers - RAFContainer objects for files that support
+     * random access and InputStreamContainer object for others, such as data
+     * files in JARs.
      * <p>
-     * It is expected that this class is called only once, and thus does
-     * not worry about the overhead of repeated Class.forName() lookups.
-     *
-	 * @return The Class object for the Container class.
+     * @return A new file container object.
      *
      **/
     Cacheable newContainerObject()
     {
         if( supportsRandomAccess)
-            return rafContainerFactory.newRAFContainer(this);
+            return newRAFContainer(this);
         else
             return new InputStreamContainer( this);
     } 
+
+    /**
+     * Creates a RAFContainer object.
+     * This method is overridden in BaseDataFileFactoryJ4 to produce
+     * RAFContainer4 objects instead of RAFContainer objects.
+     */
+    protected Cacheable newRAFContainer(BaseDataFileFactory factory) {
+        return new RAFContainer(factory);
+    }
 
 	/**
 	 *	This page is going from clean to dirty, this is a chance for the

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactoryJ4.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactoryJ4.java?view=auto&rev=470362
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactoryJ4.java
(added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactoryJ4.java
Thu Nov  2 05:47:30 2006
@@ -0,0 +1,47 @@
+/*
+
+   Derby - Class org.apache.derby.impl.store.raw.data.BaseDataFileFactoryJ4
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.impl.store.raw.data;
+
+import org.apache.derby.iapi.services.cache.Cacheable;
+
+/**
+ * This class overloads BaseDataFileFactory to produce RAFContainer4 objects
+ * instead of RAFContainer objects. It makes no other change to its superclass'
+ * behavior.
+ */
+public class BaseDataFileFactoryJ4 extends BaseDataFileFactory {
+
+    /**
+     * Do-nothing constructor (as in the superclass) - real initialization
+     * is done by super's boot().
+     */
+    public BaseDataFileFactoryJ4() {
+    }
+
+    /**
+     * Overrides newRAFContainer in BaseDataFileFactory to produce RAFContainer4
+     * objects capable of exploiting the NIO API available in Java 1.4+
+     */
+    protected Cacheable newRAFContainer(BaseDataFileFactory factory) {
+        return new RAFContainer4(factory);
+    }
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactoryJ4.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/engine/org/apache/derby/modules.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/modules.properties?view=diff&rev=470362&r1=470361&r2=470362
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/modules.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/modules.properties Thu Nov  2 05:47:30
2006
@@ -287,8 +287,15 @@
 cloudscape.config.access=all
 
 # store data using a StorageFactory
-derby.module.rawStore.data.generic=org.apache.derby.impl.store.raw.data.BaseDataFileFactory
-cloudscape.config.rawStore.data.generic=derby
+# Enhanced version using NIO API; requires Java 1.4
+derby.module.rawStore.data.genericJ4=org.apache.derby.impl.store.raw.data.BaseDataFileFactoryJ4
+derby.env.jdk.rawStore.data.genericJ4=4
+cloudscape.config.rawStore.data.genericJ4=derby
+
+# Generic version using older IO interfaces
+derby.module.rawStore.data.genericJ1=org.apache.derby.impl.store.raw.data.BaseDataFileFactory
+derby.env.jdk.rawStore.data.genericJ1=1
+cloudscape.config.rawStore.data.genericJ1=derby
 
 # Log to a file
 derby.module.rawStore.log=org.apache.derby.impl.store.raw.log.LogToFile



Mime
View raw message