KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > store > access > conglomerate > GenericConglomerate


1 /*
2
3    Derby - Class org.apache.derby.impl.store.access.conglomerate.GenericConglomerate
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.impl.store.access.conglomerate;
23
24 import org.apache.derby.iapi.reference.SQLState;
25
26 import org.apache.derby.iapi.services.sanity.SanityManager;
27
28 import org.apache.derby.iapi.error.StandardException;
29
30 import org.apache.derby.iapi.store.access.conglomerate.Conglomerate;
31
32 import org.apache.derby.iapi.types.DataValueDescriptor;
33 import org.apache.derby.iapi.types.Orderable;
34
35 import org.apache.derby.iapi.types.DataType;
36
37 import java.sql.ResultSet JavaDoc;
38 import java.sql.SQLException JavaDoc;
39
40 /**
41
42 A class that implements the methods shared across all implementations of
43 the Conglomerate interface.
44
45 **/

46
47 public abstract class GenericConglomerate
48     extends DataType implements Conglomerate
49 {
50
51     /**************************************************************************
52      * Public Methods implementing DataValueDescriptor interface.
53      **************************************************************************
54      */

55
56     /**
57      * Gets the length of the data value. The meaning of this is
58      * implementation-dependent. For string types, it is the number of
59      * characters in the string. For numeric types, it is the number of
60      * bytes used to store the number. This is the actual length
61      * of this value, not the length of the type it was defined as.
62      * For example, a VARCHAR value may be shorter than the declared
63      * VARCHAR (maximum) length.
64      *
65      * @return The length of the data value
66      *
67      * @exception StandardException On error
68      *
69      * @see org.apache.derby.iapi.types.DataValueDescriptor#getLength
70      */

71     public int getLength()
72         throws StandardException
73     {
74         throw(StandardException.newException(
75                 SQLState.HEAP_UNIMPLEMENTED_FEATURE));
76     }
77     /**
78      * Gets the value in the data value descriptor as a String.
79      * Throws an exception if the data value is not a string.
80      *
81      * @return The data value as a String.
82      *
83      * @exception StandardException Thrown on error
84      *
85      * @see org.apache.derby.iapi.types.DataValueDescriptor#getString
86      */

87     public String JavaDoc getString() throws StandardException
88     {
89         throw(StandardException.newException(
90                 SQLState.HEAP_UNIMPLEMENTED_FEATURE));
91     }
92
93     /**
94      * Gets the value in the data value descriptor as a Java Object.
95      * The type of the Object will be the Java object type corresponding
96      * to the data value's SQL type. JDBC defines a mapping between Java
97      * object types and SQL types - we will allow that to be extended
98      * through user type definitions. Throws an exception if the data
99      * value is not an object (yeah, right).
100      *
101      * @return The data value as an Object.
102      *
103      * @exception StandardException Thrown on error
104      *
105      * @see org.apache.derby.iapi.types.DataValueDescriptor#getObject
106      */

107     public Object JavaDoc getObject() throws StandardException
108     {
109         return(this);
110     }
111
112     /**
113      * <U>Shallow copy</U>.
114      * <p>
115      * Clone the DataValueDescriptor and copy its contents.
116      * We clone the data value wrapper (e.g. SQLDecimal)
117      * and reuse its contents (the underlying BigDecimal).
118      * The resultant DataValueDescriptor will point to the same
119      * value as the original DataValueDescriptor (unless the value
120      * is a primitive type, e.g. SQLInteger/integer).
121      *
122      * @return A clone of the DataValueDescriptor reusing its contents.
123      *
124      * @see org.apache.derby.iapi.types.DataValueDescriptor#getClone
125      */

126     public DataValueDescriptor getClone()
127     {
128         if (SanityManager.DEBUG)
129             SanityManager.THROWASSERT("Not implemented!.");
130
131         return(null);
132     }
133
134     /**
135      * Get a new null value of the same type as this data value.
136      *
137      * @see org.apache.derby.iapi.types.DataValueDescriptor#getNewNull
138      */

139     public DataValueDescriptor getNewNull()
140     {
141         if (SanityManager.DEBUG)
142             SanityManager.THROWASSERT("Not implemented!.");
143
144         return(null);
145     }
146
147     /**
148      * Set the value based on the value for the specified DataValueDescriptor
149      * from the specified ResultSet.
150      *
151      * @param resultSet The specified ResultSet.
152      * @param colNumber The 1-based column # into the resultSet.
153      * @param isNullable Whether or not the column is nullable
154      * (No need to call wasNull() if not)
155      *
156      * @exception StandardException Thrown on error
157      * @exception SQLException Error accessing the result set
158      *
159      * @see org.apache.derby.iapi.types.DataValueDescriptor#setValueFromResultSet
160      */

161     public void setValueFromResultSet(
162     ResultSet JavaDoc resultSet,
163     int colNumber,
164     boolean isNullable)
165         throws StandardException, SQLException JavaDoc
166     {
167         throw(StandardException.newException(
168                 SQLState.HEAP_UNIMPLEMENTED_FEATURE));
169     }
170
171
172     /**
173      * Set the value of this DataValueDescriptor from another.
174      *
175      * @param theValue The Date value to set this DataValueDescriptor to
176      *
177      * @see org.apache.derby.iapi.types.DataValueDescriptor#setValue
178      */

179     protected void setFrom(DataValueDescriptor theValue)
180         throws StandardException
181     {
182         throw(StandardException.newException(
183                 SQLState.HEAP_UNIMPLEMENTED_FEATURE));
184     }
185
186     /**
187      * Get the SQL name of the datatype
188      *
189      * @return The SQL name of the datatype
190      *
191      * @see org.apache.derby.iapi.types.DataValueDescriptor#getTypeName
192      */

193     public String JavaDoc getTypeName()
194     {
195         if (SanityManager.DEBUG)
196             SanityManager.THROWASSERT("Not implemented!.");
197
198         return(null);
199     }
200
201     /**
202      * Compare this Orderable with a given Orderable for the purpose of
203      * index positioning. This method treats nulls as ordered values -
204      * that is, it treats SQL null as equal to null and less than all
205      * other values.
206      *
207      * @param other The Orderable to compare this one to.
208      *
209      * @return <0 - this Orderable is less than other.
210      * 0 - this Orderable equals other.
211      * >0 - this Orderable is greater than other.
212      *
213      * The code should not explicitly look for -1, or 1.
214      *
215      * @exception StandardException Thrown on error
216      *
217      * @see DataValueDescriptor#compare
218      */

219     public int compare(DataValueDescriptor other)
220         throws StandardException
221     {
222         throw(StandardException.newException(
223                 SQLState.HEAP_UNIMPLEMENTED_FEATURE));
224     }
225 }
226
Popular Tags