01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tcspring;
05:
06: import org.springframework.transaction.PlatformTransactionManager;
07: import org.springframework.transaction.TransactionDefinition;
08: import org.springframework.transaction.TransactionException;
09: import org.springframework.transaction.TransactionStatus;
10:
11: /**
12: * A no-op implementation of the PlatformTransactionManager interface, to use when Spring's TX infrastructure is used to
13: * handle locking in DSO but no underlying TX implementation is running. TODO how to register this manager in the di
14: * config?
15: *
16: * @author Jonas Bonér
17: */
18: public class DsoTransactionManager implements
19: PlatformTransactionManager {
20:
21: public TransactionStatus getTransaction(
22: TransactionDefinition definition)
23: throws TransactionException {
24: return new TransactionStatus() {
25: public boolean isNewTransaction() {
26: throw new UnsupportedOperationException();
27: }
28:
29: public boolean hasSavepoint() {
30: throw new UnsupportedOperationException();
31: }
32:
33: public void setRollbackOnly() {
34: throw new UnsupportedOperationException();
35: }
36:
37: public boolean isRollbackOnly() {
38: throw new UnsupportedOperationException();
39: }
40:
41: public boolean isCompleted() {
42: throw new UnsupportedOperationException();
43: }
44:
45: public Object createSavepoint() throws TransactionException {
46: throw new UnsupportedOperationException();
47: }
48:
49: public void rollbackToSavepoint(Object savepoint)
50: throws TransactionException {
51: throw new UnsupportedOperationException();
52: }
53:
54: public void releaseSavepoint(Object savepoint)
55: throws TransactionException {
56: throw new UnsupportedOperationException();
57: }
58: };
59: }
60:
61: public void commit(TransactionStatus status)
62: throws TransactionException {
63: // noop
64: }
65:
66: public void rollback(TransactionStatus status)
67: throws TransactionException {
68: // noop
69: }
70: }
|