01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.lib.jdbc;
20:
21: /**
22: * An abstract implementation of the {@link JDBCListener}
23: * listener. It allows simple implementation of fine-grained event handling.
24: *
25: * @author Marc Prud'hommeaux
26: */
27: public class AbstractJDBCListener implements JDBCListener {
28:
29: /**
30: * Catch-all for unhandled events. This method is called by all other
31: * event methods if you do not override them. Does nothing by default.
32: */
33: protected void eventOccurred(JDBCEvent event) {
34: }
35:
36: public void beforePrepareStatement(JDBCEvent event) {
37: eventOccurred(event);
38: }
39:
40: public void afterPrepareStatement(JDBCEvent event) {
41: eventOccurred(event);
42: }
43:
44: public void beforeCreateStatement(JDBCEvent event) {
45: eventOccurred(event);
46: }
47:
48: public void afterCreateStatement(JDBCEvent event) {
49: eventOccurred(event);
50: }
51:
52: public void beforeExecuteStatement(JDBCEvent event) {
53: eventOccurred(event);
54: }
55:
56: public void afterExecuteStatement(JDBCEvent event) {
57: eventOccurred(event);
58: }
59:
60: public void beforeCommit(JDBCEvent event) {
61: eventOccurred(event);
62: }
63:
64: public void afterCommit(JDBCEvent event) {
65: eventOccurred(event);
66: }
67:
68: public void beforeRollback(JDBCEvent event) {
69: eventOccurred(event);
70: }
71:
72: public void afterRollback(JDBCEvent event) {
73: eventOccurred(event);
74: }
75:
76: public void beforeReturn(JDBCEvent event) {
77: eventOccurred(event);
78: }
79:
80: public void afterReturn(JDBCEvent event) {
81: eventOccurred(event);
82: }
83:
84: public void afterConnect(JDBCEvent event) {
85: eventOccurred(event);
86: }
87:
88: public void beforeClose(JDBCEvent event) {
89: eventOccurred(event);
90: }
91: }
|