Source Code Cross Referenced for DbObjectBase.java in  » Database-DBMS » h2database » org » h2 » engine » 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 » h2database » org.h2.engine 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
003:         * (http://h2database.com/html/license.html).
004:         * Initial Developer: H2 Group
005:         */
006:        package org.h2.engine;
007:
008:        import java.sql.SQLException;
009:
010:        import org.h2.command.Parser;
011:        import org.h2.message.Message;
012:        import org.h2.message.Trace;
013:        import org.h2.table.Table;
014:        import org.h2.util.ObjectArray;
015:
016:        /**
017:         * The base class for all database objects.
018:         */
019:        public abstract class DbObjectBase implements  DbObject {
020:
021:            /**
022:             * The database.
023:             */
024:            protected Database database;
025:
026:            /**
027:             * The trace module.
028:             */
029:            protected Trace trace;
030:
031:            /**
032:             * The comment (if set).
033:             */
034:            protected String comment;
035:
036:            private int id;
037:            private String objectName;
038:            private long modificationId;
039:            private boolean temporary;
040:
041:            /**
042:             * Build a SQL statement to re-create the object, or to create a copy of the
043:             * object with a different name or referencing a different table
044:             * 
045:             * @param table
046:             *            the new table name
047:             * @param quotedName
048:             *            the new quoted name
049:             * @return the SQL statement
050:             */
051:            public abstract String getCreateSQLForCopy(Table table,
052:                    String quotedName);
053:
054:            /**
055:             * Build a SQL statement to re-create this object.
056:             *
057:             * @return the SQL statement
058:             */
059:            public abstract String getCreateSQL();
060:
061:            /**
062:             * Build a SQL statement to drop this object.
063:             *
064:             * @return the SQL statement
065:             */
066:            public abstract String getDropSQL();
067:
068:            /**
069:             * Get the object type.
070:             *
071:             * @return the object type
072:             */
073:            public abstract int getType();
074:
075:            /**
076:             * Remove all dependent objects and free all resources (files, blocks in
077:             * files) of this object.
078:             * 
079:             * @param session the session
080:             */
081:            public abstract void removeChildrenAndResources(Session session)
082:                    throws SQLException;
083:
084:            /**
085:             * Check if this object can be renamed. System objects may not be renamed.
086:             */
087:            public abstract void checkRename() throws SQLException;
088:
089:            protected DbObjectBase(Database database, int id, String name,
090:                    String traceModule) {
091:                this .database = database;
092:                this .trace = database.getTrace(traceModule);
093:                this .id = id;
094:                this .objectName = name;
095:                this .modificationId = database.getModificationMetaId();
096:            }
097:
098:            public void setModified() {
099:                this .modificationId = database == null ? -1 : database
100:                        .getNextModificationMetaId();
101:            }
102:
103:            public long getModificationId() {
104:                return modificationId;
105:            }
106:
107:            protected void setObjectName(String name) {
108:                objectName = name;
109:            }
110:
111:            public String getSQL() {
112:                return Parser.quoteIdentifier(objectName);
113:            }
114:
115:            public ObjectArray getChildren() {
116:                return null;
117:            }
118:
119:            public Database getDatabase() {
120:                return database;
121:            }
122:
123:            public int getId() {
124:                return id;
125:            }
126:
127:            public String getName() {
128:                return objectName;
129:            }
130:
131:            protected void invalidate() {
132:                setModified();
133:                id = -1;
134:                database = null;
135:                trace = null;
136:                objectName = null;
137:            }
138:
139:            public int getHeadPos() {
140:                return 0;
141:            }
142:
143:            public void rename(String newName) throws SQLException {
144:                checkRename();
145:                objectName = newName;
146:                setModified();
147:            }
148:
149:            public boolean getTemporary() {
150:                return temporary;
151:            }
152:
153:            public void setTemporary(boolean temporary) {
154:                this .temporary = temporary;
155:            }
156:
157:            public void setComment(String comment) {
158:                this .comment = comment;
159:            }
160:
161:            public String getComment() {
162:                return comment;
163:            }
164:
165:            static int getCreateOrder(int type) {
166:                switch (type) {
167:                case SETTING:
168:                    return 0;
169:                case USER:
170:                    return 1;
171:                case SCHEMA:
172:                    return 2;
173:                case USER_DATATYPE:
174:                    return 3;
175:                case SEQUENCE:
176:                    return 4;
177:                case CONSTANT:
178:                    return 5;
179:                case FUNCTION_ALIAS:
180:                    return 6;
181:                case TABLE_OR_VIEW:
182:                    return 7;
183:                case INDEX:
184:                    return 8;
185:                case CONSTRAINT:
186:                    return 9;
187:                case TRIGGER:
188:                    return 10;
189:                case ROLE:
190:                    return 11;
191:                case RIGHT:
192:                    return 12;
193:                case AGGREGATE:
194:                    return 13;
195:                case COMMENT:
196:                    return 14;
197:                default:
198:                    throw Message.getInternalError("type=" + type);
199:                }
200:            }
201:
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.