01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. 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: package javax.sql;
19:
20: import java.util.EventObject;
21: import java.sql.SQLException;
22: import java.io.Serializable;
23:
24: /**
25: * An Event object which is sent when specific events happen on a
26: * PooledConnection object. The events involved are when the application closing
27: * the PooledConnection and when an error occurs in the PooledConnection.
28: */
29: public class ConnectionEvent extends EventObject implements
30: Serializable {
31:
32: private static final long serialVersionUID = -4843217645290030002L;
33:
34: private SQLException ex;
35:
36: /**
37: * Creates a connection event initialized with a supplied PooledConnection.
38: *
39: * @param theConnection
40: * the PooledConnection
41: */
42: public ConnectionEvent(PooledConnection theConnection) {
43: super (theConnection);
44: }
45:
46: /**
47: * Creates a ConnectionEvent initialized with a supplied PooledConnection
48: * and with a supplied SQLException indicating that an error has occurred
49: * within the PooledConnection.
50: *
51: * @param theConnection
52: * the PooledConnection
53: * @param theException
54: * the SQLException holding information about the error that has
55: * occurred, which is about to be returned to the application.
56: */
57: public ConnectionEvent(PooledConnection theConnection,
58: SQLException theException) {
59: super (theConnection);
60: ex = theException;
61: }
62:
63: /**
64: * Gets the SQLException which holds information about the error which
65: * occurred in the PooledConnection.
66: *
67: * @return an SQLException containing information about the error. May be
68: * null if no error has occurred.
69: */
70: public SQLException getSQLException() {
71: return ex;
72: }
73: }
|