KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > store > raw > data > D_RecordId


1 /*
2
3    Derby - Class org.apache.derby.impl.store.raw.data.D_RecordId
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.store.raw.data;
23
24 import org.apache.derby.iapi.services.diag.Diagnosticable;
25 import org.apache.derby.iapi.services.diag.DiagnosticableGeneric;
26 import org.apache.derby.iapi.services.diag.DiagnosticUtil;
27
28 import org.apache.derby.iapi.error.StandardException;
29
30 import org.apache.derby.iapi.store.raw.PageKey;
31 import org.apache.derby.iapi.store.raw.RowLock;
32
33 import java.util.Properties JavaDoc;
34
35 /**
36
37 The D_RecordId class provides diagnostic information about the
38 BaseContainerHandle class. Currently this info is a single string of the form
39     ROW(conglomerate_id, page_number, record_id)
40 **/

41
42 public class D_RecordId extends DiagnosticableGeneric
43 {
44
45     /**
46      * Return string identifying the underlying container.
47      * <p>
48      *
49      * @return A string of the form TABLE(conglomerate_id, container_id).
50      * @exception StandardException Standard Cloudscape Error
51      **/

52     public String JavaDoc diag()
53         throws StandardException
54     {
55         RecordId record_id = (RecordId) diag_object;
56         PageKey page_key = (PageKey)record_id.getPageId();
57         long container_id = page_key.getContainerId().getContainerId();
58         long conglom_id = Long.MIN_VALUE;
59         String JavaDoc str = null;
60
61         if (conglom_id == Long.MIN_VALUE)
62         {
63             str = "ROW(?, " +
64                   container_id + ", " +
65                   record_id.getPageNumber() + ", " +
66                   record_id.getId() + ")";
67         }
68         else
69         {
70             str = "ROW(" +
71                   conglom_id + ", " +
72                   record_id.getPageNumber() + ", " +
73                   record_id.getId() + ")";
74         }
75
76         return(str);
77     }
78
79
80     /**
81      * Return a set of properties describing the the key used to lock container.
82      * <p>
83      * Used by debugging code to print the lock table on demand.
84      *
85      * @exception StandardException Standard exception policy.
86      **/

87     public void diag_detail(Properties JavaDoc prop)
88         throws StandardException
89     {
90         RecordId record_id = (RecordId) diag_object;
91         PageKey page_key = (PageKey)record_id.getPageId();
92
93         prop.put(RowLock.DIAG_CONTAINERID,
94             Long.toString(page_key.getContainerId().getContainerId()));
95
96         prop.put(RowLock.DIAG_SEGMENTID,
97             Long.toString(page_key.getContainerId().getSegmentId()));
98
99         prop.put(RowLock.DIAG_PAGENUM,
100             Long.toString(record_id.getPageNumber()));
101
102         prop.put(RowLock.DIAG_RECID,
103             Integer.toString(record_id.getId()));
104
105         return;
106     }
107 }
108
Popular Tags