--- /dev/null
+/*\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.heap;\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_HEAP_V2_ID\r
+ *\r
+ * @purpose The tag that describes the on disk representation of the Heap\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 HeapFactory which\r
+ * must be able to read all heap format id's. \r
+ *\r
+ * This format was used for all Derby database Heap'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 heap \r
+ * until we are in the "middle" of reading the Heap. Thus the\r
+ * base Heap 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_HEAP_V3_ID:\r
+ * read:\r
+ * old format is readable by current Heap 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 Heap_v10_2 class\r
+ * that will write out old format info.\r
+ *\r
+ * hard upgrade to ACCESS_HEAP_V3_ID:\r
+ * read:\r
+ * old format is readable by current Heap 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_columns(int)\r
+ * array_of_format_ids(byte[][])\r
+ **/\r
+\r
+\r
+\r
+public class Heap_v10_2 extends Heap\r
+{\r
+\r
+ /**\r
+ * No arg constructor, required by Formatable.\r
+ **/\r
+ public Heap_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 Heap in all Derby versions prior to 10.3.\r
+ * Databases hard upgraded to a version 10.3 and later will write the new \r
+ * format, see Heap. Databases created in 10.3 and later will also write \r
+ * the new format, see Heap.\r
+ *\r
+ * @see org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId\r
+ **/\r
+ public int getTypeFormatId() \r
+ {\r
+ // return identifier used for Heap in all derby versions prior to 10.3\r
+ return StoredFormatIds.ACCESS_HEAP_V2_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