Source Code Cross Referenced for ConglomerateDescriptor.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » sql » dictionary » 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.iapi.sql.dictionary 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor
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.iapi.sql.dictionary;
023:
024:        import org.apache.derby.iapi.sql.depend.Provider;
025:
026:        import org.apache.derby.catalog.UUID;
027:        import org.apache.derby.iapi.reference.SQLState;
028:        import org.apache.derby.iapi.services.sanity.SanityManager;
029:        import org.apache.derby.iapi.sql.StatementType;
030:        import org.apache.derby.catalog.DependableFinder;
031:        import org.apache.derby.catalog.Dependable;
032:        import org.apache.derby.iapi.services.io.StoredFormatIds;
033:
034:        import org.apache.derby.iapi.services.uuid.UUIDFactory;
035:        import org.apache.derby.iapi.services.monitor.Monitor;
036:
037:        /**
038:         * The ConglomerateDescriptor class is used to get information about
039:         * conglomerates for the purpose of optimization.
040:         *
041:         * NOTE: The language module does not have to know much about conglomerates
042:         * with this architecture. To get the cost of using a conglomerate, all it
043:         * has to do is pass the ConglomerateDescriptor to the access methods, along
044:         * with the predicate. What the access methods need from a
045:         * ConglomerateDescriptor remains to be seen.
046:         *
047:         * @version 0.1
048:         * @author Jeff Lichtman
049:         */
050:
051:        public final class ConglomerateDescriptor extends TupleDescriptor
052:                implements  UniqueTupleDescriptor, Provider {
053:            // Implementation
054:            private long conglomerateNumber;
055:            private String name;
056:            private String[] columnNames;
057:            private final boolean indexable;
058:            private final boolean forConstraint;
059:            private final IndexRowGenerator indexRowGenerator;
060:            private final UUID uuid;
061:            private final UUID tableID;
062:            private final UUID schemaID;
063:
064:            /**
065:             * Constructor for a conglomerate descriptor.
066:             *
067:             * @param dataDictionary		The data dictionary that this descriptor lives in
068:             * @param conglomerateNumber	The number for the conglomerate
069:             *				we're interested in
070:             * @param name			The name of the conglomerate, if any
071:             * @param indexable		TRUE means the conglomerate is indexable,
072:             *				FALSE means it isn't
073:             * @param indexRowGenerator	The descriptor of the index if it's not a
074:             *							heap
075:             * @param forConstraint		TRUE means the conglomerate is an index backing up
076:             *							a constraint, FALSE means it isn't
077:             * @param uuid		UUID  for this conglomerate
078:             * @param tableID	UUID for the table that this conglomerate belongs to
079:             * @param schemaID	UUID for the schema that this conglomerate belongs to
080:             */
081:            ConglomerateDescriptor(DataDictionary dataDictionary,
082:                    long conglomerateNumber, String name, boolean indexable,
083:                    IndexRowGenerator indexRowGenerator, boolean forConstraint,
084:                    UUID uuid, UUID tableID, UUID schemaID) {
085:                super (dataDictionary);
086:
087:                this .conglomerateNumber = conglomerateNumber;
088:                this .name = name;
089:                this .indexable = indexable;
090:                this .indexRowGenerator = indexRowGenerator;
091:                this .forConstraint = forConstraint;
092:                if (uuid == null) {
093:                    UUIDFactory uuidFactory = Monitor.getMonitor()
094:                            .getUUIDFactory();
095:                    uuid = uuidFactory.createUUID();
096:                }
097:                this .uuid = uuid;
098:                this .tableID = tableID;
099:                this .schemaID = schemaID;
100:            }
101:
102:            /**
103:             * Gets the number for the conglomerate.
104:             *
105:             * @return	A long identifier for the conglomerate
106:             */
107:            public long getConglomerateNumber() {
108:                return conglomerateNumber;
109:            }
110:
111:            /**
112:             * Set the conglomerate number.
113:             * This is useful when swapping conglomerates, like for bulkInsert.
114:             *
115:             * @param conglomerateNumber	The new conglomerate number.
116:             */
117:            public void setConglomerateNumber(long conglomerateNumber) {
118:                this .conglomerateNumber = conglomerateNumber;
119:            }
120:
121:            /**
122:             * Gets the UUID String for the conglomerate.
123:             *
124:             * @return	The UUID String for the conglomerate
125:             */
126:            public UUID getUUID() {
127:                return uuid;
128:            }
129:
130:            /**
131:             * Gets the UUID for the table that the conglomerate belongs to.
132:             *
133:             * @return	The UUID String for the conglomerate
134:             */
135:            public UUID getTableID() {
136:                return tableID;
137:            }
138:
139:            /**
140:             * Gets the UUID for the schema that the conglomerate belongs to.
141:             *
142:             * @return	The UUID String for the schema that the conglomerate belongs to
143:             */
144:            public UUID getSchemaID() {
145:                return schemaID;
146:            }
147:
148:            /**
149:             * Tells whether the conglomerate can be used as an index.
150:             *
151:             * @return	TRUE if the conglomerate can be used as an index, FALSE if not
152:             */
153:            public boolean isIndex() {
154:                return indexable;
155:            }
156:
157:            /**
158:             * Tells whether the conglomerate is an index backing up a constraint.
159:             *
160:             * @return	TRUE if the conglomerate is an index backing up a constraint, FALSE if not
161:             */
162:            public boolean isConstraint() {
163:                return forConstraint;
164:            }
165:
166:            /**
167:             * Gets the name of the conglomerate.  For heaps, this is null.  For
168:             * indexes, it is the index name.
169:             *
170:             * @return	The name of the conglomerate, null if it's the heap for a table.
171:             */
172:            public String getConglomerateName() {
173:                return name;
174:            }
175:
176:            /**
177:             * Set the name of the conglomerate.  Used only by rename index.
178:             *
179:             * @param	newName The new name of the conglomerate.
180:             */
181:            public void setConglomerateName(String newName) {
182:                name = newName;
183:            }
184:
185:            /**
186:             * Gets the index row generator for this conglomerate, null if the
187:             * conglomerate is not an index.
188:             *
189:             * @return	The index descriptor for this conglomerate, if any.
190:             */
191:            public IndexRowGenerator getIndexDescriptor() {
192:                return indexRowGenerator;
193:            }
194:
195:            /**
196:             * Set the column names for this conglomerate descriptor.
197:             * This is useful for tracing the optimizer.
198:             *
199:             * @param columnNames	0-based array of column names.
200:             */
201:            public void setColumnNames(String[] columnNames) {
202:                this .columnNames = columnNames;
203:            }
204:
205:            /**
206:             * Get the column names for this conglomerate descriptor.
207:             * This is useful for tracing the optimizer.
208:             *
209:             * @return the column names for the conglomerate descriptor.
210:             */
211:            public String[] getColumnNames() {
212:                return columnNames;
213:            }
214:
215:            //
216:            // Provider interface
217:            //
218:
219:            /**		
220:            	@return the stored form of this provider
221:             */
222:            public DependableFinder getDependableFinder() {
223:                return getDependableFinder(StoredFormatIds.CONGLOMERATE_DESCRIPTOR_FINDER_V01_ID);
224:            }
225:
226:            /**
227:             * Return the name of this Provider.  (Useful for errors.)
228:             *
229:             * @return String	The name of this provider.
230:             */
231:            public String getObjectName() {
232:                if (SanityManager.DEBUG) {
233:                    SanityManager
234:                            .ASSERT(name != null,
235:                                    "ConglomerateDescriptor only expected to be provider for indexes");
236:                }
237:                return name;
238:            }
239:
240:            /**
241:             * Get the provider's UUID
242:             *
243:             * @return 	The provider's UUID
244:             */
245:            public UUID getObjectID() {
246:                return uuid;
247:            }
248:
249:            /**
250:             * Get the provider's type.
251:             *
252:             * @return char		The provider's type.
253:             */
254:            public String getClassType() {
255:                if (indexable) {
256:                    return Dependable.INDEX;
257:                } else {
258:                    return Dependable.HEAP;
259:                }
260:            }
261:
262:            /**
263:             * Convert the conglomerate descriptor to a String
264:             *
265:             * @return	The conglomerate descriptor as a String
266:             */
267:
268:            public String toString() {
269:                if (SanityManager.DEBUG) {
270:                    String keyString = "";
271:
272:                    if (indexable && columnNames != null) {
273:                        int[] keyColumns = indexRowGenerator
274:                                .baseColumnPositions();
275:
276:                        keyString = ", key columns = {"
277:                                + columnNames[keyColumns[0] - 1];
278:                        for (int index = 1; index < keyColumns.length; index++) {
279:                            keyString = keyString + ", "
280:                                    + columnNames[keyColumns[index] - 1];
281:                        }
282:                        keyString = keyString + "}";
283:                    }
284:
285:                    return "ConglomerateDescriptor: conglomerateNumber = "
286:                            + conglomerateNumber + " name = " + name
287:                            + " uuid = " + uuid + " indexable = " + indexable
288:                            + keyString;
289:                } else {
290:                    return "";
291:                }
292:            }
293:
294:            /** @see TupleDescriptor#getDescriptorType */
295:            public String getDescriptorType() {
296:                if (indexable)
297:                    return "Index";
298:                else
299:                    return "Table";
300:            }
301:
302:            /** @see TupleDescriptor#getDescriptorName */
303:            public String getDescriptorName() {
304:                return name;
305:            }
306:
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.