com.ing.data.cassandra.jdbc.AbstractConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cassandra-jdbc-wrapper Show documentation
Show all versions of cassandra-jdbc-wrapper Show documentation
JDBC wrapper of the Java Driver for Apache Cassandra®.
/*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ing.data.cassandra.jdbc;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Struct;
import java.sql.Wrapper;
import java.util.Map;
import java.util.concurrent.Executor;
import static com.ing.data.cassandra.jdbc.utils.ErrorConstants.NOT_SUPPORTED;
import static com.ing.data.cassandra.jdbc.utils.ErrorConstants.NO_INTERFACE;
/**
* Provides a default implementation (returning a {@link SQLFeatureNotSupportedException}) to hold the unimplemented
* methods of {@link java.sql.Connection} interface.
*/
@SuppressWarnings("unused")
abstract class AbstractConnection implements Wrapper {
public Array createArrayOf(final String typeName, final Object[] elements) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public Blob createBlob() throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public Clob createClob() throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public NClob createNClob() throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public SQLXML createSQLXML() throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public Struct createStruct(final String typeName, final Object[] attributes) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public CallableStatement prepareCall(final String cql) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public CallableStatement prepareCall(final String cql, final int resultSetType, final int resultSetConcurrency)
throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public CallableStatement prepareCall(final String cql, final int resultSetType, final int resultSetConcurrency,
final int resultSetHoldability) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public PreparedStatement prepareStatement(final String cql, final int autoGeneratedKeys) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public PreparedStatement prepareStatement(final String cql, final int[] columnIndexes) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public PreparedStatement prepareStatement(final String cql, final String[] columnNames) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public void releaseSavepoint(final Savepoint savepoint) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public void rollback(final Savepoint savepoint) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public Savepoint setSavepoint() throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public Savepoint setSavepoint(final String name) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public void setTypeMap(final Map> map) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public void abort(final Executor executor) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
public int getNetworkTimeout() throws SQLException {
throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
}
@Override
public boolean isWrapperFor(final Class> iface) throws SQLException {
return iface != null && iface.isAssignableFrom(this.getClass());
}
@Override
public T unwrap(final Class iface) throws SQLException {
if (isWrapperFor(iface)) {
return iface.cast(this);
} else {
throw new SQLException(String.format(NO_INTERFACE, iface.getSimpleName()));
}
}
}