Source Code Cross Referenced for DefaultDescriptor.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.DefaultDescriptor
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:        import org.apache.derby.iapi.sql.depend.Dependent;
026:
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:        import org.apache.derby.iapi.error.StandardException;
034:        import org.apache.derby.iapi.sql.depend.DependencyManager;
035:        import org.apache.derby.iapi.sql.depend.Dependent;
036:        import org.apache.derby.iapi.sql.depend.Dependency;
037:        import org.apache.derby.iapi.sql.depend.Provider;
038:        import org.apache.derby.iapi.services.i18n.MessageService;
039:        import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
040:        import org.apache.derby.catalog.UUID;
041:
042:        /**
043:         * This interface is used to get information from a DefaultDescriptor.
044:         *
045:         * @author Jerry
046:         */
047:
048:        public final class DefaultDescriptor extends TupleDescriptor implements 
049:                UniqueTupleDescriptor, Provider, Dependent {
050:            private final int columnNumber;
051:            private final UUID defaultUUID;
052:            private final UUID tableUUID;
053:
054:            /**
055:             * Constructor for a DefaultDescriptor
056:             *
057:             * @param dataDictionary    the DD
058:             * @param defaultUUID		The UUID of the default
059:             * @param tableUUID			The UUID of the table
060:             * @param columnNumber		The column number of the column that the default is for
061:             */
062:
063:            public DefaultDescriptor(DataDictionary dataDictionary,
064:                    UUID defaultUUID, UUID tableUUID, int columnNumber) {
065:                super (dataDictionary);
066:
067:                this .defaultUUID = defaultUUID;
068:                this .tableUUID = tableUUID;
069:                this .columnNumber = columnNumber;
070:            }
071:
072:            /**
073:             * Get the UUID of the default.
074:             *
075:             * @return	The UUID of the default.
076:             */
077:            public UUID getUUID() {
078:                return defaultUUID;
079:            }
080:
081:            /**
082:             * Get the UUID of the table.
083:             *
084:             * @return	The UUID of the table.
085:             */
086:            public UUID getTableUUID() {
087:                return tableUUID;
088:            }
089:
090:            /**
091:             * Get the column number of the column.
092:             *
093:             * @return	The column number of the column.
094:             */
095:            public int getColumnNumber() {
096:                return columnNumber;
097:            }
098:
099:            /**
100:             * Convert the DefaultDescriptor to a String.
101:             *
102:             * @return	A String representation of this DefaultDescriptor
103:             */
104:
105:            public String toString() {
106:                if (SanityManager.DEBUG) {
107:                    /*
108:                     ** NOTE: This does not format table, because table.toString()
109:                     ** formats columns, leading to infinite recursion.
110:                     */
111:                    return "defaultUUID: " + defaultUUID + "\n" + "tableUUID: "
112:                            + tableUUID + "\n" + "columnNumber: "
113:                            + columnNumber + "\n";
114:                } else {
115:                    return "";
116:                }
117:            }
118:
119:            ////////////////////////////////////////////////////////////////////
120:            //
121:            // PROVIDER INTERFACE
122:            //
123:            ////////////////////////////////////////////////////////////////////
124:
125:            /**		
126:            	@return the stored form of this provider
127:
128:            		@see Dependable#getDependableFinder
129:             */
130:            public DependableFinder getDependableFinder() {
131:                return getDependableFinder(StoredFormatIds.DEFAULT_DESCRIPTOR_FINDER_V01_ID);
132:            }
133:
134:            /**
135:             * Return the name of this Provider.  (Useful for errors.)
136:             *
137:             * @return String	The name of this provider.
138:             */
139:            public String getObjectName() {
140:                return "default";
141:            }
142:
143:            /**
144:             * Get the provider's UUID
145:             *
146:             * @return 	The provider's UUID
147:             */
148:            public UUID getObjectID() {
149:                return defaultUUID;
150:            }
151:
152:            /**
153:             * Get the provider's type.
154:             *
155:             * @return char		The provider's type.
156:             */
157:            public String getClassType() {
158:                return Dependable.DEFAULT;
159:            }
160:
161:            //////////////////////////////////////////////////////
162:            //
163:            // DEPENDENT INTERFACE
164:            //
165:            //////////////////////////////////////////////////////
166:            /**
167:             * Check that all of the dependent's dependencies are valid.
168:             *
169:             * @return true if the dependent is currently valid
170:             */
171:            public synchronized boolean isValid() {
172:                return true;
173:            }
174:
175:            /**
176:             * Prepare to mark the dependent as invalid (due to at least one of
177:             * its dependencies being invalid).
178:             *
179:             * @param action	The action causing the invalidation
180:             * @param p		the provider
181:             *
182:             * @exception StandardException thrown if unable to make it invalid
183:             */
184:            public void prepareToInvalidate(Provider p, int action,
185:                    LanguageConnectionContext lcc) throws StandardException {
186:                DependencyManager dm = getDataDictionary()
187:                        .getDependencyManager();
188:
189:                switch (action) {
190:                /*
191:                 ** Currently, the only thing we are depenedent
192:                 ** on is an alias.
193:                 */
194:                default:
195:                    DataDictionary dd = getDataDictionary();
196:                    ColumnDescriptor cd = dd
197:                            .getColumnDescriptorByDefaultId(defaultUUID);
198:                    TableDescriptor td = dd.getTableDescriptor(cd
199:                            .getReferencingUUID());
200:
201:                    throw StandardException
202:                            .newException(
203:                                    SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,
204:                                    dm.getActionString(action),
205:                                    p.getObjectName(),
206:                                    MessageService
207:                                            .getTextMessage(SQLState.LANG_COLUMN_DEFAULT),
208:                                    td.getQualifiedName() + "."
209:                                            + cd.getColumnName());
210:                }
211:            }
212:
213:            /**
214:             * Mark the dependent as invalid (due to at least one of
215:             * its dependencies being invalid).  Always an error
216:             * for a constraint -- should never have gotten here.
217:             *
218:             * @param	action	The action causing the invalidation
219:             *
220:             * @exception StandardException thrown if called in sanity mode
221:             */
222:            public void makeInvalid(int action, LanguageConnectionContext lcc)
223:                    throws StandardException {
224:                /* 
225:                 ** We should never get here, we should have barfed on 
226:                 ** prepareToInvalidate().
227:                 */
228:                if (SanityManager.DEBUG) {
229:                    DependencyManager dm;
230:
231:                    dm = getDataDictionary().getDependencyManager();
232:
233:                    SanityManager.THROWASSERT("makeInvalid("
234:                            + dm.getActionString(action)
235:                            + ") not expected to get called");
236:                }
237:            }
238:
239:            /**
240:             * Attempt to revalidate the dependent. Meaningless
241:             * for defaults.
242:             */
243:            public void makeValid(LanguageConnectionContext lcc) {
244:            }
245:
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.