Search in sources :

Example 6 with JdbcMeta

use of org.apache.calcite.avatica.jdbc.JdbcMeta in project phoenix by apache.

the class PhoenixMetaFactoryImpl method create.

@Override
public Meta create(List<String> args) {
    Configuration conf = Preconditions.checkNotNull(getConf(), "Configuration must not be null.");
    Properties info = new Properties();
    info.putAll(conf.getValByRegex("avatica.*"));
    try {
        final String url;
        if (args.size() == 0) {
            url = QueryUtil.getConnectionUrl(info, conf);
        } else if (args.size() == 1) {
            url = args.get(0);
        } else {
            throw new RuntimeException("0 or 1 argument expected. Received " + Arrays.toString(args.toArray()));
        }
        // TODO: what about -D configs passed in from cli? How do they get pushed down?
        return new JdbcMeta(url, info);
    } catch (SQLException | ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
}
Also used : HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) SQLException(java.sql.SQLException) JdbcMeta(org.apache.calcite.avatica.jdbc.JdbcMeta) Properties(java.util.Properties)

Aggregations

JdbcMeta (org.apache.calcite.avatica.jdbc.JdbcMeta)6 LocalService (org.apache.calcite.avatica.remote.LocalService)5 ArrayList (java.util.ArrayList)2 Driver (org.apache.calcite.avatica.remote.Driver)2 HttpServer (org.apache.calcite.avatica.server.HttpServer)2 StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 BeforeClass (org.junit.BeforeClass)2 Parameters (org.junit.runners.Parameterized.Parameters)2 File (java.io.File)1 SQLException (java.sql.SQLException)1 Properties (java.util.Properties)1 Configuration (org.apache.hadoop.conf.Configuration)1 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)1 JcaX509v3CertificateBuilder (org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder)1 JcaContentSignerBuilder (org.bouncycastle.operator.jcajce.JcaContentSignerBuilder)1