]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
7f979b16409c57cd8d0489e0f5c141010d680190
[tmp/jakarta-migration.git] /
1 /**
2  *  This document is a part of the source code and related artifacts
3  *  for CollectionSpace, an open source collections management system
4  *  for museums and related institutions:
5
6  *  http://www.collectionspace.org
7  *  http://wiki.collectionspace.org
8
9  *  Copyright 2009 University of California at Berkeley
10
11  *  Licensed under the Educational Community License (ECL), Version 2.0.
12  *  You may not use this file except in compliance with this License.
13
14  *  You may obtain a copy of the ECL 2.0 License at
15
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17  */
18 package org.collectionspace.services.common.document;
19
20 /**
21  * TransactionException
22  * 
23  */
24 public class TransactionException extends DocumentException {
25
26     /**
27          * 
28          */
29         private static final long serialVersionUID = 1L;
30
31         // Custom HTTP status code, per the extensibility offered via RFC-2616
32     // e.g. http://tools.ietf.org/html/rfc2616#section-6.1.1
33     final public static int HTTP_CODE = 590;
34     
35     final static String TRANSACTION_FAILED_MSG = 
36         "A transaction failed, whether due to exceeding a timeout value or some other cause. Please contact your system administrator.";
37
38     /**
39      * Creates a new instance of <code>TransactionException</code> without detail message.
40      */
41     public TransactionException() {
42         super(TRANSACTION_FAILED_MSG);
43         setErrorCode(HTTP_CODE);
44     }
45
46     /**
47      * Constructs an instance of <code>TransactionException</code> with the specified detail message.
48      * @param msg the detail message.
49      */
50     public TransactionException(String msg) {
51         super(msg);
52         setErrorCode(HTTP_CODE);
53     }
54
55     /**
56      * Constructs a new exception with the specified detail message and
57      * cause.  <p>Note that the detail message associated with
58      * <code>cause</code> is <i>not</i> automatically incorporated in
59      * this exception's detail message.
60      *
61      * @param  message the detail message (which is saved for later retrieval
62      *         by the {@link #getMessage()} method).
63      * @param  cause the cause (which is saved for later retrieval by the
64      *         {@link #getCause()} method).  (A <tt>null</tt> value is
65      *         permitted, and indicates that the cause is nonexistent or
66      *         unknown.)
67      * @since  1.4
68      */
69     public TransactionException(String message, Throwable cause) {
70         super(message, cause);
71         setErrorCode(HTTP_CODE);
72     }
73
74     /**
75      * Constructs a new exception with the specified cause and a detail
76      * message of <tt>(cause==null ? null : cause.toString())</tt> (which
77      * typically contains the class and detail message of <tt>cause</tt>).
78      * This constructor is useful for exceptions that are little more than
79      * wrappers for other throwables (for example, {@link
80      * java.security.PrivilegedActionException}).
81      *
82      * @param  cause the cause (which is saved for later retrieval by the
83      *         {@link #getCause()} method).  (A <tt>null</tt> value is
84      *         permitted, and indicates that the cause is nonexistent or
85      *         unknown.)
86      * @since  1.4
87      */
88     public TransactionException(Throwable cause) {      
89         super(TRANSACTION_FAILED_MSG, cause);
90         setErrorCode(HTTP_CODE);
91     }
92 }