Source Code Cross Referenced for B2IController.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » access » btree » index » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.access.btree.index 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.store.access.btree.index.B2IController
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.store.access.btree.index;
023:
024:        import java.io.IOException;
025:        import java.util.Properties;
026:        import org.apache.derby.iapi.services.sanity.SanityManager;
027:        import org.apache.derby.iapi.error.StandardException;
028:        import org.apache.derby.iapi.store.access.conglomerate.Conglomerate;
029:        import org.apache.derby.iapi.store.access.conglomerate.TransactionManager;
030:        import org.apache.derby.iapi.store.access.ConglomerateController;
031:        import org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo;
032:        import org.apache.derby.iapi.store.access.Qualifier;
033:        import org.apache.derby.iapi.types.RowLocation;
034:        import org.apache.derby.iapi.store.access.ScanController;
035:        import org.apache.derby.iapi.store.access.TransactionController;
036:        import org.apache.derby.iapi.store.access.ConglomerateController;
037:        import org.apache.derby.iapi.store.raw.ContainerHandle;
038:        import org.apache.derby.iapi.store.raw.LockingPolicy;
039:        import org.apache.derby.iapi.store.raw.Transaction;
040:
041:        import org.apache.derby.iapi.types.DataValueDescriptor;
042:
043:        import org.apache.derby.impl.store.access.btree.BTreeController;
044:        import org.apache.derby.impl.store.access.btree.BTreeLockingPolicy;
045:
046:        import org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil;
047:
048:        import org.apache.derby.iapi.services.io.FormatableBitSet;
049:
050:        /**
051:         * Controller used to insert rows into a secondary index.
052:         *
053:         * Implements the ConglomerateController interface for the B-Tree index
054:         * access method.  
055:         *
056:         * Note most work of this class is inherited from the generic btree 
057:         * implementation.  This class initializes the top level object and deals with
058:         * locking information specific to a secondary index implementation of a btree.
059:         */
060:        public class B2IController extends BTreeController {
061:
062:            /*
063:             ** Fields of B2IController.
064:             */
065:            private ConglomerateController base_cc_for_locking;
066:
067:            /*
068:             ** Methods of B2IController.
069:             */
070:
071:            B2IController() {
072:                // Perform the generic b-tree construction.
073:                super ();
074:            }
075:
076:            void init(TransactionManager xact_manager, Transaction rawtran,
077:                    boolean hold, int open_mode, int lock_level,
078:                    LockingPolicy locking_policy, boolean get_locks,
079:                    B2I conglomerate, B2IUndo undo,
080:                    B2IStaticCompiledInfo static_info,
081:                    DynamicCompiledOpenConglomInfo dynamic_info)
082:                    throws StandardException {
083:                // open and lock the base table.
084:
085:                int base_open_mode = open_mode
086:                        | TransactionController.OPENMODE_FOR_LOCK_ONLY;
087:
088:                // open the base conglomerate - just to get the lock.  Since btree
089:                // controllers only support update operations we just hard code 
090:                // the TransactionController.ISOLATION_REPEATABLE_READ, which is only
091:                // used for geting the IX intent lock on the table.
092:                if (static_info != null) {
093:                    base_cc_for_locking = xact_manager
094:                            .openCompiledConglomerate(
095:                                    false,
096:                                    base_open_mode,
097:                                    lock_level,
098:                                    TransactionController.ISOLATION_REPEATABLE_READ,
099:                                    static_info.base_table_static_info,
100:                                    /* TODO - maintain a dynamic info for this */
101:                                    ((Conglomerate) static_info.getConglom())
102:                                            .getDynamicCompiledConglomInfo(conglomerate.baseConglomerateId));
103:                } else {
104:                    base_cc_for_locking = xact_manager.openConglomerate(
105:                            conglomerate.baseConglomerateId, false,
106:                            base_open_mode, lock_level,
107:                            TransactionController.ISOLATION_REPEATABLE_READ);
108:                }
109:
110:                BTreeLockingPolicy b2i_locking_policy;
111:                if (lock_level == TransactionController.MODE_TABLE) {
112:                    b2i_locking_policy = new B2ITableLocking3(rawtran,
113:                            lock_level, locking_policy, base_cc_for_locking,
114:                            this );
115:                } else if (lock_level == TransactionController.MODE_RECORD) {
116:                    b2i_locking_policy = new B2IRowLocking3(rawtran,
117:                            lock_level, locking_policy, base_cc_for_locking,
118:                            this );
119:                } else {
120:                    if (SanityManager.DEBUG) {
121:                        SanityManager.THROWASSERT("Bad lock level: "
122:                                + lock_level);
123:                    }
124:                    b2i_locking_policy = null;
125:                }
126:
127:                // Do generic b-tree initialization.
128:                super .init(xact_manager, hold, (ContainerHandle) null, rawtran,
129:                        open_mode, lock_level, b2i_locking_policy,
130:                        conglomerate, undo, static_info, dynamic_info);
131:
132:                if (SanityManager.DEBUG)
133:                    SanityManager.ASSERT(conglomerate != null);
134:            }
135:
136:            /*
137:             ** Methods of ConglomerateController.
138:             */
139:
140:            /**
141:            Close the conglomerate controller.
142:            <p>
143:            Any changes to this method will probably have to be reflected in close as 
144:            well.
145:            <p>
146:            Currently delegates to OpenBTree.  If the btree controller ends up not 
147:            having any state of its own, we can remove this method (the VM will 
148:            dispatch to OpenBTree), gaining some small efficiency.  For now, this 
149:            method remains for clarity.  
150:
151:            @see ConglomerateController#close
152:             **/
153:            public void close() throws StandardException {
154:                super .close();
155:
156:                if (base_cc_for_locking != null) {
157:                    base_cc_for_locking.close();
158:                    base_cc_for_locking = null;
159:                }
160:            }
161:
162:            /**
163:            Insert a row into the conglomerate.
164:            @see ConglomerateController#insert
165:
166:            @exception StandardException Standard exception policy.
167:             **/
168:            public int insert(DataValueDescriptor[] row)
169:                    throws StandardException {
170:                if (SanityManager.DEBUG) {
171:                    if (this .container != null) {
172:                        SanityManager
173:                                .ASSERT(this .getConglomerate() instanceof  B2I);
174:
175:                        RowLocation rowloc = (RowLocation) row[((B2I) (this 
176:                                .getConglomerate())).rowLocationColumn];
177:
178:                        SanityManager.ASSERT(!rowloc.isNull(),
179:                                "RowLocation value is null");
180:                    }
181:                }
182:
183:                return (super.insert(row));
184:            }
185:        }
w___w___w.__j___a__v_a___2___s.c_o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.