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.shardingsphere.driver.jdbc.unsupported;
19  
20  import org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter;
21  import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException;
22  
23  import java.sql.Array;
24  import java.sql.Blob;
25  import java.sql.CallableStatement;
26  import java.sql.Clob;
27  import java.sql.Connection;
28  import java.sql.NClob;
29  import java.sql.SQLException;
30  import java.sql.SQLFeatureNotSupportedException;
31  import java.sql.SQLXML;
32  import java.sql.Struct;
33  import java.util.Map;
34  import java.util.Properties;
35  import java.util.concurrent.Executor;
36  
37  /**
38   * Unsupported {@code Connection} methods.
39   */
40  public abstract class AbstractUnsupportedOperationConnection extends WrapperAdapter implements Connection {
41      
42      @Override
43      public final CallableStatement prepareCall(final String sql) throws SQLException {
44          throw new SQLFeatureNotSupportedException("prepareCall");
45      }
46      
47      @Override
48      public final CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException {
49          throw new SQLFeatureNotSupportedException("prepareCall");
50      }
51      
52      @Override
53      public final CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) throws SQLException {
54          throw new SQLFeatureNotSupportedException("prepareCall");
55      }
56      
57      @Override
58      public final String nativeSQL(final String sql) throws SQLException {
59          throw new SQLFeatureNotSupportedException("nativeSQL");
60      }
61      
62      @Override
63      public final void abort(final Executor executor) throws SQLException {
64          throw new SQLFeatureNotSupportedException("abort");
65      }
66      
67      @Override
68      public final Map<String, Class<?>> getTypeMap() throws SQLException {
69          throw new SQLFeatureNotSupportedException("getTypeMap");
70      }
71      
72      @Override
73      public final void setTypeMap(final Map<String, Class<?>> map) throws SQLException {
74          throw new SQLFeatureNotSupportedException("setTypeMap");
75      }
76      
77      @Override
78      public int getNetworkTimeout() throws SQLException {
79          throw new SQLFeatureNotSupportedException("getNetworkTimeout");
80      }
81      
82      @Override
83      public void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException {
84          throw new SQLFeatureNotSupportedException("setNetworkTimeout");
85      }
86      
87      @Override
88      public Array createArrayOf(final String typeName, final Object[] elements) throws SQLException {
89          throw new SQLFeatureNotSupportedException("createArrayOf");
90      }
91      
92      @Override
93      public final Blob createBlob() throws SQLException {
94          throw new SQLFeatureNotSupportedException("createBlob");
95      }
96      
97      @Override
98      public Clob createClob() throws SQLException {
99          throw new SQLFeatureNotSupportedException("createClob");
100     }
101     
102     @Override
103     public final NClob createNClob() throws SQLException {
104         throw new SQLFeatureNotSupportedException("createNClob");
105     }
106     
107     @Override
108     public final SQLXML createSQLXML() throws SQLException {
109         throw new SQLFeatureNotSupportedException("createSQLXML");
110     }
111     
112     @Override
113     public final Struct createStruct(final String typeName, final Object[] attributes) throws SQLException {
114         throw new SQLFeatureNotSupportedException("createStruct");
115     }
116     
117     @Override
118     public final Properties getClientInfo() throws SQLException {
119         throw new SQLFeatureNotSupportedException("getClientInfo");
120     }
121     
122     @Override
123     public final String getClientInfo(final String name) throws SQLException {
124         throw new SQLFeatureNotSupportedException("getClientInfo name");
125     }
126     
127     @Override
128     public final void setClientInfo(final String name, final String value) {
129         throw new UnsupportedSQLOperationException("setClientInfo name value");
130     }
131     
132     @Override
133     public final void setClientInfo(final Properties props) {
134         throw new UnsupportedSQLOperationException("setClientInfo properties");
135     }
136 }