001: //** Copyright Statement ***************************************************
002: //The Salmon Open Framework for Internet Applications (SOFIA)
003: // Copyright (C) 1999 - 2002, Salmon LLC
004: //
005: // This program is free software; you can redistribute it and/or
006: // modify it under the terms of the GNU General Public License version 2
007: // as published by the Free Software Foundation;
008: //
009: // This program is distributed in the hope that it will be useful,
010: // but WITHOUT ANY WARRANTY; without even the implied warranty of
011: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: // GNU General Public License for more details.
013: //
014: // You should have received a copy of the GNU General Public License
015: // along with this program; if not, write to the Free Software
016: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: //
018: // For more information please visit http://www.salmonllc.com
019: //** End Copyright Statement ***************************************************
020: package com.salmonllc.sql;
021:
022: /////////////////////////
023: //$Archive: /SOFIA/SourceCode/com/salmonllc/sql/DataStoreException.java $
024: //$Author: Dan $
025: //$Revision: 10 $
026: //$Modtime: 5/01/03 11:30a $
027: /////////////////////////
028:
029: /**
030: * This Exception is thrown by methods in the DataStore / DataStore Buffer class when an error occurs.
031: */
032: public class DataStoreException extends Exception {
033: private String _SQLStatement = null;
034: private int _row = -1;
035: private int _buffer = 0;
036: private String _column = null;
037: private Throwable _rootCause;
038: private int _dsNo;
039:
040: /**
041: * @return The root cause of the exception if there is one or null if not
042: */
043:
044: public Throwable getRootCause() {
045: return _rootCause;
046: }
047:
048: /**
049: * Constructs an Exception with no specified detail message.
050: */
051: public DataStoreException() {
052: super ();
053: }
054:
055: /**
056: * Constructs an Exception with the specified detail message.
057: * @param s the detail message.
058: */
059: public DataStoreException(String s) {
060: super (s);
061: }
062:
063: /**
064: * Constructs an Exception with the specified detail message.
065: * @param s the detail message.
066: */
067: public DataStoreException(String s, Throwable root) {
068: super (s);
069: _rootCause = root;
070: }
071:
072: /**
073: * Constructs an Exception with the specified detail message.
074: * @param s the detail message.
075: */
076: public DataStoreException(String s, Throwable root, int dsNo) {
077: super (s);
078: _rootCause = root;
079: _dsNo = dsNo;
080: }
081:
082: /**
083: * Constructs an Exception with the specified detail message.
084: * @param s the detail message.
085: * @param SQLStatement The SQL Statement that caused the error.
086: * @param row The dataStore row number that caused the error.
087: * @param row The dataStore buffer that caused the error.
088: */
089: public DataStoreException(String s, String SQLStatement, int row,
090: int buffer) {
091: this (s);
092: _SQLStatement = SQLStatement;
093: _row = row;
094: _buffer = buffer;
095: }
096:
097: /**
098: * Constructs an Exception with the specified detail message.
099: * @param s the detail message.
100: * @param row The dataStore row number that caused the error.
101: * @param column The column that caused the error.
102: */
103: public DataStoreException(String s, int row, String column) {
104: this (s);
105: _row = row;
106: _column = column;
107: }
108:
109: /**
110: * Returns the SQL Statement that caused the error.
111: * @return int
112: */
113: public int getBuffer() {
114: return _buffer;
115: }
116:
117: /**
118: * Returns the row number that caused the error.
119: */
120: public int getRow() {
121: return _row;
122: }
123:
124: /**
125: * Returns the column that caused the error.
126: */
127: public String getColumn() {
128: return _column;
129: }
130:
131: /**
132: * Returns the SQLStatement that caused the error.
133: */
134: public String getSqlStatement() {
135: return _SQLStatement;
136: }
137:
138: /**
139: * For a proxy datastore updating multiple datastores, the one that caused the error
140: */
141: public int getDataStoreNo() {
142: return _dsNo;
143: }
144:
145: /**
146: * Can be called by the code generating the exception to set the DataStore number that caused the error. For proxy datastores that do multiple updates
147: */
148: public void setDataStoreNo(int dsNo) {
149: _dsNo = dsNo;
150: }
151:
152: /**
153: * Sets the row number causing the error
154: */
155: public void setRowNo(int rowNo) {
156: _row = rowNo;
157: }
158:
159: /**
160: * Sets the column causing the error
161: */
162: public void setColumn(String column) {
163: _column = column;
164: }
165:
166: }
|