You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by el...@apache.org on 2017/04/01 20:36:22 UTC

[33/37] calcite git commit: [CALCITE-1717] Remove avatica from the tree

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java
deleted file mode 100644
index a003b82..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.AvaticaHttpClientFactory;
-import org.apache.calcite.avatica.remote.Service;
-
-import java.io.File;
-import java.math.BigDecimal;
-import java.util.LinkedHashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-
-/** Implementation of {@link ConnectionConfig}. */
-public class ConnectionConfigImpl implements ConnectionConfig {
-  protected final Properties properties;
-
-  public ConnectionConfigImpl(Properties properties) {
-    this.properties = properties;
-  }
-
-  public String schema() {
-    return BuiltInConnectionProperty.SCHEMA.wrap(properties).getString();
-  }
-
-  public String timeZone() {
-    return BuiltInConnectionProperty.TIME_ZONE.wrap(properties).getString();
-  }
-
-  public Service.Factory factory() {
-    return BuiltInConnectionProperty.FACTORY.wrap(properties)
-        .getPlugin(Service.Factory.class, null);
-  }
-
-  public String url() {
-    return BuiltInConnectionProperty.URL.wrap(properties).getString();
-  }
-
-  public String serialization() {
-    return BuiltInConnectionProperty.SERIALIZATION.wrap(properties).getString();
-  }
-
-  public String authentication() {
-    return BuiltInConnectionProperty.AUTHENTICATION.wrap(properties).getString();
-  }
-
-  public String avaticaUser() {
-    return BuiltInConnectionProperty.AVATICA_USER.wrap(properties).getString();
-  }
-
-  public String avaticaPassword() {
-    return BuiltInConnectionProperty.AVATICA_PASSWORD.wrap(properties).getString();
-  }
-
-  public AvaticaHttpClientFactory httpClientFactory() {
-    return BuiltInConnectionProperty.HTTP_CLIENT_FACTORY.wrap(properties)
-        .getPlugin(AvaticaHttpClientFactory.class, null);
-  }
-
-  public String httpClientClass() {
-    return BuiltInConnectionProperty.HTTP_CLIENT_IMPL.wrap(properties).getString();
-  }
-
-  public String kerberosPrincipal() {
-    return BuiltInConnectionProperty.PRINCIPAL.wrap(properties).getString();
-  }
-
-  public File kerberosKeytab() {
-    String keytabPath = BuiltInConnectionProperty.KEYTAB.wrap(properties).getString();
-    if (null == keytabPath) {
-      return null;
-    }
-    File keytab = new File(keytabPath);
-    if (!keytab.exists() || !keytab.isFile()) {
-      throw new RuntimeException("The " + BuiltInConnectionProperty.KEYTAB.name() + " does not "
-          + " reference a normal, existent file: " + keytabPath);
-    }
-    return keytab;
-  }
-
-  public File truststore() {
-    String filename = BuiltInConnectionProperty.TRUSTSTORE.wrap(properties).getString();
-    if (null == filename) {
-      return null;
-    }
-    return new File(filename);
-  }
-
-  public String truststorePassword() {
-    return BuiltInConnectionProperty.TRUSTSTORE_PASSWORD.wrap(properties).getString();
-  }
-
-  /** Converts a {@link Properties} object containing (name, value)
-   * pairs into a map whose keys are
-   * {@link org.apache.calcite.avatica.InternalProperty} objects.
-   *
-   * <p>Matching is case-insensitive. Throws if a property is not known.
-   * If a property occurs more than once, takes the last occurrence.</p>
-   *
-   * @param properties Properties
-   * @return Map
-   * @throws RuntimeException if a property is not known
-   */
-  public static Map<ConnectionProperty, String> parse(Properties properties,
-      Map<String, ? extends ConnectionProperty> nameToProps) {
-    final Map<ConnectionProperty, String> map =
-        new LinkedHashMap<ConnectionProperty, String>();
-    for (String name : properties.stringPropertyNames()) {
-      final ConnectionProperty connectionProperty =
-          nameToProps.get(name.toUpperCase(Locale.ROOT));
-      if (connectionProperty == null) {
-        // For now, don't throw. It messes up sub-projects.
-        //throw new RuntimeException("Unknown property '" + name + "'");
-        continue;
-      }
-      map.put(connectionProperty, properties.getProperty(name));
-    }
-    return map;
-  }
-
-  /** The combination of a property definition and a map of property values. */
-  public static class PropEnv {
-    final Map<? extends ConnectionProperty, String> map;
-    private final ConnectionProperty property;
-
-    public PropEnv(Map<? extends ConnectionProperty, String> map,
-        ConnectionProperty property) {
-      this.map = map;
-      this.property = property;
-    }
-
-    private <T> T get_(Converter<T> converter, String defaultValue) {
-      final String s = map.get(property);
-      if (s != null) {
-        return converter.apply(property, s);
-      }
-      return converter.apply(property, defaultValue);
-    }
-
-    private <T> T getDefaultNull(Converter<T> converter) {
-      final String s = map.get(property);
-      if (s != null) {
-        return converter.apply(property, s);
-      }
-      return null;
-    }
-
-    /** Returns the string value of this property, or null if not specified and
-     * no default. */
-    public String getString() {
-      return getString((String) property.defaultValue());
-    }
-
-    /** Returns the string value of this property, or null if not specified and
-     * no default. */
-    public String getString(String defaultValue) {
-      assert property.type() == ConnectionProperty.Type.STRING;
-      return get_(IDENTITY_CONVERTER, defaultValue);
-    }
-
-    /** Returns the int value of this property. Throws if not set and no
-     * default. */
-    public int getInt() {
-      return getInt((Number) property.defaultValue());
-    }
-
-    /** Returns the int value of this property. Throws if not set and no
-     * default. */
-    public int getInt(Number defaultValue) {
-      assert property.type() == ConnectionProperty.Type.NUMBER;
-      return get_(NUMBER_CONVERTER, defaultValue.toString()).intValue();
-    }
-
-    /** Returns the long value of this property. Throws if not set and no
-     * default. */
-    public long getLong() {
-      return getLong((Number) property.defaultValue());
-    }
-
-    /** Returns the long value of this property. Throws if not set and no
-     * default. */
-    public long getLong(Number defaultValue) {
-      assert property.type() == ConnectionProperty.Type.NUMBER;
-      return get_(NUMBER_CONVERTER, defaultValue.toString()).longValue();
-    }
-
-    /** Returns the double value of this property. Throws if not set and no
-     * default. */
-    public double getDouble() {
-      return getDouble((Number) property.defaultValue());
-    }
-
-    /** Returns the double value of this property. Throws if not set and no
-     * default. */
-    public double getDouble(Number defaultValue) {
-      assert property.type() == ConnectionProperty.Type.NUMBER;
-      return get_(NUMBER_CONVERTER, defaultValue.toString()).doubleValue();
-    }
-
-    /** Returns the boolean value of this property. Throws if not set and no
-     * default. */
-    public boolean getBoolean() {
-      return getBoolean((Boolean) property.defaultValue());
-    }
-
-    /** Returns the boolean value of this property. Throws if not set and no
-     * default. */
-    public boolean getBoolean(boolean defaultValue) {
-      assert property.type() == ConnectionProperty.Type.BOOLEAN;
-      return get_(BOOLEAN_CONVERTER, Boolean.toString(defaultValue));
-    }
-
-    /** Returns the enum value of this property. Throws if not set and no
-     * default. */
-    public <E extends Enum<E>> E getEnum(Class<E> enumClass) {
-      //noinspection unchecked
-      return getEnum(enumClass, (E) property.defaultValue());
-    }
-
-    /** Returns the enum value of this property. Throws if not set and no
-     * default. */
-    public <E extends Enum<E>> E getEnum(Class<E> enumClass, E defaultValue) {
-      if (property.type() != ConnectionProperty.Type.ENUM) {
-        throw new AssertionError("not an enum");
-      }
-      if (enumClass != property.valueClass()) {
-        throw new AssertionError("wrong value class; expected "
-            + property.valueClass());
-      }
-      if (defaultValue == null) {
-        return getDefaultNull(enumConverter(enumClass));
-      } else {
-        return get_(enumConverter(enumClass), defaultValue.name());
-      }
-    }
-
-    /** Returns an instance of a plugin.
-     *
-     * <p>Throws if not set and no default.
-     * Also throws if the class does not implement the required interface,
-     * or if it does not have a public default constructor or an public static
-     * field called {@code #INSTANCE}. */
-    public <T> T getPlugin(Class<T> pluginClass, T defaultInstance) {
-      return getPlugin(pluginClass, (String) property.defaultValue(),
-          defaultInstance);
-    }
-
-    /** Returns an instance of a plugin, using a given class name if none is
-     * set.
-     *
-     * <p>Throws if not set and no default.
-     * Also throws if the class does not implement the required interface,
-     * or if it does not have a public default constructor or an public static
-     * field called {@code #INSTANCE}. */
-    public <T> T getPlugin(Class<T> pluginClass, String defaultClassName,
-        T defaultInstance) {
-      assert property.type() == ConnectionProperty.Type.PLUGIN;
-      return get_(pluginConverter(pluginClass, defaultInstance),
-          defaultClassName);
-    }
-  }
-
-  /** Callback to parse a property from string to its native type. */
-  public interface Converter<T> {
-    T apply(ConnectionProperty connectionProperty, String s);
-  }
-
-  public static final Converter<Boolean> BOOLEAN_CONVERTER =
-      new Converter<Boolean>() {
-        public Boolean apply(ConnectionProperty connectionProperty, String s) {
-          if (s == null) {
-            throw new RuntimeException("Required property '"
-                + connectionProperty.camelName() + "' not specified");
-          }
-          return Boolean.parseBoolean(s);
-        }
-      };
-
-  static final Map<String, BigDecimal> MULTIPLIER_MAP =
-      new LinkedHashMap<>();
-  static {
-    MULTIPLIER_MAP.put("k", new BigDecimal(1024));
-    MULTIPLIER_MAP.put("K", new BigDecimal(1024));
-    MULTIPLIER_MAP.put("m", new BigDecimal(1024 * 1024));
-    MULTIPLIER_MAP.put("M", new BigDecimal(1024 * 1024));
-    MULTIPLIER_MAP.put("g", new BigDecimal(1024 * 1024 * 1024));
-    MULTIPLIER_MAP.put("G", new BigDecimal(1024 * 1024 * 1024));
-  }
-
-  public static final Converter<Number> NUMBER_CONVERTER =
-      new Converter<Number>() {
-        public Number apply(ConnectionProperty connectionProperty, String s) {
-          if (s == null) {
-            throw new RuntimeException("Required property '"
-                + connectionProperty.camelName() + "' not specified");
-          }
-          BigDecimal multiplier = BigDecimal.ONE;
-          for (Map.Entry<String, BigDecimal> e : MULTIPLIER_MAP.entrySet()) {
-            if (s.endsWith(e.getKey())) {
-              multiplier = e.getValue();
-              s = s.substring(0, s.length() - e.getKey().length());
-            }
-          }
-          return new BigDecimal(s).multiply(multiplier);
-        }
-      };
-
-  public static final Converter<String> IDENTITY_CONVERTER =
-      new Converter<String>() {
-        public String apply(ConnectionProperty connectionProperty, String s) {
-          return s;
-        }
-      };
-
-  public static <E extends Enum> Converter<E> enumConverter(
-      final Class<E> enumClass) {
-    return new Converter<E>() {
-      public E apply(ConnectionProperty connectionProperty, String s) {
-        if (s == null) {
-          throw new RuntimeException("Required property '"
-              + connectionProperty.camelName() + "' not specified");
-        }
-        try {
-          return (E) Enum.valueOf(enumClass, s);
-        } catch (IllegalArgumentException e) {
-          // Case insensitive match is OK too.
-          for (E c : enumClass.getEnumConstants()) {
-            if (c.name().equalsIgnoreCase(s)) {
-              return c;
-            }
-          }
-          throw new RuntimeException("Property '" + s + "' not valid for enum "
-              + enumClass.getName());
-        }
-      }
-    };
-  }
-
-  public static <T> Converter<T> pluginConverter(final Class<T> pluginClass,
-      final T defaultInstance) {
-    return new Converter<T>() {
-      public T apply(ConnectionProperty connectionProperty, String s) {
-        if (s == null) {
-          if (defaultInstance != null) {
-            return defaultInstance;
-          }
-          if (!connectionProperty.required()) {
-            return null;
-          }
-          throw new RuntimeException("Required property '"
-              + connectionProperty.camelName() + "' not specified");
-        }
-        return AvaticaUtils.instantiatePlugin(pluginClass, s);
-      }
-    };
-  }
-}
-
-// End ConnectionConfigImpl.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java
deleted file mode 100644
index c147ecc..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.proto.Common;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Objects;
-
-/** Concrete implementation of {@link Meta.ConnectionProperties}. Provides additional state
- * tracking to enable {@code RemoteMeta} to lazily push changes up to a query server.
- *
- * <p>{@code Meta} instances should probably hold authority on the {@code isDirty}
- * flag because {@code AvaticaConnection} instances have no way of knowing if they're local or
- * remote.
- */
-public class ConnectionPropertiesImpl implements Meta.ConnectionProperties {
-  private static final FieldDescriptor CATALOG_DESCRIPTOR = Common.ConnectionProperties
-      .getDescriptor().findFieldByNumber(Common.ConnectionProperties.CATALOG_FIELD_NUMBER);
-  private static final FieldDescriptor SCHEMA_DESCRIPTOR = Common.ConnectionProperties
-      .getDescriptor().findFieldByNumber(Common.ConnectionProperties.SCHEMA_FIELD_NUMBER);
-  private static final FieldDescriptor TRANSACTION_ISOLATION_DESCRIPTOR = Common
-      .ConnectionProperties.getDescriptor().findFieldByNumber(
-          Common.ConnectionProperties.TRANSACTION_ISOLATION_FIELD_NUMBER);
-
-  private boolean isDirty = false;
-  private Boolean autoCommit;
-  private Boolean readOnly;
-  private Integer transactionIsolation;
-  private String catalog;
-  private String schema;
-
-  // TODO: replace with Meta.ConnectionProperties$EMPTY instance?
-  public ConnectionPropertiesImpl() {}
-
-  public ConnectionPropertiesImpl(Connection conn) throws SQLException {
-    this(conn.getAutoCommit(), conn.isReadOnly(), conn.getTransactionIsolation(),
-        conn.getCatalog(), conn.getSchema());
-  }
-
-  @JsonCreator
-  public ConnectionPropertiesImpl(
-      @JsonProperty("autoCommit") Boolean autoCommit,
-      @JsonProperty("readOnly") Boolean readOnly,
-      @JsonProperty("transactionIsolation") Integer transactionIsolation,
-      @JsonProperty("catalog") String catalog,
-      @JsonProperty("schema") String schema) {
-    this.autoCommit = autoCommit;
-    this.readOnly = readOnly;
-    this.transactionIsolation = transactionIsolation;
-    this.catalog = catalog;
-    this.schema = schema;
-  }
-
-  public ConnectionPropertiesImpl setDirty(boolean val) {
-    this.isDirty = val;
-    return this;
-  }
-
-  public boolean isDirty() {
-    return this.isDirty;
-  }
-
-  @Override public boolean isEmpty() {
-    return autoCommit == null && readOnly == null && transactionIsolation == null
-        && catalog == null && schema == null;
-  }
-
-  /** Overwrites fields in {@code this} with any non-null fields in {@code that}. Sets
-   * {@code isDirty} if any fields are changed.
-   *
-   * @return {@code this}
-   */
-  @Override public ConnectionPropertiesImpl merge(Meta.ConnectionProperties that) {
-    if (this == that) {
-      return this;
-    }
-    if (that.isAutoCommit() != null && this.autoCommit != that.isAutoCommit()) {
-      this.autoCommit = that.isAutoCommit();
-      this.isDirty = true;
-    }
-    if (that.isReadOnly() != null && this.readOnly != that.isReadOnly()) {
-      this.readOnly = that.isReadOnly();
-      this.isDirty = true;
-    }
-    if (that.getTransactionIsolation() != null
-        && !that.getTransactionIsolation().equals(this.transactionIsolation)) {
-      this.transactionIsolation = that.getTransactionIsolation();
-      this.isDirty = true;
-    }
-    if (that.getCatalog() != null && !that.getCatalog().equalsIgnoreCase(this.catalog)) {
-      this.catalog = that.getCatalog();
-      this.isDirty = true;
-    }
-    if (that.getSchema() != null && !that.getSchema().equalsIgnoreCase(this.schema)) {
-      this.schema = that.getSchema();
-      this.isDirty = true;
-    }
-    return this;
-  }
-
-  /** Sets {@code autoCommit} status and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setAutoCommit(boolean val) {
-    this.autoCommit = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  @Override public Boolean isAutoCommit() {
-    return this.autoCommit;
-  }
-
-  /** Sets {@code readOnly} status and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setReadOnly(boolean val) {
-    this.readOnly = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  @Override public Boolean isReadOnly() {
-    return this.readOnly;
-  }
-
-  /** Sets {@code transactionIsolation} status and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setTransactionIsolation(int val) {
-    this.transactionIsolation = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  public Integer getTransactionIsolation() {
-    return this.transactionIsolation;
-  }
-
-  /** Sets {@code catalog} and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setCatalog(String val) {
-    this.catalog = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  @Override public String getCatalog() {
-    return this.catalog;
-  }
-
-  /** Sets {@code schema} and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setSchema(String val) {
-    this.schema = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  public String getSchema() {
-    return this.schema;
-  }
-
-  @Override public int hashCode() {
-    return Objects.hash(autoCommit, catalog, isDirty, readOnly, schema,
-        transactionIsolation);
-  }
-
-  @Override public boolean equals(Object o) {
-    return o == this
-        || o instanceof ConnectionPropertiesImpl
-        && Objects.equals(autoCommit, ((ConnectionPropertiesImpl) o).autoCommit)
-        && Objects.equals(catalog, ((ConnectionPropertiesImpl) o).catalog)
-        && isDirty == ((ConnectionPropertiesImpl) o).isDirty
-        && Objects.equals(readOnly, ((ConnectionPropertiesImpl) o).readOnly)
-        && Objects.equals(schema, ((ConnectionPropertiesImpl) o).schema)
-        && Objects.equals(transactionIsolation,
-            ((ConnectionPropertiesImpl) o).transactionIsolation);
-  }
-
-  public Common.ConnectionProperties toProto() {
-    Common.ConnectionProperties.Builder builder = Common.ConnectionProperties.newBuilder();
-
-    if (null != autoCommit) {
-      builder.setHasAutoCommit(true);
-      builder.setAutoCommit(autoCommit.booleanValue());
-    } else {
-      // Be explicit to avoid default value confusion
-      builder.setHasAutoCommit(false);
-    }
-
-    if (null != catalog) {
-      builder.setCatalog(catalog);
-    }
-
-    builder.setIsDirty(isDirty);
-
-    if (null != readOnly) {
-      builder.setHasReadOnly(true);
-      builder.setReadOnly(readOnly.booleanValue());
-    } else {
-      // Be explicit to avoid default value confusion
-      builder.setHasReadOnly(false);
-    }
-
-    if (null != schema) {
-      builder.setSchema(schema);
-    }
-
-    if (null != transactionIsolation) {
-      builder.setTransactionIsolation(transactionIsolation.intValue());
-    }
-
-    return builder.build();
-  }
-
-  public static ConnectionPropertiesImpl fromProto(Common.ConnectionProperties proto) {
-    String catalog = null;
-    if (proto.hasField(CATALOG_DESCRIPTOR)) {
-      catalog = proto.getCatalog();
-    }
-
-    String schema = null;
-    if (proto.hasField(SCHEMA_DESCRIPTOR)) {
-      schema = proto.getSchema();
-    }
-
-    Boolean autoCommit = null;
-    if (proto.getHasAutoCommit()) {
-      autoCommit = Boolean.valueOf(proto.getAutoCommit());
-    }
-
-    Boolean readOnly = null;
-    if (proto.getHasReadOnly()) {
-      readOnly = Boolean.valueOf(proto.getReadOnly());
-    }
-
-    Integer transactionIsolation = null;
-    if (proto.hasField(TRANSACTION_ISOLATION_DESCRIPTOR)) {
-      transactionIsolation = Integer.valueOf(proto.getTransactionIsolation());
-    }
-
-    ConnectionPropertiesImpl impl = new ConnectionPropertiesImpl(autoCommit, readOnly,
-        transactionIsolation, catalog, schema);
-
-    impl.setDirty(proto.getIsDirty());
-
-    return impl;
-  }
-}
-
-// End ConnectionPropertiesImpl.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java
deleted file mode 100644
index b41b9a3..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import java.util.Properties;
-
-/**
- * Definition of a property that may be specified on the JDBC connect string.
- * {@link BuiltInConnectionProperty} enumerates built-in properties, but
- * there may be others; the list is not closed.
- */
-public interface ConnectionProperty {
-  /** The name of this property. (E.g. "MATERIALIZATIONS_ENABLED".) */
-  String name();
-
-  /** The name of this property in camel-case.
-   * (E.g. "materializationsEnabled".) */
-  String camelName();
-
-  /** Returns the default value of this property. The type must match its data
-   * type. */
-  Object defaultValue();
-
-  /** Returns the data type of this property. */
-  Type type();
-
-  /** Wraps this property with a properties object from which its value can be
-   * obtained when needed. */
-  ConnectionConfigImpl.PropEnv wrap(Properties properties);
-
-  /** Whether the property is mandatory. */
-  boolean required();
-
-  /** Class of values that this property can take. Most useful for
-   * {@link Type#ENUM} properties. */
-  Class valueClass();
-
-  /** Data type of property. */
-  enum Type {
-    BOOLEAN,
-    STRING,
-    NUMBER,
-    ENUM,
-    PLUGIN;
-
-    /** Deduces the class of a property of this type, given the default value
-     * and the user-specified value class (each of which may be null, unless
-     * this is an enum or a plugin). */
-    public Class deduceValueClass(Object defaultValue, Class valueClass) {
-      if (valueClass != null) {
-        return valueClass;
-      }
-      if (defaultValue != null) {
-        final Class<?> c = defaultValue.getClass();
-        if (c.isAnonymousClass()) {
-          // for default values that are anonymous enums
-          return c.getSuperclass();
-        }
-        return c;
-      }
-      return defaultValueClass();
-    }
-
-    /** Returns whether a default value and value types are valid for this
-     * kind of property. */
-    public boolean valid(Object defaultValue, Class clazz) {
-      switch (this) {
-      case BOOLEAN:
-        return clazz == Boolean.class
-            && (defaultValue == null || defaultValue instanceof Boolean);
-      case NUMBER:
-        return Number.class.isAssignableFrom(clazz)
-            && (defaultValue == null || defaultValue instanceof Number);
-      case STRING:
-        return clazz == String.class
-            && (defaultValue == null || defaultValue instanceof String);
-      case PLUGIN:
-        return clazz != null
-            && (defaultValue == null || defaultValue instanceof String);
-      case ENUM:
-        return Enum.class.isAssignableFrom(clazz)
-            && (defaultValue == null || clazz.isInstance(defaultValue));
-      default:
-        throw new AssertionError();
-      }
-    }
-
-    public Class defaultValueClass() {
-      switch (this) {
-      case BOOLEAN:
-        return Boolean.class;
-      case NUMBER:
-        return Number.class;
-      case STRING:
-        return String.class;
-      case PLUGIN:
-        return Object.class;
-      default:
-        throw new AssertionError("must specify value class for an ENUM");
-      }
-    }
-  }
-}
-
-// End ConnectionProperty.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java b/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
deleted file mode 100644
index 15c966a..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * Driver version information.
- *
- * <p>Each driver implementation must provide an instance of this class, in
- * order to implement {@link UnregisteredDriver#createDriverVersion()}.</p>
- *
- * <p>There are two typical ways for a driver to instantiate its version
- * information:</p>
- *
- * <ul>
- *
- * <li>A driver might create a subclass in a with a constructor that provides
- * all of the arguments for the base class. The instance is held in a separate
- * file, so that that version information can be generated.</li>
- *
- * <li>A driver might store the version information in a .properties file and
- * load it using {@link #load}.</li>
- *
- * </ul>
- */
-public class DriverVersion {
-  public final int majorVersion;
-  public final int minorVersion;
-  public final String name;
-  public final String versionString;
-  public final String productName;
-  public final String productVersion;
-  public final boolean jdbcCompliant;
-  public final int databaseMajorVersion;
-  public final int databaseMinorVersion;
-
-  /** Creates a DriverVersion. */
-  public DriverVersion(
-      String name,
-      String versionString,
-      String productName,
-      String productVersion,
-      boolean jdbcCompliant,
-      int majorVersion,
-      int minorVersion,
-      int databaseMajorVersion,
-      int databaseMinorVersion) {
-    this.majorVersion = majorVersion;
-    this.minorVersion = minorVersion;
-    this.name = name;
-    this.versionString = versionString;
-    this.productName = productName;
-    this.productVersion = productVersion;
-    this.jdbcCompliant = jdbcCompliant;
-    this.databaseMajorVersion = databaseMajorVersion;
-    this.databaseMinorVersion = databaseMinorVersion;
-  }
-
-  /** Loads a driver version from a properties file, read from the classpath.
-   * The arguments provide defaults if the properties cannot be loaded.
-   *
-   * @param driverClass Class of driver; used to find resource
-   * @param resourceName Name of resource file
-   * @param driverName Fallback name of driver
-   * @param driverVersion Fallback version of driver
-   * @param productName Fallback product name
-   * @param productVersion Fallback product version
-   * @return A populated driver version object, never null
-   */
-  public static DriverVersion load(
-      Class<? extends UnregisteredDriver> driverClass,
-      String resourceName,
-      String driverName,
-      String driverVersion,
-      String productName,
-      String productVersion) {
-    boolean jdbcCompliant = true;
-    int majorVersion = 0;
-    int minorVersion = 0;
-    int databaseMajorVersion = 0;
-    int databaseMinorVersion = 0;
-    try {
-      final InputStream inStream =
-          driverClass.getClassLoader().getResourceAsStream(resourceName);
-      if (inStream != null) {
-        final Properties properties = new Properties();
-        properties.load(inStream);
-        driverName = properties.getProperty("driver.name");
-        driverVersion = properties.getProperty("driver.version");
-        productName = properties.getProperty("product.name");
-        productVersion = properties.getProperty("product.version");
-        jdbcCompliant =
-            Boolean.valueOf(properties.getProperty("jdbc.compliant"));
-        String[] s = driverVersion.replaceAll("-.*$", "").split("\\.");
-        final int major = Integer.valueOf(s[0]);
-        final int minor = Integer.valueOf(s[1]);
-        try {
-          majorVersion =
-              Integer.valueOf(properties.getProperty("driver.version.major"));
-        } catch (NumberFormatException e) {
-          majorVersion = major;
-        }
-        try {
-          minorVersion =
-              Integer.valueOf(properties.getProperty("driver.version.minor"));
-        } catch (NumberFormatException e) {
-          minorVersion = minor;
-        }
-        try {
-          databaseMajorVersion =
-              Integer.valueOf(properties.getProperty("database.version.major"));
-        } catch (NumberFormatException e) {
-          databaseMajorVersion = major;
-        }
-        try {
-          databaseMinorVersion =
-              Integer.valueOf(properties.getProperty("database.version.minor"));
-        } catch (NumberFormatException e) {
-          databaseMinorVersion = minor;
-        }
-      }
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-    return new DriverVersion(
-        driverName, driverVersion, productName, productVersion,
-        jdbcCompliant, majorVersion, minorVersion, databaseMajorVersion,
-        databaseMinorVersion);
-  }
-}
-
-// End DriverVersion.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java b/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java
deleted file mode 100644
index 831e66d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import java.sql.SQLException;
-
-/**
- * Called at various points in the JDBC lifecycle.
- *
- * <p>Most drivers will use {@link HandlerImpl}, which provides no-op
- * implementations of all methods. You only need to override methods if you
- * need to achieve special effects.</p>
- */
-public interface Handler {
-  /** Called by container when a connection is being created.
-   *
-   * <p>If the implementation of this method throws, the connection
-   * will not be created.</p>
-   *
-   * @param connection Connection
-   * @throws SQLException on error
-   */
-  void onConnectionInit(AvaticaConnection connection) throws SQLException;
-
-  /** Called by container when a connection is being closed.
-   *
-   * <p>If the implementation of this method throws, the call to
-   * {@link java.sql.Connection#close} that triggered this method will throw an
-   * exception, but the connection will still be marked closed.</p>
-   *
-   * @param connection Connection
-   */
-  void onConnectionClose(AvaticaConnection connection);
-
-  /** Called by container when a statement is being executed.
-   *
-   * <p>If the session would like the statement results stored in a temporary
-   * table, {@code resultSink} is not null.
-   * The provider must call its {@link ResultSink#toBeCompleted}
-   * method at some point during execution (not necessarily before the call to
-   * this method returns).</p>
-   *
-   * @param statement Statement
-   * @param resultSink Place to put result of query. Null if container does not
-   *                   want results stored to a temporary table
-   * @throws RuntimeException on error
-   */
-  void onStatementExecute(
-      AvaticaStatement statement,
-      ResultSink resultSink);
-
-  /** Called by container when a statement is being closed.
-   *
-   * <p>This method is called after marking the statement closed, and after
-   * closing any open {@link java.sql.ResultSet} objects.</p>
-   *
-   * <p>If the implementation of this method throws, the call to
-   * {@link java.sql.Statement#close} that triggered this method will throw an
-   * exception, but the statement will still be marked closed.
-   *
-   * @param statement Statement
-   * @throws RuntimeException on error
-   */
-  void onStatementClose(AvaticaStatement statement);
-
-  /** Handler for temporary tables. */
-  interface ResultSink {
-    /** Registers a temporary table. */
-    void toBeCompleted();
-  }
-}
-
-// End Handler.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java
deleted file mode 100644
index c2e6c1a..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import java.sql.SQLException;
-
-/**
- * Implementation of {@link Handler} that does nothing for each callback.
- * It is recommended implementations of {@code Handler} use this as a base
- * class, to ensure forward compatibility.
- */
-public class HandlerImpl implements Handler {
-  public void onConnectionInit(AvaticaConnection connection)
-      throws SQLException {
-    // nothing
-  }
-
-  public void onConnectionClose(AvaticaConnection connection) {
-    // nothing
-  }
-
-  public void onStatementExecute(
-      AvaticaStatement statement,
-      ResultSink resultSink) {
-    // nothing
-  }
-
-  public void onStatementClose(AvaticaStatement statement) {
-    // nothing
-  }
-}
-
-// End HandlerImpl.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java b/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java
deleted file mode 100644
index 27c6056..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import java.sql.SQLClientInfoException;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-
-/**
- * Utility methods, mainly concerning error-handling.
- */
-public class Helper {
-  public static final Helper INSTANCE = new Helper();
-
-  private Helper() {
-  }
-
-  public RuntimeException todo() {
-    return new RuntimeException("todo: implement this method");
-  }
-
-  public RuntimeException wrap(String message, Exception e) {
-    return new RuntimeException(message, e);
-  }
-
-  public SQLException createException(String message, Exception e) {
-    return createException(message, null, e);
-  }
-
-  public SQLException createException(String message, String sql, Exception e) {
-    if (e instanceof AvaticaClientRuntimeException) {
-      // The AvaticaClientRuntimeException contains extra information about what/why
-      // the exception was thrown that we can pass back to the user.
-      AvaticaClientRuntimeException rte = (AvaticaClientRuntimeException) e;
-      String serverAddress = null;
-      if (null != rte.getRpcMetadata()) {
-        serverAddress = rte.getRpcMetadata().serverAddress;
-      }
-      return new AvaticaSqlException(message, rte.getSqlState(), rte.getErrorCode(),
-          rte.getServerExceptions(), serverAddress);
-    }
-    return new SQLException(message, e);
-  }
-
-  public SQLException createException(String message) {
-    return new SQLException(message);
-  }
-
-  public SQLException toSQLException(SQLException exception) {
-    return exception;
-  }
-
-  public SQLException unsupported() {
-    return new SQLFeatureNotSupportedException();
-  }
-
-  public SQLClientInfoException clientInfo() {
-    return new SQLClientInfoException();
-  }
-}
-
-// End Helper.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/5289d343/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java b/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java
deleted file mode 100644
index a5a3852..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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 org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.ConnectionProperty.Type;
-import org.apache.calcite.avatica.util.Casing;
-import org.apache.calcite.avatica.util.Quoting;
-
-import java.util.Map;
-
-/**
- * Definitions of properties that drive the behavior of
- * {@link org.apache.calcite.avatica.AvaticaDatabaseMetaData}.
- */
-public enum InternalProperty {
-  /** Whether identifiers are matched case-sensitively. */
-  CASE_SENSITIVE(Type.BOOLEAN, true),
-
-  /** Character that quotes identifiers. */
-  SQL_KEYWORDS(Type.STRING, null),
-
-  /** How identifiers are quoted. */
-  QUOTING(Quoting.class, Quoting.DOUBLE_QUOTE),
-
-  /** How identifiers are stored if they are quoted. */
-  QUOTED_CASING(Casing.class, Casing.UNCHANGED),
-
-  /** How identifiers are stored if they are not quoted. */
-  UNQUOTED_CASING(Casing.class, Casing.TO_UPPER),
-
-  /** How identifiers are stored if they are not quoted. */
-  NULL_SORTING(NullSorting.class, NullSorting.END);
-
-  private final Type type;
-  private final Class enumClass;
-  private final Object defaultValue;
-
-  /** Creates an InternalProperty based on an enum. */
-  <E extends Enum> InternalProperty(Class<E> enumClass, E defaultValue) {
-    this(Type.ENUM, enumClass, defaultValue);
-  }
-
-  /** Creates an InternalProperty based on a non-enum type. */
-  InternalProperty(Type type, Object defaultValue) {
-    this(type, null, defaultValue);
-  }
-
-  private InternalProperty(Type type, Class enumClass, Object defaultValue) {
-    this.type = type;
-    this.enumClass = enumClass;
-    this.defaultValue = defaultValue;
-  }
-
-  private <T> T get_(Map<InternalProperty, Object> map, T defaultValue) {
-    final Object s = map.get(this);
-    if (s != null) {
-      return (T) s;
-    }
-    if (defaultValue != null) {
-      return (T) defaultValue;
-    }
-    throw new RuntimeException("Required property '" + name()
-        + "' not specified");
-  }
-
-  /** Returns the string value of this property, or null if not specified and
-   * no default. */
-  public String getString(Map<InternalProperty, Object> map) {
-    assert type == Type.STRING;
-    return get_(map, (String) defaultValue);
-  }
-
-  /** Returns the boolean value of this property. Throws if not set and no
-   * default. */
-  public boolean getBoolean(Map<InternalProperty, Object> map) {
-    assert type == Type.BOOLEAN;
-    return get_(map, (Boolean) defaultValue);
-  }
-
-  /** Returns the enum value of this property. Throws if not set and no
-   * default. */
-  public <E extends Enum> E getEnum(Map<InternalProperty, Object> map,
-      Class<E> enumClass) {
-    assert type == Type.ENUM;
-    //noinspection unchecked
-    return get_(map, (E) defaultValue);
-  }
-
-  /** Where nulls appear in a sorted relation. */
-  enum NullSorting {
-    START, END, LOW, HIGH,
-  }
-}
-
-// End InternalProperty.java