01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.objectserver.persistence.sleepycat;
06:
07: import com.sleepycat.je.DatabaseException;
08: import com.sleepycat.je.Transaction;
09: import com.tc.objectserver.persistence.api.PersistenceTransaction;
10:
11: import java.util.HashMap;
12: import java.util.Map;
13:
14: class TransactionWrapper implements PersistenceTransaction {
15: private final Transaction tx;
16: private final Map properties = new HashMap(1);
17:
18: public TransactionWrapper(Transaction tx) {
19: this .tx = tx;
20: }
21:
22: public Transaction getTransaction() {
23: return tx;
24: }
25:
26: public void commit() {
27: if (tx != null)
28: try {
29: tx.commit();
30: } catch (DatabaseException e) {
31: throw new DBException(e);
32: }
33: }
34:
35: public Object getProperty(Object key) {
36: return properties.get(key);
37: }
38:
39: public Object setProperty(Object key, Object value) {
40: return properties.put(key, value);
41: }
42: }
|