Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / impl / store / access / BackingStoreHashTableFromScan.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/store/access/BackingStoreHashTableFromScan.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/store/access/BackingStoreHashTableFromScan.java
new file mode 100644 (file)
index 0000000..c71155e
--- /dev/null
@@ -0,0 +1,164 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.store.access.BackingStoreHashTableFromScan\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.store.access;\r
+\r
+import org.apache.derby.iapi.error.StandardException; \r
+\r
+import org.apache.derby.iapi.store.access.conglomerate.ScanManager;\r
+\r
+import org.apache.derby.iapi.store.access.Qualifier;\r
+import org.apache.derby.iapi.store.access.RowSource;\r
+import org.apache.derby.iapi.store.access.TransactionController;\r
+\r
+import org.apache.derby.iapi.types.DataValueDescriptor;\r
+\r
+import org.apache.derby.iapi.store.access.BackingStoreHashtable;\r
+import org.apache.derby.iapi.services.io.FormatableBitSet;\r
+\r
+import java.util.Properties;\r
+\r
+/**\r
+\r
+Extend BackingStoreHashtable with the ability to maintain the underlying \r
+openScan() until the hashtable has been closed.  This is necessary for \r
+long row access.  Access to long row delays actual objectification until\r
+the columns are accessed, but depends on the underlying table to be still\r
+open when the column is accessed.  \r
+\r
+<P>\r
+Transactions are obtained from an AccessFactory.\r
+@see BackingStoreHashtable\r
+\r
+**/\r
+\r
+class BackingStoreHashTableFromScan extends BackingStoreHashtable\r
+{\r
+\r
+    /**************************************************************************\r
+     * Fields of the class\r
+     **************************************************************************\r
+     */\r
+    private ScanManager             open_scan;\r
+\r
+    /**************************************************************************\r
+     * Constructors for This class:\r
+     **************************************************************************\r
+     */\r
+    public BackingStoreHashTableFromScan(\r
+        TransactionController   tc,\r
+               long                    conglomId,\r
+               int                     open_mode,\r
+        int                     lock_level,\r
+        int                     isolation_level,\r
+               FormatableBitSet                 scanColumnList,\r
+               DataValueDescriptor[]   startKeyValue,\r
+               int                     startSearchOperator,\r
+               Qualifier               qualifier[][],\r
+               DataValueDescriptor[]   stopKeyValue,\r
+               int                     stopSearchOperator,\r
+        long                    max_rowcnt,\r
+        int[]                   key_column_numbers,\r
+        boolean                 remove_duplicates,\r
+        long                    estimated_rowcnt,\r
+        long                    max_inmemory_rowcnt,\r
+        int                     initialCapacity,\r
+        float                   loadFactor,\r
+        boolean                 collect_runtimestats,\r
+               boolean                                 skipNullKeyColumns,\r
+        boolean                 keepAfterCommit)\r
+            throws StandardException\r
+    {\r
+\r
+        super(\r
+            tc, \r
+            (RowSource) null,\r
+            key_column_numbers,\r
+            remove_duplicates,\r
+            estimated_rowcnt,\r
+            max_inmemory_rowcnt,\r
+            initialCapacity,\r
+            loadFactor,\r
+                       skipNullKeyColumns,\r
+            keepAfterCommit);\r
+\r
+        open_scan =  (ScanManager)\r
+            tc.openScan(\r
+                conglomId,\r
+                false,\r
+                open_mode,\r
+                lock_level,\r
+                isolation_level,\r
+                scanColumnList,\r
+                startKeyValue,\r
+                startSearchOperator,\r
+                qualifier,\r
+                stopKeyValue,\r
+                stopSearchOperator);\r
+\r
+        open_scan.fetchSet(\r
+            max_rowcnt, key_column_numbers, this);\r
+\r
+        if (collect_runtimestats)\r
+        {\r
+            Properties prop = new Properties();\r
+            open_scan.getScanInfo().getAllScanInfo(prop);\r
+            this.setAuxillaryRuntimeStats(prop);\r
+            prop = null;\r
+        }\r
+    }\r
+\r
+\r
+    /**************************************************************************\r
+     * Private/Protected methods of This class:\r
+     **************************************************************************\r
+     */\r
+\r
+    /**************************************************************************\r
+     * Public Methods of This class:\r
+     **************************************************************************\r
+     */\r
+\r
+    /**\r
+     * Close the BackingStoreHashtable.\r
+     * <p>\r
+     * Perform any necessary cleanup after finishing with the hashtable.  Will\r
+     * deallocate/dereference objects as necessary.  If the table has gone\r
+     * to disk this will drop any on disk files used to support the hash table.\r
+     * <p>\r
+     *\r
+        * @exception  StandardException  Standard exception policy.\r
+     **/\r
+    public void close() \r
+               throws StandardException\r
+    {\r
+        open_scan.close();\r
+\r
+        super.close();\r
+\r
+        return;\r
+    }\r
+\r
+    /**************************************************************************\r
+     * Public Methods of XXXX class:\r
+     **************************************************************************\r
+     */\r
+}\r