KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > dods > builder > generator > query > DataObjectException


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: DataObjectException.java,v 1.1 2004/09/03 13:42:37 sinisa Exp $
22  */

23 package com.lutris.dods.builder.generator.query;
24
25 import org.enhydra.dods.exceptions.DodsBaseException;
26
27 /**
28  * DataObjectException class, used by Business Objects, catch all the
29  * DataObject Exceptions, will be passed to POs and handled there.
30  * Need to state the reasons.<p>
31  * <b>Usage:</b><p>
32  * <dd> import myapp.business.*;<p>
33  *
34  * <dd> try {<br>
35  * <dd> some access of DOs<br>
36  * <dd> }<br>
37  * <dd> catch (SQLException sqlEx) {
38  * <dd> if (sqlEx.getSQLState().startsWith("02") &&
39  * <dd> (sqlEx.getErrorCode() == 100)) {
40  * <dd> String msg = "Update or delete DO is out of synch";
41  * <dd> throw new DataObjectException(msg, sqlEx);
42  * <dd> }
43  * <dd> else if (sqlEx.getSQLState().equals("S1000") &&
44  * <dd> (sqlEx.getErrorCode() == -268)) {
45  * <dd> String msg = "Integrity constraint violation";
46  * <dd> throw new DataObjectException(msg, sqlEx);
47  * <dd> }
48  * <dd> else {
49  * <dd> String msg = "Data Object Error";
50  * <dd> throw new DataObjectException(msg, sqlEx);
51  * <dd> }
52  * <dd> }
53  * <dd> catch (DatabaseManagerException connEx) {
54  * <dd> String msg = "Database connection Error";
55  * <dd> throw new DataObjectException(msg, connEx);
56  * <dd> }
57  * <dd> catch (ObjectIdException oidEx) {
58  * <dd> String msg = "Object ID Error";
59  * <dd> throw new DataObjectException(msg, oidEx);
60  * <dd> }
61  *
62  * @version $Revision: 1.1 $
63  */

64 public class DataObjectException extends DodsBaseException {
65
66     /**
67      * Construct a exception without a specified cause.
68      *
69      * @param msg The message associated with the exception.
70      */

71     public DataObjectException(String JavaDoc msg) {
72         super(msg);
73     }
74
75     /**
76      * Construct a exception with an associated causing exception.
77      *
78      * @param msg The message associated with the exception.
79      * @param cause The error or exception that cause this
80      * exception.
81      */

82     public DataObjectException(String JavaDoc msg,
83             Throwable JavaDoc cause) {
84         super(msg, cause);
85     }
86 }
87
Popular Tags