01: package org.apache.ojb.broker;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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: * Exception that is thrown if a violation of an optimistic lock was detected.
20: *
21: * @author Thomas Mahler
22: * @version $Id: OptimisticLockException.java,v 1.7.2.1 2005/12/21 22:22:07 tomdz Exp $
23: */
24: public class OptimisticLockException extends PersistenceBrokerException {
25: /** The violating object. */
26: private Object sourceObject;
27:
28: /**
29: * Creates a new exception instance.
30: */
31: public OptimisticLockException() {
32: super ();
33: }
34:
35: /**
36: * Creates a new exception instance.
37: *
38: * @param msg The exception message
39: */
40: public OptimisticLockException(String msg) {
41: super (msg);
42: }
43:
44: /**
45: * Creates a new exception instance.
46: *
47: * @param msg The exception message
48: * @param source The violating object
49: */
50: public OptimisticLockException(String msg, Object source) {
51: super (msg);
52: sourceObject = source;
53: }
54:
55: /**
56: * Creates a new exception instance.
57: *
58: * @param cause The base exception
59: */
60: public OptimisticLockException(Throwable cause) {
61: super (cause);
62: }
63:
64: /**
65: * Gets the violating object.
66: *
67: * @return The object
68: */
69: public Object getSourceObject() {
70: return sourceObject;
71: }
72:
73: /**
74: * Sets the violating object.
75: *
76: * @param sourceObject The object
77: */
78: public void setSourceObject(Object sourceObject) {
79: this.sourceObject = sourceObject;
80: }
81:
82: }
|