KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > OptimisticLockException


1 package org.apache.ojb.broker;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 /**
20  * Exception that is thrown if a violation of an optimistic lock was detected.
21  *
22  * @author Thomas Mahler
23  * @version $Id: OptimisticLockException.java,v 1.7.2.1 2005/12/21 22:22:07 tomdz Exp $
24  */

25 public class OptimisticLockException extends PersistenceBrokerException
26 {
27     /** The violating object. */
28     private Object JavaDoc sourceObject;
29     
30     /**
31      * Creates a new exception instance.
32      */

33     public OptimisticLockException()
34     {
35         super();
36     }
37
38     /**
39      * Creates a new exception instance.
40      *
41      * @param msg The exception message
42      */

43     public OptimisticLockException(String JavaDoc msg)
44     {
45         super(msg);
46     }
47     
48     /**
49      * Creates a new exception instance.
50      *
51      * @param msg The exception message
52      * @param source The violating object
53      */

54     public OptimisticLockException(String JavaDoc msg, Object JavaDoc source)
55     {
56         super(msg);
57         sourceObject = source;
58     }
59
60     /**
61      * Creates a new exception instance.
62      *
63      * @param cause The base exception
64      */

65     public OptimisticLockException(Throwable JavaDoc cause)
66     {
67         super(cause);
68     }
69
70     /**
71      * Gets the violating object.
72      *
73      * @return The object
74      */

75     public Object JavaDoc getSourceObject()
76     {
77         return sourceObject;
78     }
79
80     /**
81      * Sets the violating object.
82      *
83      * @param sourceObject The object
84      */

85     public void setSourceObject(Object JavaDoc sourceObject)
86     {
87         this.sourceObject = sourceObject;
88     }
89
90 }
91
Popular Tags