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.Blob;
24  import java.sql.Clob;
25  import java.sql.Connection;
26  import java.sql.NClob;
27  import java.sql.SQLException;
28  import java.sql.SQLFeatureNotSupportedException;
29  import java.sql.SQLXML;
30  import java.sql.Struct;
31  import java.util.Map;
32  import java.util.Properties;
33  import java.util.concurrent.Executor;
34  
35  /**
36   * Unsupported {@code Connection} methods.
37   */
38  public abstract class AbstractUnsupportedOperationConnection extends WrapperAdapter implements Connection {
39      
40      @Override
41      public final String nativeSQL(final String sql) throws SQLException {
42          throw new SQLFeatureNotSupportedException("nativeSQL");
43      }
44      
45      @Override
46      public final void abort(final Executor executor) throws SQLException {
47          throw new SQLFeatureNotSupportedException("abort");
48      }
49      
50      @Override
51      public final Map<String, Class<?>> getTypeMap() throws SQLException {
52          throw new SQLFeatureNotSupportedException("getTypeMap");
53      }
54      
55      @Override
56      public final void setTypeMap(final Map<String, Class<?>> map) throws SQLException {
57          throw new SQLFeatureNotSupportedException("setTypeMap");
58      }
59      
60      @Override
61      public final int getNetworkTimeout() throws SQLException {
62          throw new SQLFeatureNotSupportedException("getNetworkTimeout");
63      }
64      
65      @Override
66      public final void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException {
67          throw new SQLFeatureNotSupportedException("setNetworkTimeout");
68      }
69      
70      @Override
71      public final Clob createClob() throws SQLException {
72          throw new SQLFeatureNotSupportedException("createClob");
73      }
74      
75      @Override
76      public final Blob createBlob() throws SQLException {
77          throw new SQLFeatureNotSupportedException("createBlob");
78      }
79      
80      @Override
81      public final NClob createNClob() throws SQLException {
82          throw new SQLFeatureNotSupportedException("createNClob");
83      }
84      
85      @Override
86      public final SQLXML createSQLXML() throws SQLException {
87          throw new SQLFeatureNotSupportedException("createSQLXML");
88      }
89      
90      @Override
91      public final Struct createStruct(final String typeName, final Object[] attributes) throws SQLException {
92          throw new SQLFeatureNotSupportedException("createStruct");
93      }
94      
95      @Override
96      public final Properties getClientInfo() throws SQLException {
97          throw new SQLFeatureNotSupportedException("getClientInfo");
98      }
99      
100     @Override
101     public final String getClientInfo(final String name) throws SQLException {
102         throw new SQLFeatureNotSupportedException("getClientInfo name");
103     }
104     
105     @Override
106     public final void setClientInfo(final String name, final String value) {
107         throw new UnsupportedSQLOperationException("setClientInfo name value");
108     }
109     
110     @Override
111     public final void setClientInfo(final Properties props) {
112         throw new UnsupportedSQLOperationException("setClientInfo properties");
113     }
114 }