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.event;
20:
21: /**
22: * Abstract implementation of the {@link TransactionListener} interface
23: * that provides no-op implementations of all methods.
24: *
25: * @author Abe White
26: * @since 0.3.0
27: */
28: public abstract class AbstractTransactionListener implements
29: TransactionListener {
30:
31: /**
32: * Catch-all for unhandled events. This method is called by all other
33: * event methods if you do not override them. Does nothing by default.
34: */
35: protected void eventOccurred(TransactionEvent event) {
36: }
37:
38: public void afterBegin(TransactionEvent event) {
39: eventOccurred(event);
40: }
41:
42: public void beforeFlush(TransactionEvent event) {
43: eventOccurred(event);
44: }
45:
46: public void afterFlush(TransactionEvent event) {
47: eventOccurred(event);
48: }
49:
50: public void beforeCommit(TransactionEvent event) {
51: eventOccurred(event);
52: }
53:
54: public void afterCommit(TransactionEvent event) {
55: eventOccurred(event);
56: }
57:
58: public void afterRollback(TransactionEvent event) {
59: eventOccurred(event);
60: }
61:
62: public void afterStateTransitions(TransactionEvent event) {
63: eventOccurred(event);
64: }
65:
66: public void afterCommitComplete(TransactionEvent event) {
67: eventOccurred(event);
68: }
69:
70: public void afterRollbackComplete(TransactionEvent event) {
71: eventOccurred(event);
72: }
73: }
|