Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / iapi / sql / dictionary / FileInfoDescriptor.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/sql/dictionary/FileInfoDescriptor.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/sql/dictionary/FileInfoDescriptor.java
new file mode 100644 (file)
index 0000000..9ae0bbf
--- /dev/null
@@ -0,0 +1,166 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.iapi.sql.dictionary.FileInfoDescriptor\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.iapi.sql.dictionary;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+import org.apache.derby.iapi.sql.depend.Provider;\r
+import org.apache.derby.catalog.UUID;\r
+\r
+import org.apache.derby.iapi.reference.SQLState;\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+import org.apache.derby.iapi.sql.StatementType;\r
+import org.apache.derby.catalog.DependableFinder;\r
+import org.apache.derby.catalog.Dependable;\r
+import org.apache.derby.iapi.services.io.StoredFormatIds;\r
+\r
+/**\r
+ * A Descriptor for a file that has been stored in the database.\r
+ */\r
+public final class  FileInfoDescriptor extends TupleDescriptor \r
+       implements Provider, UniqueSQLObjectDescriptor\r
+{\r
+       /** A type tho indicate the file is a jar file **/\r
+       public static final int JAR_FILE_TYPE = 0;\r
+\r
+       /** external interface to this class:\r
+               <ol>\r
+               <li>public long getGenerationId();\r
+               </ol>\r
+       */\r
+       private final UUID id;\r
+       private final SchemaDescriptor sd;\r
+       private final String sqlName;\r
+       private final long generationId;\r
+       \r
+       /**\r
+        * Constructor for a FileInfoDescriptor.\r
+        *\r
+        * @param dataDictionary                The data dictionary that this descriptor lives in\r
+        * @param id            The id for this file\r
+        * @param sd                    The schema for this file.\r
+        * @param sqlName               The SQL name of this file.\r
+        * @param generationId  The generation id for the\r
+        *                      version of the file this describes.\r
+        */\r
+\r
+       public FileInfoDescriptor(DataDictionary dataDictionary,\r
+                                                                UUID id,\r
+                                                                SchemaDescriptor sd,\r
+                                                                String sqlName,\r
+                                                                long generationId)\r
+       {\r
+               super( dataDictionary );\r
+\r
+               if (SanityManager.DEBUG)\r
+               {\r
+                       if (sd.getSchemaName() == null)\r
+                       {\r
+                               SanityManager.THROWASSERT("new FileInfoDescriptor() schema "+\r
+                                       "name is null for FileInfo "+sqlName);\r
+                       }\r
+               }\r
+               this.id = id;\r
+               this.sd = sd;\r
+               this.sqlName = sqlName;\r
+               this.generationId = generationId;\r
+       }\r
+\r
+       public SchemaDescriptor getSchemaDescriptor()\r
+       {\r
+               return sd;\r
+       }\r
+\r
+       public String getName()\r
+       {\r
+               return sqlName;\r
+       }\r
+\r
+       /**\r
+        * @see UniqueTupleDescriptor#getUUID\r
+        */\r
+       public UUID     getUUID()\r
+       {\r
+               return id;\r
+       }\r
+\r
+       /**\r
+        * Gets the generationId for the current version of this file. The\r
+        * triple (schemaName,SQLName,generationId) are unique for the\r
+        * life of this database.\r
+        *\r
+        * @return      the generationId for this file\r
+        */\r
+       public long getGenerationId()\r
+       {\r
+               return generationId;\r
+       }\r
+\r
+       //\r
+       // Provider interface\r
+       //\r
+\r
+       /**             \r
+         @see Dependable#getDependableFinder\r
+        */\r
+       public DependableFinder getDependableFinder()\r
+       {\r
+           return      getDependableFinder(StoredFormatIds.FILE_INFO_FINDER_V01_ID);\r
+       }\r
+\r
+       /**\r
+         @see Dependable#getObjectName\r
+        */\r
+       public String getObjectName()\r
+       {\r
+               return sqlName;\r
+       }\r
+\r
+       /**\r
+         @see Dependable#getObjectID\r
+        */\r
+       public UUID getObjectID()\r
+       {\r
+               return id;\r
+       }\r
+\r
+       /**\r
+         @see Dependable#getClassType\r
+        */\r
+       public String getClassType()\r
+       {\r
+               return Dependable.FILE;\r
+       }\r
+\r
+       //\r
+       // class interface\r
+       //\r
+\r
+       \r
+       /** @see TupleDescriptor#getDescriptorType */\r
+       public String getDescriptorType() { return "Jar file"; }\r
+\r
+       /** @see TupleDescriptor#getDescriptorName */\r
+       public String getDescriptorName() { return sqlName; }\r
+\r
+\r
+\r
+}\r