Source Code Cross Referenced for T_SecondaryIndexRow.java in  » Database-DBMS » db-derby-10.2 » org » apache » derbyTesting » unitTests » store » 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.derbyTesting.unitTests.store 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derbyTesting.unitTests.store.T_SecondaryIndexRow
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.derbyTesting.unitTests.store;
023:
024:        import org.apache.derby.impl.store.access.conglomerate.*;
025:
026:        import org.apache.derby.iapi.services.sanity.SanityManager;
027:
028:        import org.apache.derby.iapi.services.io.Storable;
029:
030:        import org.apache.derby.iapi.error.StandardException;
031:
032:        import org.apache.derby.iapi.types.DataValueDescriptor;
033:
034:        import org.apache.derby.iapi.types.RowLocation;
035:
036:        /**
037:         This class implements a row which will be stored in a secondary index on 
038:         a heap table.  
039:         <p>
040:         This class creates a new DataValueDescriptor array which will be the row used 
041:         to insert into the secondary index.  The fields of this object array are made 
042:         up of references to DataValueDescriptors provided by the caller: the 
043:         DataValueDescriptors in the template and a RowLocation.
044:         The interface is designed to support the standard access method interface
045:         where callers provide a single template and then read rows into that template
046:         over and over.  This class keeps a reference to the objects in the template
047:         and the rowlocation, 
048:         so the state of this object changes whenever the caller changes the template.
049:         The caller provides a template which will contain a heap row,
050:         and a RowLocation which provides the location of the row within the heap table.
051:         <p>
052:         So for example to create an index from a base table by reading the base table
053:         and inserting each row one at a time into the secondary index you would 
054:         do something like:
055:
056:         DataValueDescriptors[] template = get_template_for_base_table();
057:         RowLocation            rowloc   = ScanController_var.newRowLocationTemplate();
058:         T_SecondaryIndexRow    indrow   = new T_SecondaryIndexRow();
059:
060:         indrow.init(template, rowloc, numcols_in_index);
061:
062:         while (ScanController_variable.next())
063:         { 
064:         fetch(template)
065:         fetchLocation(rowloc)
066:
067:         ConglomerateController_on_btree.insert(indrow.getRow());
068:         }
069:
070:         **/
071:
072:        public class T_SecondaryIndexRow {
073:
074:            DataValueDescriptor[] row;
075:            RowLocation init_rowlocation = null;
076:
077:            /* Constructors for This class: */
078:            public T_SecondaryIndexRow() {
079:            }
080:
081:            /* Private/Protected methods of This class: */
082:            /* Public Methods of T_SecondaryIndexRow class: */
083:
084:            /**
085:             * get the rows location field.
086:             *
087:             * @return The base table row location field from the secondary index.
088:             *
089:             * @exception  StandardException  Standard exception policy.
090:             **/
091:            /*
092:            private RowLocation getRowLocationField()
093:            	throws StandardException
094:            {
095:                return(init_rowlocation);
096:            }
097:             */
098:
099:            /**
100:             * Initialize the class.
101:             * <p>
102:             * Save away pointers to the base table template row, and the rowlocation
103:             * class.  Build default map of base columns to key columns, this map
104:             * can be changed with setMap().
105:             * <p>
106:             *
107:             * @param template    The template for the base table row.
108:             * @param rowlocation The template for the row location.
109:             * @param numkeys     The total number of columns in the secondary index
110:             *                    including the rowlocation column.
111:             *
112:             * @exception  StandardException  Standard exception policy.
113:             **/
114:            public void init(DataValueDescriptor[] template,
115:                    RowLocation rowlocation, int numkeys)
116:                    throws StandardException {
117:                if (SanityManager.DEBUG) {
118:                    if (numkeys != (template.length + 1))
119:                        SanityManager.THROWASSERT("numkeys = " + numkeys
120:                                + " template.length = " + template.length);
121:                }
122:
123:                init_rowlocation = rowlocation;
124:
125:                /* create new object array for the row, and copy all object references 
126:                 * from template row to new secondary index row.
127:                 */
128:                row = new DataValueDescriptor[numkeys];
129:
130:                System.arraycopy(template, 0, row, 0, template.length);
131:
132:                /* add the reference to the row location column as the last column */
133:                row[row.length - 1] = rowlocation;
134:            }
135:
136:            /**
137:             * Return the secondary index row.
138:             * <p>
139:             * Return the DataValueDescriptor array that represents the branch row, 
140:             * for use in raw store calls to fetch, insert, and update.
141:             * <p>
142:             *
143:             * @return The branch row object array.
144:             **/
145:            public DataValueDescriptor[] getRow() {
146:                return (this .row);
147:            }
148:
149:            public String toString() {
150:                String s = "{ ";
151:                for (int colid = 0; colid < row.length; colid++) {
152:                    s += row[colid];
153:                    if (colid < (row.length - 1))
154:                        s += ", ";
155:                }
156:                s += " }";
157:                return s;
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.