Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / impl / store / access / btree / index / B2I_v10_2.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/store/access/btree/index/B2I_v10_2.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/store/access/btree/index/B2I_v10_2.java
new file mode 100644 (file)
index 0000000..86f3b69
--- /dev/null
@@ -0,0 +1,162 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.store.access.btree.index.B2I\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.impl.store.access.btree.index;\r
+\r
+\r
+import org.apache.derby.iapi.services.io.StoredFormatIds; \r
+\r
+import java.io.IOException; \r
+import java.io.ObjectOutput;\r
+import java.io.ObjectInput;\r
+\r
+import java.lang.ClassNotFoundException;\r
+\r
+\r
+/*\r
+ * @format_id ACCESS_B2I_V3_ID\r
+ *\r
+ * @purpose   The tag that describes the on disk representation of the B2I\r
+ *            conglomerate object.  Access contains no "directory" of \r
+ *            conglomerate information.  In order to bootstrap opening a file\r
+ *            it encodes the factory that can open the conglomerate in the \r
+ *            conglomerate id itself.  There exists a single B2IFactory which\r
+ *            must be able to read all btree format id's.  \r
+ *\r
+ *            This format was used for all Derby database B2I's in version\r
+ *            10.2 and previous versions.\r
+ *\r
+ * @upgrade   The format id of this object is currently always read from disk\r
+ *            as the first field of the conglomerate itself.  A bootstrap\r
+ *            problem exists as we don't know the format id of the B2I \r
+ *            until we are in the "middle" of reading the B2I.  Thus the\r
+ *            base B2I implementation must be able to read and write \r
+ *            all formats based on the reading the \r
+ *            "format_of_this_conglomerate". \r
+ *\r
+ *            soft upgrade to ACCESS_B2I_V4_ID:\r
+ *                read:\r
+ *                    old format is readable by current B2I implementation,\r
+ *                    with automatic in memory creation of default collation\r
+ *                    id needed by new format.  No code other than\r
+ *                    readExternal and writeExternal need know about old format.\r
+ *                write:\r
+ *                    will never write out new format id in soft upgrade mode.\r
+ *                    Code in readExternal and writeExternal handles writing\r
+ *                    correct version.  Code in the factory handles making\r
+ *                    sure new conglomerates use the B2I_v10_2 class to \r
+ *                    that will write out old format info.\r
+ *\r
+ *            hard upgrade to ACCESS_B2I_V4_ID:\r
+ *                read:\r
+ *                    old format is readable by current B2I implementation,\r
+ *                    with automatic in memory creation of default collation\r
+ *                    id needed by new format.\r
+ *                write:\r
+ *                    Only "lazy" upgrade will happen.  New format will only\r
+ *                    get written for new conglomerate created after the \r
+ *                    upgrade.  Old conglomerates continue to be handled the\r
+ *                    same as soft upgrade.\r
+ *\r
+ * @disk_layout \r
+ *     format_of_this_conlgomerate(byte[])\r
+ *     containerid(long)\r
+ *     segmentid(int)\r
+ *     number_of_key_fields(int)\r
+ *     number_of_unique_columns(int)\r
+ *     allow_duplicates(boolean)\r
+ *     maintain_parent_links(boolean)\r
+ *     array_of_format_ids(byte[][])\r
+ *     baseConglomerateId(long)\r
+ *     rowLocationColumn(int)\r
+ *     ascend_column_info(FormatableBitSet)\r
+ *\r
+ */\r
+\r
+/**\r
+ * Class used to instantiate 10.2 version of the B2I object.\r
+ *\r
+ * This class implements the format of the B2I object as existed in \r
+ * the 10.2 and previous releases of Derby.  In subsequent releases\r
+ * the format was enhanced to store the Collation Id of the columns\r
+ * in the index.  \r
+ *\r
+ * Collation can be configured on a per column basis to allow for\r
+ * alter sort ordering of each column.  One use of this is to allow\r
+ * a column to be sorted according to language based rules rather\r
+ * than the default numerical ordering of the binary value.\r
+ *\r
+ * For upgrade purpose all columns stored with ACCESS_B2I_V3_ID format\r
+ * are assumed to be USC_BASIC collation id (ie. the default numerical\r
+ * ordering, rather than any alternate collation).  \r
+ *\r
+ * This class reads and writes the V3 version to/from disk and reads/writes\r
+ * current in-memory version of the data structure.\r
+ *\r
+ */\r
+public class B2I_v10_2 extends B2I\r
+{\r
+\r
+    /**\r
+     * No arg constructor, required by Formatable.\r
+     **/\r
+    public B2I_v10_2()\r
+    {\r
+        super();\r
+    }\r
+\r
+\r
+    /**************************************************************************\r
+     * Public Methods required by Storable interface, implies \r
+     *     Externalizable, TypedFormat:\r
+     **************************************************************************\r
+     */\r
+\r
+    /**\r
+     * Return my format identifier.\r
+     * <p>\r
+     * This identifier was used for B2I in all Derby versions prior to and\r
+     * including 10.2.  Databases hard upgraded to a version subsequent\r
+     * to 10.2 will write the new format, see B2I.  Databases created in\r
+     * a version subsequent to 10.2 will also write the new formate, see\r
+     * B2I.\r
+     *\r
+     * @see org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId\r
+     **/\r
+       public int getTypeFormatId() \r
+    {\r
+               return StoredFormatIds.ACCESS_B2I_V3_ID;\r
+       }\r
+\r
+    /**\r
+     * Store the stored representation of the column value in the\r
+     * stream.\r
+     * <p>\r
+     * For more detailed description of the format see documentation\r
+     * at top of file.\r
+     *\r
+     * @see java.io.Externalizable#writeExternal\r
+     **/\r
+       public void writeExternal(ObjectOutput out) throws IOException \r
+    {\r
+               super.writeExternal_v10_2(out);\r
+       }\r
+}\r