Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / impl / store / raw / data / CompressSpacePageOperation10_2.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/store/raw/data/CompressSpacePageOperation10_2.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/store/raw/data/CompressSpacePageOperation10_2.java
new file mode 100644 (file)
index 0000000..057df83
--- /dev/null
@@ -0,0 +1,94 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.store.raw.data.CompressSpacePageOperation10_2\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.raw.data;\r
+\r
+import org.apache.derby.impl.store.raw.data.CompressSpacePageOperation;\r
+import org.apache.derby.impl.store.raw.data.BasePage;\r
+\r
+import org.apache.derby.iapi.services.io.FormatIdUtil;\r
+import org.apache.derby.iapi.services.io.StoredFormatIds;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+import org.apache.derby.iapi.services.io.CompressedNumber;\r
+\r
+import java.io.OutputStream;\r
+import java.io.ObjectOutput;\r
+import java.io.IOException;\r
+import java.io.ObjectInput;\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+\r
+/**\r
+ * This class overrides the CompressSpacePageOperation class to write\r
+ * CompressSpaceOperation Log Records that do not support negative values\r
+ * for new_highest_page. No other changes are added to the superclass behavior.\r
+ * This class ensures backword compatibility for Soft upgrades. \r
+ */\r
+public final class CompressSpacePageOperation10_2 extends CompressSpacePageOperation {\r
+    \r
+       /**************************************************************************\r
+       * Constructors for This class:\r
+       **************************************************************************\r
+       */\r
+       public CompressSpacePageOperation10_2(\r
+               AllocPage   allocPage, \r
+               int         highest_page, \r
+               int         num_truncated)\r
+                       throws StandardException\r
+       {\r
+               super(allocPage, highest_page, num_truncated);\r
+       }\r
+\r
+       // no-arg constructor, required by Formatable \r
+       public CompressSpacePageOperation10_2() { super(); }\r
+\r
+       /**************************************************************************\r
+       * Public Methods of Formatable interface.\r
+       **************************************************************************\r
+       */\r
+\r
+       public void writeExternal(ObjectOutput out) throws IOException \r
+       {\r
+               super.writeExternal(out);\r
+               CompressedNumber.writeInt(out, newHighestPage);\r
+               CompressedNumber.writeInt(out, num_pages_truncated);\r
+       }\r
+\r
+       /**\r
+               @exception IOException error reading from log stream\r
+               @exception ClassNotFoundException cannot read object from input\r
+       */\r
+       public void readExternal(ObjectInput in)\r
+                throws IOException, ClassNotFoundException\r
+       {\r
+               super.readExternal(in);\r
+               newHighestPage      = CompressedNumber.readInt(in);\r
+               num_pages_truncated = CompressedNumber.readInt(in);\r
+       }\r
+\r
+       /**\r
+               Return my format identifier.\r
+       */\r
+       public int getTypeFormatId() {\r
+               return StoredFormatIds.LOGOP_COMPRESS10_2_SPACE;\r
+       }\r
+\r
+}\r