Source Code Cross Referenced for SchemaDescriptor.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.SchemaDescriptor
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.catalog.DependableFinder;
026:        import org.apache.derby.iapi.services.io.StoredFormatIds;
027:        import org.apache.derby.iapi.reference.Property;
028:        import org.apache.derby.catalog.UUID;
029:        import org.apache.derby.catalog.Dependable;
030:
031:        /**
032:         * This class represents a schema descriptor
033:         *
034:         * @version 0.1
035:         * @author Jeff Lichtman
036:         */
037:
038:        public final class SchemaDescriptor extends TupleDescriptor implements 
039:                UniqueTupleDescriptor, Provider {
040:
041:            /*
042:             ** When we boot, we put the system tables in
043:             ** in 'SYS', owned by user DBA.
044:             ** '92 talks about two system schemas:
045:             **
046:             **		Information Schema: literal name is 
047:             **		SYS.  This schema contains
048:             **		a series of well defined views that reference
049:             **		actual base tables from the Definition Schema.
050:             **
051:             **		Definition Schema:  literal name is
052:             **		DEFINITION_SCHEMA.  This schema contains 
053:             ** 		system tables that can be in any shape or
054:             **		form.
055:             **	
056:             ** SYS is owned by SA_USER_NAME (or DBA).
057:             */
058:            /**
059:             * STD_SYSTEM_SCHEMA_NAME is the name of the system schema in databases that
060:             * use ANSI standard identifier casing. In LSA and in Cloudscape target 
061:             * databases the name will use the same case as the source database 
062:             * identifiers.
063:             *
064:             * See org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext#getSystemSchemaName
065:             */
066:            public static final String STD_SYSTEM_SCHEMA_NAME = "SYS";
067:
068:            public static final String IBM_SYSTEM_SCHEMA_NAME = "SYSIBM";
069:
070:            /*
071:             * Names of system schemas.
072:             * The following schemas exist in a standard empty DB2 database.  For
073:             * now creating them in the cloudscape database but not actually putting
074:             * any objects in them.  Users should not be able to create any objects
075:             * in these schemas.
076:             **/
077:            public static final String IBM_SYSTEM_CAT_SCHEMA_NAME = "SYSCAT";
078:            public static final String IBM_SYSTEM_FUN_SCHEMA_NAME = "SYSFUN";
079:            public static final String IBM_SYSTEM_PROC_SCHEMA_NAME = "SYSPROC";
080:            public static final String IBM_SYSTEM_STAT_SCHEMA_NAME = "SYSSTAT";
081:            public static final String IBM_SYSTEM_NULLID_SCHEMA_NAME = "NULLID";
082:
083:            /**
084:             * This schema is used for jar handling procedures.
085:             **/
086:            public static final String STD_SQLJ_SCHEMA_NAME = "SQLJ";
087:
088:            /**
089:             * This schema is for cloudscape specific system diagnostic procedures and 
090:             * functions which are not available in DB2.  
091:             **/
092:            public static final String STD_SYSTEM_DIAG_SCHEMA_NAME = "SYSCS_DIAG";
093:
094:            /**
095:             * This schema is for cloudscape specific system diagnostic procedures and 
096:             * functions which are not available in DB2.  
097:             **/
098:            public static final String STD_SYSTEM_UTIL_SCHEMA_NAME = "SYSCS_UTIL";
099:
100:            /**
101:             * STD_DEFAULT_SCHEMA_NAME is the name of the default schema in databases 
102:             * that use ANSI standard identifier casing. In LSA and in Cloudscape 
103:             * target databases the name will use the same case as the source database 
104:             * identifiers.
105:             *
106:             * See org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext#getDefaultSchemaName
107:             */
108:            public static final String STD_DEFAULT_SCHEMA_NAME = Property.DEFAULT_USER_NAME;
109:
110:            /**
111:             * UUID's used as key's in the SYSSCHEMA catalog for the system schema's
112:             **/
113:            public static final String SYSCAT_SCHEMA_UUID = "c013800d-00fb-2641-07ec-000000134f30";
114:            public static final String SYSFUN_SCHEMA_UUID = "c013800d-00fb-2642-07ec-000000134f30";
115:            public static final String SYSPROC_SCHEMA_UUID = "c013800d-00fb-2643-07ec-000000134f30";
116:            public static final String SYSSTAT_SCHEMA_UUID = "c013800d-00fb-2644-07ec-000000134f30";
117:            public static final String SYSCS_DIAG_SCHEMA_UUID = "c013800d-00fb-2646-07ec-000000134f30";
118:            public static final String SYSCS_UTIL_SCHEMA_UUID = "c013800d-00fb-2649-07ec-000000134f30";
119:            public static final String NULLID_SCHEMA_UUID = "c013800d-00fb-2647-07ec-000000134f30";
120:            public static final String SQLJ_SCHEMA_UUID = "c013800d-00fb-2648-07ec-000000134f30";
121:            public static final String SYSTEM_SCHEMA_UUID = "8000000d-00d0-fd77-3ed8-000a0a0b1900";
122:            public static final String SYSIBM_SCHEMA_UUID = "c013800d-00f8-5b53-28a9-00000019ed88";
123:            public static final String DEFAULT_SCHEMA_UUID = "80000000-00d2-b38f-4cda-000a0a412c00";
124:
125:            public static final String STD_DECLARED_GLOBAL_TEMPORARY_TABLES_SCHEMA_NAME = "SESSION";
126:            public static final String DEFAULT_USER_NAME = Property.DEFAULT_USER_NAME;
127:            public static final String SA_USER_NAME = "DBA";
128:
129:            /** the public interface for this system:
130:            	<ol>
131:            	<li>public String getSchemaName();
132:            	<li>public String getAuthorizationId();
133:            	<li>public void	setUUID(UUID uuid);
134:            	<li>public boolean isSystemSchema();
135:            	</ol>
136:             */
137:
138:            //// Implementation
139:            private final String name;
140:            private UUID oid;
141:            private final String aid;
142:
143:            private final boolean isSystem;
144:            private final boolean isSYSIBM;
145:
146:            /**
147:             * Constructor for a SchemaDescriptor.
148:             *
149:             * @param dataDictionary
150:             * @param name	        The schema descriptor for this table.
151:             * @param oid	        The object id
152:             * @param aid	        The authorizatin id
153:             * @param isSystem	    boolean, true iff this is a system schema, like SYS,
154:             *                      SYSIBM, SYSCAT, SYSFUN, ....
155:             */
156:            public SchemaDescriptor(DataDictionary dataDictionary, String name,
157:                    String aid, UUID oid, boolean isSystem) {
158:                super (dataDictionary);
159:
160:                this .name = name;
161:                this .aid = aid;
162:                this .oid = oid;
163:                this .isSystem = isSystem;
164:                isSYSIBM = isSystem && IBM_SYSTEM_SCHEMA_NAME.equals(name);
165:            }
166:
167:            /**
168:             * Gets the name of the schema 
169:             *
170:             * @return	The schema name
171:             */
172:            public String getSchemaName() {
173:                return name;
174:            }
175:
176:            /**
177:             * Gets the authorization id of the schema 
178:             *
179:             * @return	Authorization id
180:             *		lives in.
181:             */
182:            public String getAuthorizationId() {
183:                return aid;
184:            }
185:
186:            /**
187:             * Gets the oid of the schema 
188:             *
189:             * @return	An oid
190:             */
191:            public UUID getUUID() {
192:                return oid;
193:            }
194:
195:            /**
196:             * Sets the oid of the schema 
197:             *
198:             * @param oid	The object id
199:             *
200:             */
201:            public void setUUID(UUID oid) {
202:                this .oid = oid;
203:            }
204:
205:            //
206:            // Provider interface
207:            //
208:
209:            /**		
210:            	@return the stored form of this provider
211:
212:            		@see Dependable#getDependableFinder
213:             */
214:            public DependableFinder getDependableFinder() {
215:                // Is this OK?
216:                return getDependableFinder(StoredFormatIds.SCHEMA_DESCRIPTOR_FINDER_V01_ID);
217:            }
218:
219:            /**
220:             * Return the name of this Provider.  (Useful for errors.)
221:             *
222:             * @return String	The name of this provider.
223:             */
224:            public String getObjectName() {
225:                return name;
226:            }
227:
228:            /**
229:             * Get the provider's UUID 
230:             *
231:             * @return String	The provider's UUID
232:             */
233:            public UUID getObjectID() {
234:                return oid;
235:            }
236:
237:            /**
238:             * Get the provider's type.
239:             *
240:             * @return String		The provider's type.
241:             */
242:            public String getClassType() {
243:                return Dependable.SCHEMA;
244:            }
245:
246:            //
247:            // class interface
248:            //
249:
250:            /**
251:             * Prints the contents of the SchemaDescriptor
252:             *
253:             * @return The contents as a String
254:             */
255:            public String toString() {
256:                return name;
257:            }
258:
259:            //	Methods so that we can put SchemaDescriptors on hashed lists
260:
261:            /**
262:             *	Determine if two SchemaDescriptors are the same.
263:             *
264:             *	@param	otherObject	other schemadescriptor
265:             *
266:             *	@return	true if they are the same, false otherwise
267:             */
268:
269:            public boolean equals(Object otherObject) {
270:                if (!(otherObject instanceof  SchemaDescriptor))
271:                    return false;
272:
273:                SchemaDescriptor other = (SchemaDescriptor) otherObject;
274:
275:                if ((oid != null) && (other.oid != null))
276:                    return oid.equals(other.oid);
277:
278:                return name.equals(other.name);
279:            }
280:
281:            /**
282:             * Indicate whether this is a system schema or not
283:             *
284:             * Examples of system schema's include: 
285:             *      SYS, SYSIBM, SYSCAT, SYSFUN, SYSPROC, SYSSTAT, and SYSCS_DIAG 
286:             *
287:             * @return true/false
288:             */
289:            public boolean isSystemSchema() {
290:                return (isSystem);
291:            }
292:
293:            /**
294:             * Indicate whether this is a system schema with grantable routines
295:             *
296:             * @return true/false
297:             */
298:            public boolean isSchemaWithGrantableRoutines() {
299:                if (!isSystem)
300:                    return true;
301:
302:                if (name.equals(STD_SQLJ_SCHEMA_NAME)
303:                        || name.equals(STD_SYSTEM_UTIL_SCHEMA_NAME))
304:                    return true;
305:
306:                return false;
307:            }
308:
309:            public boolean isSYSIBM() {
310:                return isSYSIBM;
311:            }
312:
313:            /**
314:             *	Get a hashcode for this SchemaDescriptor
315:             *
316:             *	@return	hashcode
317:             */
318:            public int hashCode() {
319:                return oid.hashCode();
320:            }
321:
322:            /** @see TupleDescriptor#getDescriptorName */
323:            public String getDescriptorName() {
324:                return name;
325:            }
326:
327:            /** @see TupleDescriptor#getDescriptorType */
328:            public String getDescriptorType() {
329:                return "Schema";
330:            }
331:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.