KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > dictionary > SubConstraintDescriptor


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.dictionary.SubConstraintDescriptor
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.sql.dictionary;
23
24
25 import org.apache.derby.catalog.UUID;
26 import org.apache.derby.iapi.services.sanity.SanityManager;
27
28 /**
29  * This interface is used to get information from a SubConstraintDescriptor.
30  * A SubKeyConstraintDescriptor is used within the DataDictionary to
31  * get auxiliary constraint information from the system table
32  * that is auxiliary to sysconstraints.
33  *
34  * @version 0.1
35  * @author Jerry Brenner
36  */

37
38 public abstract class SubConstraintDescriptor extends TupleDescriptor
39     implements UniqueTupleDescriptor
40 {
41
42     /**
43        public interface for this class:
44        <ol>
45        <li> public void setConstraintId(UUID constraintId);</li>
46        <li>public boolean hasBackingIndex();</li>
47        <li>public void setTableDescriptor(TableDescriptor td);</li>
48        <li>public TableDescriptor getTableDescriptor();</li>
49        </ol>
50     */

51
52     // Implementation
53
TableDescriptor td;
54     UUID constraintId;
55
56     /**
57      * Constructor for a SubConstraintDescriptorImpl
58      *
59      * @param constraintId The UUID of the constraint.
60      */

61
62     SubConstraintDescriptor(UUID constraintId)
63     {
64         this.constraintId = constraintId;
65     }
66
67     /**
68      * Sets the UUID of the constraint.
69      *
70      * @param constraintId The constraint Id.
71      */

72     public void setConstraintId(UUID constraintId)
73     {
74         this.constraintId = constraintId;
75     }
76
77     /**
78      * Gets the UUID of the constraint.
79      *
80      * @return The UUID of the constraint.
81      */

82     public UUID getUUID()
83     {
84         return constraintId;
85     }
86
87     /**
88      * Does this constraint have a backing index?
89      *
90      * @return boolean Whether or not there is a backing index for this constraint.
91      */

92     public abstract boolean hasBackingIndex();
93
94     /**
95      * Caches the TableDescriptor of the
96      * table that the constraint is on.
97      *
98      * @param td The TableDescriptor.
99      */

100     public void setTableDescriptor(TableDescriptor td)
101     {
102         this.td = td;
103     }
104
105     /**
106      * Returns the cached TableDescriptor, if
107      * supplied, that the constraint is on.
108      *
109      * @return The cached TableDescriptor,
110      * if supplied.
111      */

112     public TableDescriptor getTableDescriptor()
113     {
114         return td;
115     }
116
117     /**
118      * Convert the SubConstraintDescriptor to a String.
119      *
120      * @return A String representation of this SubConstraintDescriptor
121      */

122
123     public String JavaDoc toString()
124     {
125         if (SanityManager.DEBUG)
126         {
127             return "constraintId: " + constraintId + "\n";
128         }
129         else
130         {
131             return "";
132         }
133     }
134
135 }
136
Popular Tags