]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
2f49eb0afb8470ecc1b83aef430ddc3855af4dcd
[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     // Custom HTTP status code, per the extensibility offered via RFC-2616
27     // e.g. http://tools.ietf.org/html/rfc2616#section-6.1.1
28     final public static int HTTP_CODE = 590;
29     
30     final static String TRANSACTION_FAILED_MSG = 
31         "A transaction failed, whether due to exceeding a timeout value or some other cause. Please contact your system administrator.";
32
33     /**
34      * Creates a new instance of <code>TransactionException</code> without detail message.
35      */
36     public TransactionException() {
37         super(TRANSACTION_FAILED_MSG);
38         setErrorCode(HTTP_CODE);
39     }
40
41     /**
42      * Constructs an instance of <code>TransactionException</code> with the specified detail message.
43      * @param msg the detail message.
44      */
45     public TransactionException(String msg) {
46         super(msg);
47         setErrorCode(HTTP_CODE);
48     }
49
50     /**
51      * Constructs a new exception with the specified detail message and
52      * cause.  <p>Note that the detail message associated with
53      * <code>cause</code> is <i>not</i> automatically incorporated in
54      * this exception's detail message.
55      *
56      * @param  message the detail message (which is saved for later retrieval
57      *         by the {@link #getMessage()} method).
58      * @param  cause the cause (which is saved for later retrieval by the
59      *         {@link #getCause()} method).  (A <tt>null</tt> value is
60      *         permitted, and indicates that the cause is nonexistent or
61      *         unknown.)
62      * @since  1.4
63      */
64     public TransactionException(String message, Throwable cause) {
65         super(message, cause);
66         setErrorCode(HTTP_CODE);
67     }
68
69     /**
70      * Constructs a new exception with the specified cause and a detail
71      * message of <tt>(cause==null ? null : cause.toString())</tt> (which
72      * typically contains the class and detail message of <tt>cause</tt>).
73      * This constructor is useful for exceptions that are little more than
74      * wrappers for other throwables (for example, {@link
75      * java.security.PrivilegedActionException}).
76      *
77      * @param  cause the cause (which is saved for later retrieval by the
78      *         {@link #getCause()} method).  (A <tt>null</tt> value is
79      *         permitted, and indicates that the cause is nonexistent or
80      *         unknown.)
81      * @since  1.4
82      */
83     public TransactionException(Throwable cause) {
84         super(TRANSACTION_FAILED_MSG, cause);
85         setErrorCode(HTTP_CODE);
86     }
87 }