1 | /* |
2 | |
3 | Derby - Class org.apache.derby.iapi.sql.dictionary.TupleDescriptor |
4 | |
5 | Copyright 1997, 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.iapi.sql.dictionary; |
22 | |
23 | import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; |
24 | import org.apache.derby.iapi.error.StandardException; |
25 | |
26 | import org.apache.derby.catalog.DependableFinder; |
27 | import org.apache.derby.iapi.services.sanity.SanityManager; |
28 | |
29 | import org.apache.derby.iapi.reference.SQLState; |
30 | |
31 | // is it OK to do this? |
32 | import org.apache.derby.impl.sql.catalog.DDdependableFinder; |
33 | import org.apache.derby.impl.sql.catalog.DDColumnDependableFinder; |
34 | |
35 | /** |
36 | * This is the superclass of all Descriptors. Users of DataDictionary should use |
37 | * the specific descriptor. |
38 | * |
39 | * @author Rick |
40 | * @author Manish |
41 | */ |
42 | |
43 | public class TupleDescriptor |
44 | { |
45 | ////////////////////////////////////////////////////////////////// |
46 | // |
47 | // CONSTANTS |
48 | // |
49 | ////////////////////////////////////////////////////////////////// |
50 | |
51 | // list types |
52 | |
53 | public static final int COLUMN_LIST = 1; |
54 | public static final int CONGLOMERATE_LIST = 2; |
55 | public static final int TRIGGER_LIST = 3; |
56 | public static final int CONSTRAINT_LIST = 4; |
57 | |
58 | // generic items |
59 | /* |
60 | public static final int INDEX_PROPERTIES = 1; |
61 | public static final int TRIGGER_WHEN_TEXT = 2; |
62 | public static final int TRIGGER_ACTION_TEXT = 3; |
63 | public static final int TRIGGER_COMP_SCHEMA_ID = 4; |
64 | public static final int VIEW_DEPENDENCIES = 5; |
65 | public static final int SOURCE_COLUMN_IDS = 6; |
66 | public static final int UUID_ID = 7; |
67 | public static final int UUID_FLATNAME = 8; |
68 | public static final int UUID_TYPE = 9; |
69 | public static final int UUID_OTHER_ID = 10; |
70 | public static final int EXTERNAL_TYPE = 11; |
71 | public static final int PLUGIN_PRIMARY_KEY = 12; |
72 | public static final int SOURCE_JAR_FILE = 13; |
73 | */ |
74 | ////////////////////////////////////////////////////////////////// |
75 | // |
76 | // STATE |
77 | // |
78 | ////////////////////////////////////////////////////////////////// |
79 | |
80 | private DataDictionary dataDictionary; |
81 | |
82 | ////////////////////////////////////////////////////////////////// |
83 | // |
84 | // CONSTRUCTOR |
85 | // |
86 | ////////////////////////////////////////////////////////////////// |
87 | |
88 | public TupleDescriptor() {} |
89 | |
90 | public TupleDescriptor(DataDictionary dataDictionary) |
91 | { |
92 | this.dataDictionary = dataDictionary; |
93 | } |
94 | |
95 | protected DataDictionary getDataDictionary() throws StandardException |
96 | { |
97 | return dataDictionary; |
98 | } |
99 | |
100 | protected void setDataDictionary(DataDictionary dd) |
101 | { |
102 | dataDictionary = dd; |
103 | } |
104 | |
105 | /** |
106 | * Is this provider persistent? A stored dependency will be required |
107 | * if both the dependent and provider are persistent. |
108 | * |
109 | * @return boolean Whether or not this provider is persistent. |
110 | */ |
111 | public boolean isPersistent() |
112 | { |
113 | return true; |
114 | } |
115 | |
116 | |
117 | ////////////////////////////////////////////////////////////////// |
118 | // |
119 | // BEHAVIOR. These are only used by Replication!! |
120 | // |
121 | ////////////////////////////////////////////////////////////////// |
122 | |
123 | |
124 | public DependableFinder getDependableFinder(int formatId) |
125 | { |
126 | return new DDdependableFinder(formatId); |
127 | } |
128 | |
129 | DependableFinder getColumnDependableFinder(int formatId, byte[] |
130 | columnBitMap) |
131 | { |
132 | return new DDColumnDependableFinder(formatId, columnBitMap); |
133 | } |
134 | |
135 | /** Each descriptor must identify itself with its type; i.e index, check |
136 | * constraint whatever. |
137 | */ |
138 | public String getDescriptorType() |
139 | { |
140 | if (SanityManager.DEBUG) {SanityManager.NOTREACHED(); } |
141 | return null; |
142 | } |
143 | /* each descriptor has a name |
144 | */ |
145 | public String getDescriptorName() |
146 | { |
147 | if (SanityManager.DEBUG) {SanityManager.NOTREACHED(); } |
148 | return null; |
149 | } |
150 | } |