KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.dictionary.FileInfoDescriptor
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 import org.apache.derby.iapi.error.StandardException;
25 import org.apache.derby.iapi.sql.depend.Provider;
26 import org.apache.derby.catalog.UUID;
27
28 import org.apache.derby.iapi.reference.SQLState;
29 import org.apache.derby.iapi.services.sanity.SanityManager;
30 import org.apache.derby.iapi.sql.StatementType;
31 import org.apache.derby.catalog.DependableFinder;
32 import org.apache.derby.catalog.Dependable;
33 import org.apache.derby.iapi.services.io.StoredFormatIds;
34
35 /**
36  * A Descriptor for a file that has been stored in the database.
37  */

38 public final class FileInfoDescriptor extends TupleDescriptor
39     implements Provider, UniqueSQLObjectDescriptor
40 {
41     /** A type tho indicate the file is a jar file **/
42     public static final int JAR_FILE_TYPE = 0;
43
44     /** external interface to this class:
45         <ol>
46         <li>public long getGenerationId();
47         </ol>
48     */

49     private final UUID id;
50     private final SchemaDescriptor sd;
51     private final String JavaDoc sqlName;
52     private final long generationId;
53     
54     /**
55      * Constructor for a FileInfoDescriptor.
56      *
57      * @param dataDictionary The data dictionary that this descriptor lives in
58      * @param id The id for this file
59      * @param sd The schema for this file.
60      * @param sqlName The SQL name of this file.
61      * @param generationId The generation id for the
62      * version of the file this describes.
63      */

64
65     public FileInfoDescriptor(DataDictionary dataDictionary,
66                                  UUID id,
67                                  SchemaDescriptor sd,
68                                  String JavaDoc sqlName,
69                                  long generationId)
70     {
71         super( dataDictionary );
72
73         if (SanityManager.DEBUG)
74         {
75             if (sd.getSchemaName() == null)
76             {
77                 SanityManager.THROWASSERT("new FileInfoDescriptor() schema "+
78                     "name is null for FileInfo "+sqlName);
79             }
80         }
81         this.id = id;
82         this.sd = sd;
83         this.sqlName = sqlName;
84         this.generationId = generationId;
85     }
86
87     public SchemaDescriptor getSchemaDescriptor()
88     {
89         return sd;
90     }
91
92     public String JavaDoc getName()
93     {
94         return sqlName;
95     }
96
97     /**
98      * @see UniqueTupleDescriptor#getUUID
99      */

100     public UUID getUUID()
101     {
102         return id;
103     }
104
105     /**
106      * Gets the generationId for the current version of this file. The
107      * triple (schemaName,SQLName,generationId) are unique for the
108      * life of this database.
109      *
110      * @return the generationId for this file
111      */

112     public long getGenerationId()
113     {
114         return generationId;
115     }
116
117     //
118
// Provider interface
119
//
120

121     /**
122       @see Dependable#getDependableFinder
123      */

124     public DependableFinder getDependableFinder()
125     {
126         return getDependableFinder(StoredFormatIds.FILE_INFO_FINDER_V01_ID);
127     }
128
129     /**
130       @see Dependable#getObjectName
131      */

132     public String JavaDoc getObjectName()
133     {
134         return sqlName;
135     }
136
137     /**
138       @see Dependable#getObjectID
139      */

140     public UUID getObjectID()
141     {
142         return id;
143     }
144
145     /**
146       @see Dependable#getClassType
147      */

148     public String JavaDoc getClassType()
149     {
150         return Dependable.FILE;
151     }
152
153     //
154
// class interface
155
//
156

157     
158     /** @see TupleDescriptor#getDescriptorType */
159     public String JavaDoc getDescriptorType() { return "Jar file"; }
160
161     /** @see TupleDescriptor#getDescriptorName */
162     public String JavaDoc getDescriptorName() { return sqlName; }
163
164
165
166 }
167
Popular Tags