KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tcspring > DsoTransactionManager


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tcspring;
5
6 import org.springframework.transaction.PlatformTransactionManager;
7 import org.springframework.transaction.TransactionDefinition;
8 import org.springframework.transaction.TransactionException;
9 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 PlatformTransactionManager {
19
20   public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
21     return new TransactionStatus() {
22       public boolean isNewTransaction() {
23         throw new UnsupportedOperationException JavaDoc();
24       }
25
26       public boolean hasSavepoint() {
27         throw new UnsupportedOperationException JavaDoc();
28       }
29
30       public void setRollbackOnly() {
31         throw new UnsupportedOperationException JavaDoc();
32       }
33
34       public boolean isRollbackOnly() {
35         throw new UnsupportedOperationException JavaDoc();
36       }
37
38       public boolean isCompleted() {
39         throw new UnsupportedOperationException JavaDoc();
40       }
41
42       public Object JavaDoc createSavepoint() throws TransactionException {
43         throw new UnsupportedOperationException JavaDoc();
44       }
45
46       public void rollbackToSavepoint(Object JavaDoc savepoint) throws TransactionException {
47         throw new UnsupportedOperationException JavaDoc();
48       }
49
50       public void releaseSavepoint(Object JavaDoc savepoint) throws TransactionException {
51         throw new UnsupportedOperationException JavaDoc();
52       }
53     };
54   }
55
56   public void commit(TransactionStatus status) throws TransactionException {
57     // noop
58
}
59
60   public void rollback(TransactionStatus status) throws TransactionException {
61     // noop
62
}
63 }
64
Popular Tags