1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.util;
17
18 import org.apache.log4j.Logger;
19 import org.apache.ojb.broker.PBKey;
20 import org.apache.ojb.broker.TransactionAbortedException;
21 import org.apache.ojb.broker.TransactionInProgressException;
22 import org.apache.ojb.broker.TransactionNotInProgressException;
23 import org.apache.ojb.broker.core.PersistenceBrokerFactoryIF;
24 import org.apache.ojb.broker.core.PersistenceBrokerImpl;
25
26 public class KualiPersistenceBrokerImpl extends PersistenceBrokerImpl {
27 private static final Logger LOG = Logger.getLogger(KualiPersistenceBrokerImpl.class);
28
29
30 private boolean fresh = true;
31
32 public KualiPersistenceBrokerImpl(PBKey key, PersistenceBrokerFactoryIF pbf) {
33 super(key, pbf);
34 }
35
36 public boolean isFresh() {
37 return fresh;
38 }
39
40
41
42
43
44 public synchronized void beginTransaction() throws TransactionInProgressException, TransactionAbortedException {
45 LOG.debug("beginning transaction for persistenceBroker " + getClass().getName() + "@" + hashCode());
46
47 super.beginTransaction();
48 }
49
50
51
52
53 public synchronized void abortTransaction() throws TransactionNotInProgressException {
54 LOG.debug("aborting transaction for persistenceBroker " + getClass().getName() + "@" + hashCode());
55
56 super.abortTransaction();
57 }
58
59
60
61
62 public synchronized void commitTransaction() throws TransactionNotInProgressException, TransactionAbortedException {
63 LOG.debug("committing transaction for persistenceBroker " + getClass().getName() + "@" + hashCode());
64
65 super.commitTransaction();
66 }
67
68
69
70
71 public boolean close() {
72 LOG.debug("closing persistenceBroker " + getClass().getName() + "@" + hashCode());
73 fresh = false;
74
75 return super.close();
76 }
77 }