KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > store > access > BackingStoreHashTableFromScan


1 /*
2
3    Derby - Class org.apache.derby.impl.store.access.BackingStoreHashTableFromScan
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.store.access;
23
24 import org.apache.derby.iapi.services.sanity.SanityManager;
25
26 import org.apache.derby.iapi.error.StandardException;
27
28 import org.apache.derby.iapi.store.access.conglomerate.ScanManager;
29
30 import org.apache.derby.iapi.store.access.Qualifier;
31 import org.apache.derby.iapi.store.access.RowSource;
32 import org.apache.derby.iapi.store.access.TransactionController;
33
34 import org.apache.derby.iapi.types.DataValueDescriptor;
35
36 import org.apache.derby.iapi.store.access.BackingStoreHashtable;
37 import org.apache.derby.iapi.services.io.FormatableBitSet;
38
39 import java.util.Properties JavaDoc;
40
41 /**
42
43 Extend BackingStoreHashtable with the ability to maintain the underlying
44 openScan() until the hashtable has been closed. This is necessary for
45 long row access. Access to long row delays actual objectification until
46 the columns are accessed, but depends on the underlying table to be still
47 open when the column is accessed.
48
49 <P>
50 Transactions are obtained from an AccessFactory.
51 @see BackingStoreHashtable
52
53 **/

54
55 class BackingStoreHashTableFromScan extends BackingStoreHashtable
56 {
57
58     /**************************************************************************
59      * Fields of the class
60      **************************************************************************
61      */

62     private ScanManager open_scan;
63
64     /**************************************************************************
65      * Constructors for This class:
66      **************************************************************************
67      */

68     public BackingStoreHashTableFromScan(
69         TransactionController tc,
70         long conglomId,
71         int open_mode,
72         int lock_level,
73         int isolation_level,
74         FormatableBitSet scanColumnList,
75         DataValueDescriptor[] startKeyValue,
76         int startSearchOperator,
77         Qualifier qualifier[][],
78         DataValueDescriptor[] stopKeyValue,
79         int stopSearchOperator,
80         long max_rowcnt,
81         int[] key_column_numbers,
82         boolean remove_duplicates,
83         long estimated_rowcnt,
84         long max_inmemory_rowcnt,
85         int initialCapacity,
86         float loadFactor,
87         boolean collect_runtimestats,
88         boolean skipNullKeyColumns)
89             throws StandardException
90     {
91
92         super(
93             tc,
94             (RowSource) null,
95             key_column_numbers,
96             remove_duplicates,
97             estimated_rowcnt,
98             max_inmemory_rowcnt,
99             initialCapacity,
100             loadFactor,
101             skipNullKeyColumns,
102             false /* Do not keep the hash table after a commit. */);
103
104         open_scan = (ScanManager)
105             tc.openScan(
106                 conglomId,
107                 false,
108                 open_mode,
109                 lock_level,
110                 isolation_level,
111                 scanColumnList,
112                 startKeyValue,
113                 startSearchOperator,
114                 qualifier,
115                 stopKeyValue,
116                 stopSearchOperator);
117
118         open_scan.fetchSet(
119             max_rowcnt, key_column_numbers, this);
120
121         if (collect_runtimestats)
122         {
123             Properties JavaDoc prop = new Properties JavaDoc();
124             open_scan.getScanInfo().getAllScanInfo(prop);
125             this.setAuxillaryRuntimeStats(prop);
126             prop = null;
127         }
128     }
129
130
131     /**************************************************************************
132      * Private/Protected methods of This class:
133      **************************************************************************
134      */

135
136     /**************************************************************************
137      * Public Methods of This class:
138      **************************************************************************
139      */

140
141     /**
142      * Close the BackingStoreHashtable.
143      * <p>
144      * Perform any necessary cleanup after finishing with the hashtable. Will
145      * deallocate/dereference objects as necessary. If the table has gone
146      * to disk this will drop any on disk files used to support the hash table.
147      * <p>
148      *
149      * @exception StandardException Standard exception policy.
150      **/

151     public void close()
152         throws StandardException
153     {
154         open_scan.close();
155
156         super.close();
157
158         return;
159     }
160
161     /**************************************************************************
162      * Public Methods of XXXX class:
163      **************************************************************************
164      */

165 }
166
Popular Tags