001 package org.apache.ojb.odmg;
002
003 /* Copyright 2003-2005 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 import org.odmg.TransactionAbortedException;
019
020 /**
021 * This specialised exception allows us to capture the cause of an
022 * ODMG TransactionAbortedException. This, in turn,
023 * gives the "catcher" of the exception the ability to take different
024 * courses of action dependent upon why the transaction was aborted. <p>
025 * This exception has been created as a subclass of
026 * org.odmg.TransactionAbortedException so that we don't
027 * <ul>
028 * <li>Modify the ODMG exception - as it is defined by the ODMG spec
029 * <li>Break the spec by throwing a non ODMG exception
030 * </ul>
031 *
032 * @author Charles Anthony
033 */
034 public class TransactionAbortedExceptionOJB extends TransactionAbortedException
035 {
036 /**
037 * The cause of a TransactionAbortedException
038 */
039 private Throwable cause;
040
041 public TransactionAbortedExceptionOJB()
042 {
043 super();
044 }
045
046 public TransactionAbortedExceptionOJB(String msg)
047 {
048 super(msg);
049 }
050
051 public TransactionAbortedExceptionOJB(String msg, Throwable th)
052 {
053 super(msg);
054 this.cause = th;
055 }
056
057 public TransactionAbortedExceptionOJB(Throwable cause)
058 {
059 this.cause = cause;
060 }
061
062 /**
063 * Returns the cause of the exception. May be null.
064 */
065 public Throwable getCause()
066 {
067 return cause;
068 }
069 }