KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jts > CosTransactions > LogException


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
26  * Use is subject to license terms.
27  */

28 //----------------------------------------------------------------------------
29
//
30
// Module: LogException.java
31
//
32
// Description: Log exception.
33
//
34
// Product: com.sun.jts.CosTransactions
35
//
36
// Author: Simon Holdsworth
37
//
38
// Date: March, 1997
39
//
40
// Copyright (c): 1995-1997 IBM Corp.
41
//
42
// The source code for this program is not published or otherwise divested
43
// of its trade secrets, irrespective of what has been deposited with the
44
// U.S. Copyright Office.
45
//
46
// This software contains confidential and proprietary information of
47
// IBM Corp.
48
//----------------------------------------------------------------------------
49

50 package com.sun.jts.CosTransactions;
51
52 /**A class which contains exception information for errors in the log.
53  *
54  * @version 0.01
55  *
56  * @author Simon Holdsworth, IBM Corporation
57  *
58  * @see
59 */

60 //----------------------------------------------------------------------------
61
// CHANGE HISTORY
62
//
63
// Version By Change Description
64
// 0.01 SAJH Initial implementation.
65
//------------------------------------------------------------------------------
66

67 class LogException extends Throwable JavaDoc {
68
69     /**Constants which define error codes from the logger classes.
70      */

71     static final int LOG_SUCCESS = 0;
72     static final int LOG_NOT_INITIALISED = 1;
73     static final int LOG_OPEN_FAILURE = 2;
74     static final int LOG_READ_FAILURE = 3;
75     static final int LOG_CORRUPTED = 4;
76     static final int LOG_INVALID_FILE_DESCRIPTOR = 5;
77     static final int LOG_LOCK_FAILURE = 6;
78     static final int LOG_WRITE_FAILURE = 7;
79     static final int LOG_CLOSE_FAILURE = 8;
80     static final int LOG_TOO_MANY_INPUT_BUFFERS = 9;
81     static final int LOG_RECORD_TOO_LARGE = 10;
82     static final int LOG_NO_SPACE = 11;
83     static final int LOG_INSUFFICIENT_MEMORY = 12;
84     static final int LOG_ERROR_FORCING_LOG = 13;
85     static final int LOG_INVALID_LSN = 14;
86     static final int LOG_NEW_TAIL_TOO_HIGH = 15;
87     static final int LOG_NEW_TAIL_TOO_LOW = 16;
88     static final int LOG_INVALID_TAIL = 17;
89     static final int LOG_INTERNAL_ERROR = 18;
90     static final int LOG_NO_RESTART_RECORD = 19;
91     static final int LOG_INVALID_CURSOR = 20;
92     static final int LOG_END_OF_CURSOR = 21;
93     static final int LOG_ACCESS_FAILURE = 22;
94     static final int LOG_INVALID_PROCESS = 23;
95     static final int LOG_INVALID_RECORDTYPE = 24;
96     static final int LOG_INVALID_WRITEMODE = 25;
97     static final int LOG_OPEN_EXTENT_FAILURE = 26;
98     static final int LOG_READ_ONLY_ACCESS = 27;
99     static final int MAX_RESPONSE_VALUE = LOG_READ_ONLY_ACCESS;
100
101     /**Strings which contain error messages from the log.
102      */

103     private static final String JavaDoc[] statusStrings =
104     { "LOG-000: Operation successful"/*#Frozen*/,
105       "LOG-001: Log not initialised"/*#Frozen*/,
106       "LOG-002: Open failure"/*#Frozen*/,
107       "LOG-003: Read failure"/*#Frozen*/,
108       "LOG-004: Data corrupted"/*#Frozen*/,
109       "LOG-005: Invalid file descriptor"/*#Frozen*/,
110       "LOG-006: Lock failure"/*#Frozen*/,
111       "LOG-007: Write failure"/*#Frozen*/,
112       "LOG-008: Close failure"/*#Frozen*/,
113       "LOG-009: Too many input buffers"/*#Frozen*/,
114       "LOG-010: Record too large"/*#Frozen*/,
115       "LOG-011: No space in filesystem"/*#Frozen*/,
116       "LOG-012: Insufficient memory"/*#Frozen*/,
117       "LOG-013: Force failure"/*#Frozen*/,
118       "LOG-014: Invalid LSN value"/*#Frozen*/,
119       "LOG-015: New tail LSN too high"/*#Frozen*/,
120       "LOG-016: New tail LSN too low"/*#Frozen*/,
121       "LOG-017: Invalid tail LSN value"/*#Frozen*/,
122       "LOG-018: Internal error"/*#Frozen*/,
123       "LOG-019: No restart record present"/*#Frozen*/,
124       "LOG-020: Invalid cursor value"/*#Frozen*/,
125       "LOG-021: End of cursor reached"/*#Frozen*/,
126       "LOG-022: Filesystem access failure"/*#Frozen*/,
127       "LOG-023: Invalid process"/*#Frozen*/,
128       "LOG-024: Log is read only"/*#Frozen*/,
129       "LOG-025: Invalid record type specified"/*#Frozen*/,
130       "LOG-026: Extent file open failure"/*#Frozen*/,
131       "LOG-027: Invalid write mode specified"/*#Frozen*/,
132       "LOG-028: Invalid status specified"/*#Frozen*/ };
133
134     /**Instance members
135      */

136     int errorCode;
137     private int throwPoint;
138     private Object JavaDoc extraInfo;
139
140     /**LogException constructor
141      *
142      * @param trc The current trace object to allow exception trace to be made.
143      * @param err The error code.
144      * @param point The throw point.
145      *
146      * @return
147      *
148      * @see
149      */

150     LogException(Object JavaDoc dummy /* COMMENT(Ram J) - used to be trace object */,
151                   int err,
152                   int point ) {
153         super(new String JavaDoc("Log exception at point "+point+":\n"+
154                          statusStrings[err>MAX_RESPONSE_VALUE?MAX_RESPONSE_VALUE+1:err]/*#Frozen*/));
155         errorCode = err;
156         throwPoint = point;
157     }
158
159     /**LogException constructor
160      *
161      * @param trc The current trace object to allow exception trace to be made.
162      * @param err The error code.
163      * @param point The throw point.
164      * @param extra Extra information.
165      *
166      * @return
167      *
168      * @see
169      */

170     LogException(Object JavaDoc dummy /* COMMENT(Ram J) - used to be trace object */,
171                   int err,
172                   int point,
173                   Object JavaDoc extra ) {
174         super(new String JavaDoc("Log exception at point "+point+":\n"+
175                          statusStrings[err>MAX_RESPONSE_VALUE?MAX_RESPONSE_VALUE+1:err]/*#Frozen*/));
176         errorCode = err;
177         throwPoint = point;
178         extraInfo = extra;
179     }
180 }
181
Popular Tags