View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.dbcp2.transaction;
19  
20  import javax.transaction.HeuristicMixedException;
21  import javax.transaction.HeuristicRollbackException;
22  import javax.transaction.InvalidTransactionException;
23  import javax.transaction.NotSupportedException;
24  import javax.transaction.RollbackException;
25  import javax.transaction.SystemException;
26  import javax.transaction.Transaction;
27  import javax.transaction.TransactionManager;
28  
29  /**
30   * A TransactionManager adapter.
31   */
32  public class TransactionManagerAdapter implements TransactionManager {
33  
34      @Override
35      public void begin() throws NotSupportedException, SystemException {
36          // Noop
37      }
38  
39      @Override
40      public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException,
41          RollbackException, SecurityException, SystemException {
42          // Noop
43      }
44  
45      @Override
46      public int getStatus() throws SystemException {
47          return 0;
48      }
49  
50      @Override
51      public Transaction getTransaction() throws SystemException {
52          return null;
53      }
54  
55      @Override
56      public void resume(final Transaction arg0) throws IllegalStateException, InvalidTransactionException, SystemException {
57          // Noop
58      }
59  
60      @Override
61      public void rollback() throws IllegalStateException, SecurityException, SystemException {
62          // Noop
63      }
64  
65      @Override
66      public void setRollbackOnly() throws IllegalStateException, SystemException {
67          // Noop
68      }
69  
70      @Override
71      public void setTransactionTimeout(final int arg0) throws SystemException {
72          // Noop
73      }
74  
75      @Override
76      public Transaction suspend() throws SystemException {
77          return null;
78      }
79  
80  }