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


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.sql.catalog.SYSDEPENDSRowFactory
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.sql.catalog;
023:
024:        import org.apache.derby.catalog.Dependable;
025:        import org.apache.derby.catalog.DependableFinder;
026:
027:        import org.apache.derby.iapi.services.uuid.UUIDFactory;
028:        import org.apache.derby.catalog.UUID;
029:
030:        import org.apache.derby.iapi.types.TypeId;
031:        import org.apache.derby.iapi.sql.dictionary.SystemColumn;
032:        import org.apache.derby.catalog.TypeDescriptor;
033:
034:        import org.apache.derby.iapi.services.sanity.SanityManager;
035:
036:        import org.apache.derby.iapi.types.DataValueDescriptor;
037:
038:        import org.apache.derby.iapi.types.DataValueFactory;
039:        import org.apache.derby.iapi.types.RowLocation;
040:
041:        import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;
042:        import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
043:        import org.apache.derby.iapi.sql.dictionary.DependencyDescriptor;
044:        import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;
045:        import org.apache.derby.iapi.sql.dictionary.DataDictionary;
046:        import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;
047:        import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
048:
049:        import org.apache.derby.iapi.sql.execute.ExecutionContext;
050:        import org.apache.derby.iapi.sql.execute.ExecutionFactory;
051:        import org.apache.derby.iapi.sql.execute.ExecIndexRow;
052:        import org.apache.derby.iapi.sql.execute.ExecRow;
053:
054:        import org.apache.derby.iapi.error.StandardException;
055:
056:        import org.apache.derby.catalog.IndexDescriptor;
057:        import org.apache.derby.iapi.reference.SQLState;
058:
059:        /**
060:         * Factory for creating a SYSDEPENDSS row.
061:         *
062:         * @author jerry
063:         */
064:
065:        public class SYSDEPENDSRowFactory extends CatalogRowFactory {
066:            private static final String TABLENAME_STRING = "SYSDEPENDS";
067:
068:            protected static final int SYSDEPENDS_COLUMN_COUNT = 4;
069:            protected static final int SYSDEPENDS_DEPENDENTID = 1;
070:            protected static final int SYSDEPENDS_DEPENDENTTYPE = 2;
071:            protected static final int SYSDEPENDS_PROVIDERID = 3;
072:            protected static final int SYSDEPENDS_PROVIDERTYPE = 4;
073:
074:            protected static final int SYSDEPENDS_INDEX1_ID = 0;
075:            protected static final int SYSDEPENDS_INDEX2_ID = 1;
076:
077:            private static final boolean[] uniqueness = { false, false };
078:
079:            private static final int[][] indexColumnPositions = {
080:                    { SYSDEPENDS_DEPENDENTID }, { SYSDEPENDS_PROVIDERID } };
081:
082:            private static final String[] uuids = {
083:                    "8000003e-00d0-fd77-3ed8-000a0a0b1900" // catalog UUID
084:                    , "80000043-00d0-fd77-3ed8-000a0a0b1900" // heap UUID
085:                    , "80000040-00d0-fd77-3ed8-000a0a0b1900" // SYSDEPENDS_INDEX1
086:                    , "80000042-00d0-fd77-3ed8-000a0a0b1900" // SYSDEPENDS_INDEX2
087:            };
088:
089:            /////////////////////////////////////////////////////////////////////////////
090:            //
091:            //	CONSTRUCTORS
092:            //
093:            /////////////////////////////////////////////////////////////////////////////
094:
095:            public SYSDEPENDSRowFactory(UUIDFactory uuidf, ExecutionFactory ef,
096:                    DataValueFactory dvf, boolean convertIdToLower) {
097:                super (uuidf, ef, dvf, convertIdToLower);
098:                initInfo(SYSDEPENDS_COLUMN_COUNT, TABLENAME_STRING,
099:                        indexColumnPositions, uniqueness, uuids);
100:            }
101:
102:            /////////////////////////////////////////////////////////////////////////////
103:            //
104:            //	METHODS
105:            //
106:            /////////////////////////////////////////////////////////////////////////////
107:
108:            /**
109:             * Make a SYSDEPENDS row
110:             *
111:             * @param td DependencyDescriptor. If its null then we want to make an empty
112:             * row. 
113:             *
114:             * @return	Row suitable for inserting into SYSDEPENDS.
115:             *
116:             * @exception   StandardException thrown on failure
117:             */
118:            public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)
119:                    throws StandardException {
120:                DataValueDescriptor col;
121:                ExecRow row;
122:                String dependentID = null;
123:                DependableFinder dependentBloodhound = null;
124:                String providerID = null;
125:                DependableFinder providerBloodhound = null;
126:
127:                if (td != null) {
128:                    DependencyDescriptor dd = (DependencyDescriptor) td;
129:                    dependentID = dd.getUUID().toString();
130:                    dependentBloodhound = dd.getDependentFinder();
131:                    if (dependentBloodhound == null) {
132:                        throw StandardException
133:                                .newException(SQLState.DEP_UNABLE_TO_STORE);
134:                    }
135:
136:                    providerID = dd.getProviderID().toString();
137:                    providerBloodhound = dd.getProviderFinder();
138:                    if (providerBloodhound == null) {
139:                        throw StandardException
140:                                .newException(SQLState.DEP_UNABLE_TO_STORE);
141:                    }
142:
143:                }
144:
145:                /* Insert info into sysdepends */
146:
147:                /* RESOLVE - It would be nice to require less knowledge about sysdepends
148:                 * and have this be more table driven.
149:                 */
150:
151:                /* Build the row to insert  */
152:                row = getExecutionFactory()
153:                        .getValueRow(SYSDEPENDS_COLUMN_COUNT);
154:
155:                /* 1st column is DEPENDENTID (UUID - char(36)) */
156:                row.setColumn(SYSDEPENDS_DEPENDENTID, dvf
157:                        .getCharDataValue(dependentID));
158:
159:                /* 2nd column is DEPENDENTFINDER */
160:                row.setColumn(SYSDEPENDS_DEPENDENTTYPE, dvf
161:                        .getDataValue(dependentBloodhound));
162:
163:                /* 3rd column is PROVIDERID (UUID - char(36)) */
164:                row.setColumn(SYSDEPENDS_PROVIDERID, dvf
165:                        .getCharDataValue(providerID));
166:
167:                /* 4th column is PROVIDERFINDER */
168:                row.setColumn(SYSDEPENDS_PROVIDERTYPE, dvf
169:                        .getDataValue(providerBloodhound));
170:
171:                return row;
172:            }
173:
174:            ///////////////////////////////////////////////////////////////////////////
175:            //
176:            //	ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
177:            //
178:            ///////////////////////////////////////////////////////////////////////////
179:
180:            /**
181:             * Make a ConstraintDescriptor out of a SYSDEPENDS row
182:             *
183:             * @param row a SYSDEPENDSS row
184:             * @param parentTupleDescriptor	Null for this kind of descriptor.
185:             * @param dd dataDictionary
186:             *
187:             * @exception   StandardException thrown on failure
188:             */
189:            public TupleDescriptor buildDescriptor(ExecRow row,
190:                    TupleDescriptor parentTupleDescriptor, DataDictionary dd)
191:                    throws StandardException {
192:                DependencyDescriptor dependencyDesc = null;
193:
194:                if (SanityManager.DEBUG) {
195:                    SanityManager.ASSERT(
196:                            row.nColumns() == SYSDEPENDS_COLUMN_COUNT,
197:                            "Wrong number of columns for a SYSDEPENDS row");
198:                }
199:
200:                DataValueDescriptor col;
201:                String dependentIDstring;
202:                UUID dependentUUID;
203:                DependableFinder dependentBloodhound;
204:                String providerIDstring;
205:                UUID providerUUID;
206:                DependableFinder providerBloodhound;
207:
208:                /* 1st column is DEPENDENTID (UUID - char(36)) */
209:                col = row.getColumn(SYSDEPENDS_DEPENDENTID);
210:                dependentIDstring = col.getString();
211:                dependentUUID = getUUIDFactory()
212:                        .recreateUUID(dependentIDstring);
213:
214:                /* 2nd column is DEPENDENTTYPE */
215:                col = row.getColumn(SYSDEPENDS_DEPENDENTTYPE);
216:                dependentBloodhound = (DependableFinder) col.getObject();
217:
218:                /* 3rd column is PROVIDERID (UUID - char(36)) */
219:                col = row.getColumn(SYSDEPENDS_PROVIDERID);
220:                providerIDstring = col.getString();
221:                providerUUID = getUUIDFactory().recreateUUID(providerIDstring);
222:
223:                /* 4th column is PROVIDERTYPE */
224:                col = row.getColumn(SYSDEPENDS_PROVIDERTYPE);
225:                providerBloodhound = (DependableFinder) col.getObject();
226:
227:                /* now build and return the descriptor */
228:                return new DependencyDescriptor(dependentUUID,
229:                        dependentBloodhound, providerUUID, providerBloodhound);
230:            }
231:
232:            /**
233:             * Builds a list of columns suitable for creating this Catalog.
234:             *
235:             *
236:             * @return array of SystemColumn suitable for making this catalog.
237:             */
238:            public SystemColumn[] buildColumnList() {
239:                int index = 0;
240:                SystemColumn[] columnList = new SystemColumn[SYSDEPENDS_COLUMN_COUNT];
241:
242:                // describe columns
243:
244:                columnList[index++] = new SystemColumnImpl(
245:                        convertIdCase("DEPENDENTID"), // column name
246:                        SYSDEPENDS_DEPENDENTID, // column number
247:                        0, // precision
248:                        0, // scale
249:                        false, // nullability
250:                        "CHAR", // dataType
251:                        true, // built-in type
252:                        36 // maxLength
253:                );
254:
255:                columnList[index++] = new SystemColumnImpl(
256:                        convertIdCase("DEPENDENTFINDER"), // column name
257:                        SYSDEPENDS_DEPENDENTTYPE, // column number
258:                        0, // precision
259:                        0, // scale
260:                        false, // nullability
261:                        "org.apache.derby.catalog.DependableFinder", // dataType
262:                        false, // built-in type
263:                        TypeDescriptor.MAXIMUM_WIDTH_UNKNOWN // maxLength
264:                );
265:
266:                columnList[index++] = new SystemColumnImpl(
267:                        convertIdCase("PROVIDERID"), // column name
268:                        SYSDEPENDS_PROVIDERID, 0, // precision
269:                        0, // scale
270:                        false, // nullability
271:                        "CHAR", // datatype
272:                        true, // built-in type
273:                        36 // maxLength
274:                );
275:
276:                columnList[index++] = new SystemColumnImpl(
277:                        convertIdCase("PROVIDERFINDER"), // column name
278:                        SYSDEPENDS_PROVIDERTYPE, // column number
279:                        0, // precision
280:                        0, // scale
281:                        false, // nullability
282:                        "org.apache.derby.catalog.DependableFinder", // dataType
283:                        false, // built-in type
284:                        TypeDescriptor.MAXIMUM_WIDTH_UNKNOWN // maxLength
285:                );
286:
287:                return columnList;
288:            }
289:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.