All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.despegar.jdbc.galera.AbstractGaleraDataSource Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.0.20
Show newest version
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 );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy