[CCSDK-6] Populate seed code
[ccsdk/sli/adaptors.git] / resource-assignment / provider / src / main / java / org / openecomp / sdnc / util / db / ConnectionWrap.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : SDN-C
4  * ================================================================================
5  * Copyright (C) 2017 ONAP Intellectual Property. All rights
6  *                                              reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.openecomp.sdnc.util.db;
23
24 import java.sql.Array;
25 import java.sql.Blob;
26 import java.sql.CallableStatement;
27 import java.sql.Clob;
28 import java.sql.Connection;
29 import java.sql.DatabaseMetaData;
30 import java.sql.NClob;
31 import java.sql.PreparedStatement;
32 import java.sql.SQLClientInfoException;
33 import java.sql.SQLException;
34 import java.sql.SQLWarning;
35 import java.sql.SQLXML;
36 import java.sql.Savepoint;
37 import java.sql.Statement;
38 import java.sql.Struct;
39 import java.util.Map;
40 import java.util.Properties;
41 import java.util.concurrent.Executor;
42
43 public class ConnectionWrap implements Connection {
44
45         private Connection cc;
46
47         public ConnectionWrap(Connection cc) {
48                 super();
49                 this.cc = cc;
50         }
51
52         public Connection getCon() {
53                 return cc;
54         }
55
56         public void realClose() throws SQLException {
57                 cc.close();
58         }
59
60         @Override
61         public <T> T unwrap(Class<T> iface) throws SQLException {
62                 return cc.unwrap(iface);
63         }
64
65         @Override
66         public boolean isWrapperFor(Class<?> iface) throws SQLException {
67                 return cc.isWrapperFor(iface);
68         }
69
70         @Override
71         public Statement createStatement() throws SQLException {
72                 return cc.createStatement();
73         }
74
75         @Override
76         public PreparedStatement prepareStatement(String sql) throws SQLException {
77                 return cc.prepareStatement(sql);
78         }
79
80         @Override
81         public CallableStatement prepareCall(String sql) throws SQLException {
82                 return cc.prepareCall(sql);
83         }
84
85         @Override
86         public String nativeSQL(String sql) throws SQLException {
87                 return cc.nativeSQL(sql);
88         }
89
90         @Override
91         public void setAutoCommit(boolean autoCommit) throws SQLException {
92                 cc.setAutoCommit(autoCommit);
93         }
94
95         @Override
96         public boolean getAutoCommit() throws SQLException {
97                 return cc.getAutoCommit();
98         }
99
100         @Override
101         public void commit() throws SQLException {
102                 cc.commit();
103         }
104
105         @Override
106         public void rollback() throws SQLException {
107                 cc.rollback();
108         }
109
110         @Override
111         public void close() throws SQLException {
112         }
113
114         @Override
115         public boolean isClosed() throws SQLException {
116                 return cc.isClosed();
117         }
118
119         @Override
120         public DatabaseMetaData getMetaData() throws SQLException {
121                 return cc.getMetaData();
122         }
123
124         @Override
125         public void setReadOnly(boolean readOnly) throws SQLException {
126                 cc.setReadOnly(readOnly);
127         }
128
129         @Override
130         public boolean isReadOnly() throws SQLException {
131                 return cc.isReadOnly();
132         }
133
134         @Override
135         public void setCatalog(String catalog) throws SQLException {
136                 cc.setCatalog(catalog);
137         }
138
139         @Override
140         public String getCatalog() throws SQLException {
141                 return cc.getCatalog();
142         }
143
144         @Override
145         public void setTransactionIsolation(int level) throws SQLException {
146                 cc.setTransactionIsolation(level);
147         }
148
149         @Override
150         public int getTransactionIsolation() throws SQLException {
151                 return cc.getTransactionIsolation();
152         }
153
154         @Override
155         public SQLWarning getWarnings() throws SQLException {
156                 return cc.getWarnings();
157         }
158
159         @Override
160         public void clearWarnings() throws SQLException {
161                 cc.clearWarnings();
162         }
163
164         @Override
165         public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
166                 return cc.createStatement(resultSetType, resultSetConcurrency);
167         }
168
169         @Override
170         public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
171                 throws SQLException {
172                 return cc.prepareStatement(sql, resultSetType, resultSetConcurrency);
173         }
174
175         @Override
176         public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
177                 return cc.prepareCall(sql, resultSetType, resultSetConcurrency);
178         }
179
180         @Override
181         public Map<String, Class<?>> getTypeMap() throws SQLException {
182                 return cc.getTypeMap();
183         }
184
185         @Override
186         public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
187                 cc.setTypeMap(map);
188         }
189
190         @Override
191         public void setHoldability(int holdability) throws SQLException {
192                 cc.setHoldability(holdability);
193         }
194
195         @Override
196         public int getHoldability() throws SQLException {
197                 return cc.getHoldability();
198         }
199
200         @Override
201         public Savepoint setSavepoint() throws SQLException {
202                 return cc.setSavepoint();
203         }
204
205         @Override
206         public Savepoint setSavepoint(String name) throws SQLException {
207                 return cc.setSavepoint(name);
208         }
209
210         @Override
211         public void rollback(Savepoint savepoint) throws SQLException {
212                 cc.rollback(savepoint);
213         }
214
215         @Override
216         public void releaseSavepoint(Savepoint savepoint) throws SQLException {
217                 cc.releaseSavepoint(savepoint);
218         }
219
220         @Override
221         public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
222                 throws SQLException {
223                 return cc.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
224         }
225
226         @Override
227         public PreparedStatement prepareStatement(
228                 String sql,
229                 int resultSetType,
230                 int resultSetConcurrency,
231                 int resultSetHoldability) throws SQLException {
232                 return cc.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
233         }
234
235         @Override
236         public CallableStatement prepareCall(
237                 String sql,
238                 int resultSetType,
239                 int resultSetConcurrency,
240                 int resultSetHoldability) throws SQLException {
241                 return cc.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
242         }
243
244         @Override
245         public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
246                 return cc.prepareStatement(sql, autoGeneratedKeys);
247         }
248
249         @Override
250         public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
251                 return cc.prepareStatement(sql, columnIndexes);
252         }
253
254         @Override
255         public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
256                 return cc.prepareStatement(sql, columnNames);
257         }
258
259         @Override
260         public Clob createClob() throws SQLException {
261                 return cc.createClob();
262         }
263
264         @Override
265         public Blob createBlob() throws SQLException {
266                 return cc.createBlob();
267         }
268
269         @Override
270         public NClob createNClob() throws SQLException {
271                 return cc.createNClob();
272         }
273
274         @Override
275         public SQLXML createSQLXML() throws SQLException {
276                 return cc.createSQLXML();
277         }
278
279         @Override
280         public boolean isValid(int timeout) throws SQLException {
281                 return cc.isValid(timeout);
282         }
283
284         @Override
285         public void setClientInfo(String name, String value) throws SQLClientInfoException {
286                 cc.setClientInfo(name, value);
287         }
288
289         @Override
290         public void setClientInfo(Properties properties) throws SQLClientInfoException {
291                 cc.setClientInfo(properties);
292         }
293
294         @Override
295         public String getClientInfo(String name) throws SQLException {
296                 return cc.getClientInfo(name);
297         }
298
299         @Override
300         public Properties getClientInfo() throws SQLException {
301                 return cc.getClientInfo();
302         }
303
304         @Override
305         public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
306                 return cc.createArrayOf(typeName, elements);
307         }
308
309         @Override
310         public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
311                 return cc.createStruct(typeName, attributes);
312         }
313
314         @Override
315         public void setSchema(String schema) throws SQLException {
316                 cc.setSchema(schema);
317         }
318
319         @Override
320         public String getSchema() throws SQLException {
321                 return cc.getSchema();
322         }
323
324         @Override
325         public void abort(Executor executor) throws SQLException {
326                 cc.abort(executor);
327         }
328
329         @Override
330         public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
331                 cc.setNetworkTimeout(executor, milliseconds);
332         }
333
334         @Override
335         public int getNetworkTimeout() throws SQLException {
336                 return cc.getNetworkTimeout();
337         }
338 }