com.despegar.jdbc.galera.AbstractGaleraDataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of galera-java-client Show documentation
Show all versions of galera-java-client Show documentation
A simple Java client for MariaDB Galera Cluster and Percona XtraDB Cluster. It is designed to be an
alternative to connect JVM app to
MariaDB/Percona galera nodes without HAProxy
package com.despegar.jdbc.galera;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
public abstract class AbstractGaleraDataSource implements DataSource {
@Override
public Connection getConnection(String username, String password) throws SQLException {
throw new SQLFeatureNotSupportedException();
}
@Override
public void setLoginTimeout(int seconds) throws SQLException {
throw new SQLFeatureNotSupportedException();
}
@Override
public int getLoginTimeout() throws SQLException {
throw new SQLFeatureNotSupportedException();
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
throw new SQLFeatureNotSupportedException();
}
// C3PO implementation
@Override
public T unwrap(Class iface) throws SQLException {
if ( this.isWrapperForThis( iface ) )
return (T) this;
else
throw new SQLException(this + " is not a wrapper for or implementation of " + iface.getName());
}
protected final boolean isWrapperForThis(Class> iface) {
return iface.isAssignableFrom( this.getClass() );
}
// C3PO implementation
@Override
public boolean isWrapperFor(Class> iface) throws SQLException {
return isWrapperForThis( iface );
}
}