KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > TransactionException


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: TransactionException.java,v 1.2 2002/12/29 11:15:55 per_nyfelt Exp $
8

9 package org.ozoneDB;
10
11
12 /**
13  * This exception is thrown, if...
14  *
15  *
16  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
17  * @version $Revision: 1.2 $Date: 2002/12/29 11:15:55 $
18  */

19 public class TransactionException extends OzoneRemoteException {
20     
21     public final static int UNKNOWN = 0;
22     
23     /**
24      * Transaction had inproper status to complete the requested operation.
25      */

26     public final static int STATE = 1;
27     
28     /**
29      * Transaction was rolled back instead of prepared.
30      */

31     public final static int ROLLBACK = 2;
32     
33     /**
34      * An object that was optimisticly locked (by an explicit lock or the use of
35      * {@link ClientCacheDatabase}) was changed by another party.
36      */

37     public final static int OPTIMISTIC = 3;
38     
39     /**
40      * An error was encountered where it was not expected. This normaly
41      * indicates a runtime exception (for example an IOException) or a bug.
42      */

43     public final static int UNEXPECTED = 4;
44     
45     /**
46      * The transaction was stopped by the transaction manager.
47      */

48     public final static int STOPPED = 5;
49     
50     
51     protected int code;
52     
53     
54     public TransactionException() {
55     }
56     
57     
58     public TransactionException( String JavaDoc s ) {
59         super( s );
60         code = UNKNOWN;
61     }
62     
63     public TransactionException(String JavaDoc msg, Throwable JavaDoc cause) {
64         super(msg, cause);
65     }
66     
67     public TransactionException(Throwable JavaDoc cause) {
68         super(cause);
69     }
70     
71     public TransactionException( String JavaDoc s, int _code ) {
72         super( s );
73         code = _code;
74     }
75     
76     
77     public int code() {
78         return code;
79     }
80     
81     
82     public String JavaDoc toString() {
83         return super.toString() + " [code: " + code + "]";
84     }
85 }
86
Popular Tags