01: /*
02: * Copyright 2006 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.core.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
28: .getLogger(KualiPersistenceBrokerImpl.class);
29:
30: private boolean fresh = true;
31:
32: public KualiPersistenceBrokerImpl(PBKey key,
33: PersistenceBrokerFactoryIF pbf) {
34: super (key, pbf);
35: }
36:
37: public boolean isFresh() {
38: return fresh;
39: }
40:
41: /**
42: * @see org.apache.ojb.broker.core.PersistenceBrokerImpl#beginTransaction()
43: */
44: public synchronized void beginTransaction()
45: throws TransactionInProgressException,
46: TransactionAbortedException {
47: LOG.debug("beginning transaction for persistenceBroker "
48: + getClass().getName() + "@" + hashCode());
49:
50: super .beginTransaction();
51: }
52:
53: /**
54: * @see org.apache.ojb.broker.core.PersistenceBrokerImpl#abortTransaction()
55: */
56: public synchronized void abortTransaction()
57: throws TransactionNotInProgressException {
58: LOG.debug("aborting transaction for persistenceBroker "
59: + getClass().getName() + "@" + hashCode());
60:
61: super .abortTransaction();
62: }
63:
64: /**
65: * @see org.apache.ojb.broker.core.PersistenceBrokerImpl#commitTransaction()
66: */
67: public synchronized void commitTransaction()
68: throws TransactionNotInProgressException,
69: TransactionAbortedException {
70: LOG.debug("committing transaction for persistenceBroker "
71: + getClass().getName() + "@" + hashCode());
72:
73: super .commitTransaction();
74: }
75:
76: /**
77: * @see org.apache.ojb.broker.core.PersistenceBrokerImpl#close()
78: */
79: public boolean close() {
80: LOG.debug("closing persistenceBroker " + getClass().getName()
81: + "@" + hashCode());
82: fresh = false;
83:
84: return super.close();
85: }
86: }
|