--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.store.raw.data.D_RecordId\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.iapi.services.diag.Diagnosticable;\r
+import org.apache.derby.iapi.services.diag.DiagnosticableGeneric;\r
+import org.apache.derby.iapi.services.diag.DiagnosticUtil;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+import org.apache.derby.iapi.store.raw.PageKey;\r
+import org.apache.derby.iapi.store.raw.RowLock;\r
+\r
+import java.util.Properties;\r
+\r
+/**\r
+\r
+The D_RecordId class provides diagnostic information about the\r
+BaseContainerHandle class. Currently this info is a single string of the form\r
+ ROW(conglomerate_id, page_number, record_id)\r
+**/\r
+\r
+public class D_RecordId extends DiagnosticableGeneric\r
+{\r
+\r
+ /**\r
+ * Return string identifying the underlying container.\r
+ * <p>\r
+ *\r
+ * @return A string of the form TABLE(conglomerate_id, container_id).\r
+ * @exception StandardException Standard Derby Error\r
+ **/\r
+ public String diag()\r
+ throws StandardException\r
+ {\r
+ RecordId record_id = (RecordId) diag_object;\r
+ PageKey page_key = (PageKey)record_id.getPageId();\r
+ long container_id = page_key.getContainerId().getContainerId(); \r
+ long conglom_id = Long.MIN_VALUE;\r
+ String str = null;\r
+\r
+ if (conglom_id == Long.MIN_VALUE)\r
+ {\r
+ str = "ROW(?, " + \r
+ container_id + ", " + \r
+ record_id.getPageNumber() + ", " +\r
+ record_id.getId() + ")";\r
+ }\r
+ else\r
+ {\r
+ str = "ROW(" + \r
+ conglom_id + ", " + \r
+ record_id.getPageNumber() + ", " +\r
+ record_id.getId() + ")";\r
+ }\r
+\r
+ return(str);\r
+ }\r
+\r
+\r
+ /**\r
+ * Return a set of properties describing the the key used to lock container.\r
+ * <p>\r
+ * Used by debugging code to print the lock table on demand.\r
+ *\r
+ * @exception StandardException Standard exception policy.\r
+ **/\r
+ public void diag_detail(Properties prop)\r
+ throws StandardException\r
+ {\r
+ RecordId record_id = (RecordId) diag_object;\r
+ PageKey page_key = (PageKey)record_id.getPageId();\r
+\r
+ prop.put(RowLock.DIAG_CONTAINERID, \r
+ Long.toString(page_key.getContainerId().getContainerId()));\r
+\r
+ prop.put(RowLock.DIAG_SEGMENTID, \r
+ Long.toString(page_key.getContainerId().getSegmentId()));\r
+\r
+ prop.put(RowLock.DIAG_PAGENUM, \r
+ Long.toString(record_id.getPageNumber()));\r
+\r
+ prop.put(RowLock.DIAG_RECID, \r
+ Integer.toString(record_id.getId()));\r
+\r
+ return;\r
+ }\r
+}\r