MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConnectionLifecycleInterceptor.java
1 /*
2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16  */
17 
18 package com.mysql.clusterj.jdbc;
19 
20 import com.mysql.clusterj.core.util.I18NHelper;
21 import com.mysql.clusterj.core.util.Logger;
22 import com.mysql.clusterj.core.util.LoggerFactoryService;
23 import com.mysql.jdbc.Connection;
24 
25 import java.sql.SQLException;
26 import java.sql.Savepoint;
27 
28 import java.util.Properties;
29 
37  implements com.mysql.jdbc.ConnectionLifecycleInterceptor {
38 
41 
44 
46  private InterceptorImpl interceptorImpl;
47 
55  public void init(Connection conn, Properties properties) throws SQLException {
56  // find the interceptor if it's already registered; otherwise create it
57  this.interceptorImpl = InterceptorImpl.getInterceptorImpl(this, conn, properties);
58  }
59 
60  public void destroy() {
61  interceptorImpl.destroy(this);
62  interceptorImpl = null;
63  }
64 
65  public void close() throws SQLException {
66  interceptorImpl.close();
67  }
68 
69  public boolean commit() throws SQLException {
70  return interceptorImpl.commit();
71  }
72 
73  public boolean rollback() throws SQLException {
74  return interceptorImpl.rollback();
75  }
76 
77  public boolean rollback(Savepoint savepoint) throws SQLException {
78  return interceptorImpl.rollback(savepoint);
79  }
80 
81  public boolean setAutoCommit(boolean autocommit) throws SQLException {
82  return interceptorImpl.setAutoCommit(autocommit);
83  }
84 
85  public boolean setCatalog(String catalog) throws SQLException {
86  return interceptorImpl.setCatalog(catalog);
87  }
88 
89  public boolean transactionBegun() throws SQLException {
90  return interceptorImpl.transactionBegun();
91  }
92 
93  public boolean transactionCompleted() throws SQLException {
94  return interceptorImpl.transactionCompleted();
95  }
96 
97 }