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

org.neogroup.warp.data.DataSource Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
package org.neogroup.warp.data;

import org.neogroup.warp.data.query.builders.DefaultQueryBuilder;
import org.neogroup.warp.data.query.builders.QueryBuilder;

import java.sql.Connection;
import java.sql.SQLException;

public abstract class DataSource {

    private QueryBuilder queryBuilder;

    public DataSource () {
        this(new DefaultQueryBuilder());
    }

    public DataSource(QueryBuilder queryBuilder) {
        this.queryBuilder = queryBuilder;
    }

    public DataConnection getConnection () {
        try {
            return new DataConnection(requestConnection(), queryBuilder);
        }
        catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

    protected abstract Connection requestConnection() throws SQLException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy