http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/pom.xml b/avatica/pom.xml
deleted file mode 100644
index 5860bd9..0000000
--- a/avatica/pom.xml
+++ /dev/null
@@ -1,815 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache</groupId>
-    <artifactId>apache</artifactId>
-    <version>18</version>
-    <!-- Tell Maven that it's OK that we're not attached to the parent 
directory -->
-    <relativePath />
-  </parent>
-
-  <!-- The basics. -->
-  <groupId>org.apache.calcite.avatica</groupId>
-  <artifactId>avatica-parent</artifactId>
-  <packaging>pom</packaging>
-  <version>1.10.0-SNAPSHOT</version>
-
-  <!-- More project information. -->
-  <name>Apache Calcite Avatica Project</name>
-  <description>Avatica is a JDBC driver framework which is a part of Apache 
Calcite</description>
-  <url>https://calcite.apache.org/avatica</url>
-  <inceptionYear>2012</inceptionYear>
-
-  <mailingLists>
-    <mailingList>
-      <name>Apache Calcite developers list</name>
-      <subscribe>[email protected]</subscribe>
-      <unsubscribe>[email protected]</unsubscribe>
-      <post>[email protected]</post>
-      <archive>https://mail-archives.apache.org/mod_mbox/calcite-dev</archive>
-    </mailingList>
-  </mailingLists>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <top.dir>${project.basedir}</top.dir>
-    <avatica.release.version>${project.version}</avatica.release.version>
-    <version.major>1</version.major>
-    <version.minor>9</version.minor>
-    <!-- This list is in alphabetical order. -->
-    <bouncycastle.version>1.55</bouncycastle.version>
-    <build-helper-maven-plugin.version>1.9</build-helper-maven-plugin.version>
-    <checksum-maven-plugin.version>1.2</checksum-maven-plugin.version>
-    <dropwizard-metrics3.version>3.1.2</dropwizard-metrics3.version>
-    <forbiddenapis.version>2.3</forbiddenapis.version>
-    <freemarker.version>2.3.19</freemarker.version>
-    <git-commit-id-plugin.version>2.1.9</git-commit-id-plugin.version>
-    <!-- We support guava versions as old as 14.0.1 (the version used by Hive)
-         but prefer more recent versions. -->
-    <guava.version>14.0.1</guava.version>
-    <h2.version>1.4.185</h2.version>
-    <hamcrest.version>1.3</hamcrest.version>
-    <hsqldb.version>2.3.1</hsqldb.version>
-    <httpclient.version>4.5.2</httpclient.version>
-    <httpcore.version>4.4.4</httpcore.version>
-    <hydromatic-toolbox.version>0.3</hydromatic-toolbox.version>
-    <jackson.version>2.6.3</jackson.version>
-    <jcip-annotations.version>1.0-1</jcip-annotations.version>
-    <jcommander.version>1.48</jcommander.version>
-    <jetty.version>9.2.19.v20160908</jetty.version>
-    <junit.version>4.12</junit.version>
-    <kerby.version>1.0.0-RC2</kerby.version>
-    <maven-checkstyle-plugin.version>2.12.1</maven-checkstyle-plugin.version>
-    <maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
-    <!-- Apache 18 has 2.10.3, need 2.10.4 for [MJAVADOC-442]. -->
-    <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
-    <maven-scm-provider.version>1.9.4</maven-scm-provider.version>
-    <maven-shade-plugin.version>2.1</maven-shade-plugin.version>
-    <mockito.version>2.5.5</mockito.version>
-    <protobuf.version>3.1.0</protobuf.version>
-    <scott-data-hsqldb.version>0.1</scott-data-hsqldb.version>
-    <servlet.version>3.0.1</servlet.version>
-    <slf4j.version>1.7.13</slf4j.version>
-  </properties>
-
-  <issueManagement>
-    <system>Jira</system>
-    <url>https://issues.apache.org/jira/browse/CALCITE</url>
-  </issueManagement>
-
-  <scm>
-    
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/calcite.git</connection>
-    
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/calcite.git</developerConnection>
-    <url>https://github.com/apache/calcite</url>
-    <tag>HEAD</tag>
-  </scm>
-
-  <modules>
-    <module>core</module>
-    <module>metrics</module>
-    <module>metrics-dropwizardmetrics3</module>
-    <module>noop-driver</module>
-    <module>server</module>
-    <module>tck</module>
-    <module>standalone-server</module>
-    <module>shaded/core</module>
-  </modules>
-
-  <!-- No dependencies here. Declare dependency VERSIONS in
-       dependencyManagement, below, and each dependency in the module that uses
-       it. -->
-  <dependencies />
-
-  <dependencyManagement>
-    <dependencies>
-      <!-- Sorted by groupId, artifactId; calcite dependencies first. -->
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-core</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-metrics</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-noop</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-tck</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-server</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-core</artifactId>
-        <version>${project.version}</version>
-        <type>test-jar</type>
-      </dependency>
-
-      <!-- Now third-party dependencies, sorted by groupId and artifactId. -->
-      <dependency>
-        <groupId>com.beust</groupId>
-        <artifactId>jcommander</artifactId>
-        <version>${jcommander.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.fasterxml.jackson.core</groupId>
-        <artifactId>jackson-core</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.fasterxml.jackson.core</groupId>
-        <artifactId>jackson-annotations</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.fasterxml.jackson.core</groupId>
-        <artifactId>jackson-databind</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.github.stephenc.jcip</groupId>
-        <artifactId>jcip-annotations</artifactId>
-        <version>${jcip-annotations.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.google.guava</groupId>
-        <artifactId>guava</artifactId>
-        <version>${guava.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.google.protobuf</groupId>
-        <artifactId>protobuf-java</artifactId>
-        <version>${protobuf.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.h2database</groupId>
-        <artifactId>h2</artifactId>
-        <version>${h2.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>javax.servlet</groupId>
-        <artifactId>javax.servlet-api</artifactId>
-        <version>${servlet.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>junit</groupId>
-        <artifactId>junit</artifactId>
-        <version>${junit.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>net.hydromatic</groupId>
-        <artifactId>scott-data-hsqldb</artifactId>
-        <version>${scott-data-hsqldb.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.kerby</groupId>
-        <artifactId>kerb-client</artifactId>
-        <version>${kerby.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.kerby</groupId>
-        <artifactId>kerb-core</artifactId>
-        <version>${kerby.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.kerby</groupId>
-        <artifactId>kerb-simplekdc</artifactId>
-        <version>${kerby.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.httpcomponents</groupId>
-        <artifactId>httpclient</artifactId>
-        <version>${httpclient.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.httpcomponents</groupId>
-        <artifactId>httpcore</artifactId>
-        <version>${httpcore.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.bouncycastle</groupId>
-        <artifactId>bcpkix-jdk15on</artifactId>
-        <version>${bouncycastle.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.bouncycastle</groupId>
-        <artifactId>bcprov-jdk15on</artifactId>
-        <version>${bouncycastle.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.mockito</groupId>
-        <artifactId>mockito-core</artifactId>
-        <version>${mockito.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.hamcrest</groupId>
-        <artifactId>hamcrest-core</artifactId>
-        <version>${hamcrest.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.hsqldb</groupId>
-        <artifactId>hsqldb</artifactId>
-        <version>${hsqldb.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-security</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-server</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-util</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-api</artifactId>
-        <version>${slf4j.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-log4j12</artifactId>
-        <version>${slf4j.version}</version>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
-  <build>
-    <extensions>
-      <extension>
-        <groupId>kr.motd.maven</groupId>
-        <artifactId>os-maven-plugin</artifactId>
-        <version>1.5.0.Final</version>
-      </extension>
-    </extensions>
-    <plugins>
-      <plugin>
-        <groupId>de.thetaphi</groupId>
-        <artifactId>forbiddenapis</artifactId>
-        <configuration>
-          <!-- if the used Java version is too new, don't fail, just do 
nothing: -->
-          <failOnUnsupportedJava>false</failOnUnsupportedJava>
-          <bundledSignatures>
-            <!--
-              This will automatically choose the right
-              signatures based on 'maven.compiler.target':
-            -->
-            <bundledSignature>jdk-unsafe</bundledSignature>
-            <bundledSignature>jdk-deprecated</bundledSignature>
-            <!-- disallow undocumented classes like sun.misc.Unsafe: -->
-            <bundledSignature>jdk-non-portable</bundledSignature>
-          </bundledSignatures>
-          <signaturesFiles>
-            
<signaturesFile>${top.dir}/src/main/config/forbidden-apis/signatures.txt</signaturesFile>
-          </signaturesFiles>
-          <excludes>
-            <exclude>**/org/apache/calcite/avatica/tck/Unsafe.class</exclude>
-            <exclude>**/org/apache/calcite/avatica/util/Unsafe.class</exclude>
-          </excludes>
-        </configuration>
-        <executions>
-          <execution>
-            <goals>
-              <goal>check</goal>
-              <goal>testCheck</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <!-- Do not exclude site/target; it should not exist
-                 in any sandbox from which you are making a
-                 release. Also, do not exclude site/.sass-cache. -->
-            <!-- Files generated by Jekyll. -->
-            <exclude>site/_includes/anchor_links.html</exclude>
-            <exclude>site/_includes/docs_contents.html</exclude>
-            <exclude>site/_includes/docs_contents_mobile.html</exclude>
-            <exclude>site/_includes/docs_option.html</exclude>
-            <exclude>site/_includes/docs_ul.html</exclude>
-            <exclude>site/_includes/footer.html</exclude>
-            <exclude>site/_includes/header.html</exclude>
-            <exclude>site/_includes/news_contents.html</exclude>
-            <exclude>site/_includes/news_contents_mobile.html</exclude>
-            <exclude>site/_includes/news_item.html</exclude>
-            <exclude>site/_includes/primary-nav-items.html</exclude>
-            <exclude>site/_includes/section_nav.html</exclude>
-            <exclude>site/_includes/top.html</exclude>
-            <exclude>site/_layouts/default.html</exclude>
-            <exclude>site/_layouts/docs.html</exclude>
-            <exclude>site/_layouts/external.html</exclude>
-            <exclude>site/_layouts/news.html</exclude>
-            <exclude>site/_layouts/news_item.html</exclude>
-            <exclude>site/_layouts/page.html</exclude>
-            <exclude>site/_sass/**</exclude>
-            <exclude>site/css/screen.scss</exclude>
-            <exclude>site/fonts/**</exclude>
-            <exclude>site/js/**</exclude>
-            <!-- Images -->
-            <exclude>site/img/*.png</exclude>
-            <exclude>site/favicon.ico</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-          <compilerArgument>-Xlint:deprecation</compilerArgument>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>validate</id>
-            <phase>validate</phase>
-            <configuration>
-              
<configLocation>${top.dir}/src/main/config/checkstyle/checker.xml</configLocation>
-              
<suppressionsLocation>${top.dir}/src/main/config/checkstyle/suppressions.xml</suppressionsLocation>
-              <consoleOutput>true</consoleOutput>
-              
<headerLocation>${top.dir}/src/main/config/checkstyle/header.txt</headerLocation>
-              <failOnViolation>true</failOnViolation>
-              <includeTestSourceDirectory>true</includeTestSourceDirectory>
-            </configuration>
-            <goals>
-              <goal>check</goal>
-            </goals>
-          </execution>
-        </executions>
-        <dependencies>
-          <dependency>
-            <groupId>net.hydromatic</groupId>
-            <artifactId>toolbox</artifactId>
-            <version>${hydromatic-toolbox.version}</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-      <plugin>
-        <!-- override default version 2.8 for access to additional config 
settings -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <!-- This is the configuration used by "mvn javadoc:javadoc". It is
-             configured strict, so that it shows errors such as broken links in
-             javadoc on private methods. The configuration for "mvn site" is
-             under "reporting", and is more lenient. -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <configuration>
-          <links>
-            <link>https://docs.oracle.com/javase/8/docs/api/</link>
-          </links>
-          <show>private</show>
-        </configuration>
-      </plugin>
-      <plugin>
-        <!-- Override apache parent POM's definition of release
-             plugin. If we don't specify gitexe version, git doesn't
-             commit during release process. -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-release-plugin</artifactId>
-        <dependencies>
-          <dependency>
-            <groupId>org.apache.maven.scm</groupId>
-            <artifactId>maven-scm-provider-gitexe</artifactId>
-            <version>${maven-scm-provider.version}</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <!-- Make sure every sub-project has LICENSE, NOTICE and
-             git.properties in its jar's META-INF directory. -->
-        <executions>
-          <execution>
-            <id>add-resource</id>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>add-resource</goal>
-              <goal>add-test-resource</goal>
-            </goals>
-            <configuration>
-              <resources>
-                <resource>
-                  <directory>${top.dir}</directory>
-                  <targetPath>META-INF</targetPath>
-                  <includes>
-                    <include>LICENSE</include>
-                    <include>NOTICE</include>
-                  </includes>
-                </resource>
-                <resource>
-                  <directory>${top.dir}/target</directory>
-                  <targetPath>META-INF</targetPath>
-                  <includes>
-                    <include>git.properties</include>
-                  </includes>
-                </resource>
-              </resources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-
-    <pluginManagement>
-      <plugins>
-        <!-- Sorted by groupId, artifactId. -->
-        <plugin>
-          <groupId>com.googlecode.fmpp-maven-plugin</groupId>
-          <artifactId>fmpp-maven-plugin</artifactId>
-          <version>${fmpp-maven-plugin.version}</version>
-          <dependencies>
-            <dependency>
-              <groupId>org.freemarker</groupId>
-              <artifactId>freemarker</artifactId>
-              <version>${freemarker.version}</version>
-            </dependency>
-          </dependencies>
-        </plugin>
-        <plugin>
-          <groupId>de.thetaphi</groupId>
-          <artifactId>forbiddenapis</artifactId>
-          <version>${forbiddenapis.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>net.hydromatic</groupId>
-          <artifactId>hydromatic-resource-maven-plugin</artifactId>
-          <version>${hydromatic-resource.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>net.ju-n.maven.plugins</groupId>
-          <artifactId>checksum-maven-plugin</artifactId>
-          <version>${checksum-maven-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>${maven-checkstyle-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-failsafe-plugin</artifactId>
-          <executions>
-            <execution>
-              <id>failsafe-integration-test</id>
-              <goals>
-                <goal>integration-test</goal>
-              </goals>
-              <phase>integration-test</phase>
-              <configuration>
-                <threadCount>6</threadCount>
-                <parallel>both</parallel>
-                <argLine>-Xmx1024m</argLine>
-              </configuration>
-            </execution>
-            <execution>
-              <id>failsafe-verify</id>
-              <goals>
-                <goal>verify</goal>
-              </goals>
-              <phase>verify</phase>
-            </execution>
-          </executions>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-javadoc-plugin</artifactId>
-          <version>${maven-javadoc-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-shade-plugin</artifactId>
-          <version>${maven-shade-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-source-plugin</artifactId>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <configuration>
-            <argLine>-Xmx1536m -XX:MaxPermSize=256m 
-Duser.timezone=${user.timezone}</argLine>
-          </configuration>
-        </plugin>
-        <plugin>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>build-helper-maven-plugin</artifactId>
-          <version>${build-helper-maven-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>javacc-maven-plugin</artifactId>
-          <version>${javacc-maven-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>pl.project13.maven</groupId>
-          <artifactId>git-commit-id-plugin</artifactId>
-          <version>${git-commit-id-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.xolstice.maven.plugins</groupId>
-          <artifactId>protobuf-maven-plugin</artifactId>
-          <version>0.5.0</version>
-          <configuration>
-            
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
-            <protoSourceRoot>${basedir}/src/main/protobuf/</protoSourceRoot>
-            <outputDirectory>${basedir}/src/main/java/</outputDirectory>
-            <clearOutputDirectory>false</clearOutputDirectory>
-            <checkStaleness>true</checkStaleness>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <configuration>
-          <links>
-            <link>https://docs.oracle.com/javase/8/docs/api/</link>
-          </links>
-          <notimestamp>true</notimestamp>
-          <windowtitle>Apache Calcite Avatica API</windowtitle>
-        </configuration>
-      </plugin>
-    </plugins>
-  </reporting>
-
-  <repositories>
-    <repository>
-      <id>central</id>
-      <name>Central Repository</name>
-      <url>http://repo.maven.apache.org/maven2</url>
-      <layout>default</layout>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-
-  <profiles>
-    <profile>
-      <!-- This profile adds/overrides few features of the 'apache-release'
-           profile in the parent pom. -->
-      <id>apache-release</id>
-      <build>
-        <plugins>
-          <!-- Apache-RAT checks for files without headers.
-               If run on a messy developer's sandbox, it will fail.
-               This serves as a reminder to only build a release in a clean
-               sandbox! -->
-          <plugin>
-            <groupId>org.apache.rat</groupId>
-            <artifactId>apache-rat-plugin</artifactId>
-            <executions>
-              <execution>
-                <phase>verify</phase>
-                <goals>
-                  <goal>check</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-          <plugin>
-            <groupId>net.ju-n.maven.plugins</groupId>
-            <artifactId>checksum-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>artifacts</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <algorithms>
-                <algorithm>MD5</algorithm>
-                <algorithm>SHA-1</algorithm>
-              </algorithms>
-              <failOnError>false</failOnError>
-            </configuration>
-          </plugin>
-          <!-- Override the parent assembly execution to customize the assembly
-               descriptor and final name. -->
-          <plugin>
-            <artifactId>maven-assembly-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>source-release-assembly</id>
-                <phase>none</phase>
-              </execution>
-              <execution>
-                <id>source-release-assembly-calcite</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>single</goal>
-                </goals>
-                <configuration>
-                  <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
-                  <appendAssemblyId>false</appendAssemblyId>
-                  
<descriptor>${top.dir}/src/main/config/assemblies/source-assembly.xml</descriptor>
-                  
<finalName>apache-calcite-avatica-${project.version}-src</finalName>
-                  <tarLongFileMode>gnu</tarLongFileMode>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-          <plugin>
-            <artifactId>maven-remote-resources-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>root-resources</id>
-                <goals>
-                  <goal>process</goal>
-                </goals>
-                <configuration>
-                  <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
-                  <resourceBundles>
-                    
<resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
-                  </resourceBundles>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <id>it</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-failsafe-plugin</artifactId>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <!-- CALCITE-537: workaround for MRRESOURCES-91
-        Avoid overwrite of the destination file if the produced
-        contents is the same.
-        Apache pom overwrites NOTICE, DEPENDENCIES, and LICENSE files, however
-        we do not want recompile the module every time. -->
-      <id>skip-apache-licenses</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-        
<file><exists>target/maven-shared-archive-resources/META-INF/LICENSE</exists></file>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-remote-resources-plugin</artifactId>
-            <configuration>
-              <skip>true</skip>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <!-- Generate git.properties on first build -->
-      <id>generate-git-id</id>
-      <activation>
-        <activeByDefault>false</activeByDefault>
-        <!-- Note: <missing> here does NOT support interpolation,
-        so technically, this profile is active for sub-modules.
-        It would be nice to use ${top.dir}/target/... here, but
-        it is not possible.
-        However sub-modules lack .git folder, so no git.properties
-        is generated. -->
-        <file>
-          <missing>target/git.properties</missing>
-        </file>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>pl.project13.maven</groupId>
-            <artifactId>git-commit-id-plugin</artifactId>
-            <inherited>false</inherited>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>revision</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
-              <verbose>false</verbose>
-              <skipPoms>false</skipPoms>
-              <generateGitPropertiesFile>true</generateGitPropertiesFile>
-              
<generateGitPropertiesFilename>target/git.properties</generateGitPropertiesFilename>
-              <failOnNoGitDirectory>false</failOnNoGitDirectory>
-              <gitDescribe>
-                <skip>false</skip>
-                <always>false</always>
-                <abbrev>7</abbrev>
-                <dirty>-dirty</dirty>
-                <forceLongFormat>true</forceLongFormat>
-              </gitDescribe>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/server/pom.xml b/avatica/server/pom.xml
deleted file mode 100644
index f2eee25..0000000
--- a/avatica/server/pom.xml
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>avatica-server</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica Server</name>
-  <description>JDBC server.</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <dependencies>
-    <!-- Sorted by groupId, artifactId; calcite dependencies first. Put 
versions
-         in dependencyManagement in the root POM, not here. -->
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-metrics</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>javax.servlet</groupId>
-      <artifactId>javax.servlet-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-security</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-server</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-util</artifactId>
-    </dependency>
-
-    <!-- test dependencies -->
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <!-- Used in RemoteDriverTest but dependency not detected by 
maven-dependency-plugin:2.8:analyze -->
-      <groupId>net.hydromatic</groupId>
-      <artifactId>scott-data-hsqldb</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.kerby</groupId>
-      <artifactId>kerb-client</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.kerby</groupId>
-      <artifactId>kerb-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.kerby</groupId>
-      <artifactId>kerb-simplekdc</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <!-- Used in RemoteDriverTest but dependency not detected by 
maven-dependency-plugin:2.8:analyze -->
-      <groupId>org.hsqldb</groupId>
-      <artifactId>hsqldb</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.github.stephenc.jcip</groupId>
-      <artifactId>jcip-annotations</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.bouncycastle</groupId>
-      <artifactId>bcpkix-jdk15on</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.bouncycastle</groupId>
-      <artifactId>bcprov-jdk15on</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <!-- configurations do not cascade, so all of the definition from
-             ../pom.xml:build:plugin-management:plugins:plugin must be 
repeated in child poms -->
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                
<ignoredUnusedDeclaredDependency>io.dropwizard.metrics:metrics-core</ignoredUnusedDeclaredDependency>
-                
<ignoredUnusedDeclaredDependency>net.hydromatic:scott-data-hsqldb</ignoredUnusedDeclaredDependency>
-                
<ignoredUnusedDeclaredDependency>org.hsqldb:hsqldb</ignoredUnusedDeclaredDependency>
-                
<ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
-                
<ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
----------------------------------------------------------------------
diff --git 
a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java 
b/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
deleted file mode 100644
index 4756e8d..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
+++ /dev/null
@@ -1,1101 +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.jdbc;
-
-import org.apache.calcite.avatica.AvaticaParameter;
-import org.apache.calcite.avatica.AvaticaPreparedStatement;
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.ConnectionPropertiesImpl;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.MetaImpl;
-import org.apache.calcite.avatica.MissingResultsException;
-import org.apache.calcite.avatica.NoSuchConnectionException;
-import org.apache.calcite.avatica.NoSuchStatementException;
-import org.apache.calcite.avatica.QueryState;
-import org.apache.calcite.avatica.SqlType;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.proto.Requests;
-import org.apache.calcite.avatica.remote.ProtobufMeta;
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.Unsafe;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.RemovalListener;
-import com.google.common.cache.RemovalNotification;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.calcite.avatica.remote.MetricsHelper.concat;
-
-import java.lang.reflect.InvocationTargetException;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/** Implementation of {@link Meta} upon an existing JDBC data source. */
-public class JdbcMeta implements ProtobufMeta {
-  private static final Logger LOG = LoggerFactory.getLogger(JdbcMeta.class);
-
-  private static final String CONN_CACHE_KEY_BASE = "avatica.connectioncache";
-
-  private static final String STMT_CACHE_KEY_BASE = "avatica.statementcache";
-
-  /** Special value for {@code Statement#getLargeMaxRows()} that means fetch
-   * an unlimited number of rows in a single batch.
-   *
-   * <p>Any other negative value will return an unlimited number of rows but
-   * will do it in the default batch size, namely 100. */
-  public static final int UNLIMITED_COUNT = -2;
-
-  // End of constants, start of member variables
-
-  final Calendar calendar = Unsafe.localCalendar();
-
-  /** Generates ids for statements. The ids are unique across all connections
-   * created by this JdbcMeta. */
-  private final AtomicInteger statementIdGenerator = new AtomicInteger();
-
-  private final String url;
-  private final Properties info;
-  private final Cache<String, Connection> connectionCache;
-  private final Cache<Integer, StatementInfo> statementCache;
-  private final MetricsSystem metrics;
-
-  /**
-   * Creates a JdbcMeta.
-   *
-   * @param url a database url of the form
-   *  <code>jdbc:<em>subprotocol</em>:<em>subname</em></code>
-   */
-  public JdbcMeta(String url) throws SQLException {
-    this(url, new Properties());
-  }
-
-  /**
-   * Creates a JdbcMeta.
-   *
-   * @param url a database url of the form
-   * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code>
-   * @param user the database user on whose behalf the connection is being
-   *   made
-   * @param password the user's password
-   */
-  public JdbcMeta(final String url, final String user, final String password)
-      throws SQLException {
-    this(url, new Properties() {
-      {
-        put("user", user);
-        put("password", password);
-      }
-    });
-  }
-
-  public JdbcMeta(String url, Properties info) throws SQLException {
-    this(url, info, NoopMetricsSystem.getInstance());
-  }
-
-  /**
-   * Creates a JdbcMeta.
-   *
-   * @param url a database url of the form
-   * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code>
-   * @param info a list of arbitrary string tag/value pairs as
-   * connection arguments; normally at least a "user" and
-   * "password" property should be included
-   */
-  public JdbcMeta(String url, Properties info, MetricsSystem metrics)
-      throws SQLException {
-    this.url = url;
-    this.info = info;
-    this.metrics = Objects.requireNonNull(metrics);
-
-    int concurrencyLevel = Integer.parseInt(
-        info.getProperty(ConnectionCacheSettings.CONCURRENCY_LEVEL.key(),
-            ConnectionCacheSettings.CONCURRENCY_LEVEL.defaultValue()));
-    int initialCapacity = Integer.parseInt(
-        info.getProperty(ConnectionCacheSettings.INITIAL_CAPACITY.key(),
-            ConnectionCacheSettings.INITIAL_CAPACITY.defaultValue()));
-    long maxCapacity = Long.parseLong(
-        info.getProperty(ConnectionCacheSettings.MAX_CAPACITY.key(),
-            ConnectionCacheSettings.MAX_CAPACITY.defaultValue()));
-    long connectionExpiryDuration = Long.parseLong(
-        info.getProperty(ConnectionCacheSettings.EXPIRY_DURATION.key(),
-            ConnectionCacheSettings.EXPIRY_DURATION.defaultValue()));
-    TimeUnit connectionExpiryUnit = TimeUnit.valueOf(
-        info.getProperty(ConnectionCacheSettings.EXPIRY_UNIT.key(),
-            ConnectionCacheSettings.EXPIRY_UNIT.defaultValue()));
-    this.connectionCache = CacheBuilder.newBuilder()
-        .concurrencyLevel(concurrencyLevel)
-        .initialCapacity(initialCapacity)
-        .maximumSize(maxCapacity)
-        .expireAfterAccess(connectionExpiryDuration, connectionExpiryUnit)
-        .removalListener(new ConnectionExpiryHandler())
-        .build();
-    LOG.debug("instantiated connection cache: {}", connectionCache.stats());
-
-    concurrencyLevel = Integer.parseInt(
-        info.getProperty(StatementCacheSettings.CONCURRENCY_LEVEL.key(),
-            StatementCacheSettings.CONCURRENCY_LEVEL.defaultValue()));
-    initialCapacity = Integer.parseInt(
-        info.getProperty(StatementCacheSettings.INITIAL_CAPACITY.key(),
-            StatementCacheSettings.INITIAL_CAPACITY.defaultValue()));
-    maxCapacity = Long.parseLong(
-        info.getProperty(StatementCacheSettings.MAX_CAPACITY.key(),
-            StatementCacheSettings.MAX_CAPACITY.defaultValue()));
-    connectionExpiryDuration = Long.parseLong(
-        info.getProperty(StatementCacheSettings.EXPIRY_DURATION.key(),
-            StatementCacheSettings.EXPIRY_DURATION.defaultValue()));
-    connectionExpiryUnit = TimeUnit.valueOf(
-        info.getProperty(StatementCacheSettings.EXPIRY_UNIT.key(),
-            StatementCacheSettings.EXPIRY_UNIT.defaultValue()));
-    this.statementCache = CacheBuilder.newBuilder()
-        .concurrencyLevel(concurrencyLevel)
-        .initialCapacity(initialCapacity)
-        .maximumSize(maxCapacity)
-        .expireAfterAccess(connectionExpiryDuration, connectionExpiryUnit)
-        .removalListener(new StatementExpiryHandler())
-        .build();
-
-    LOG.debug("instantiated statement cache: {}", statementCache.stats());
-
-    // Register some metrics
-    this.metrics.register(concat(JdbcMeta.class, "ConnectionCacheSize"), new 
Gauge<Long>() {
-      @Override public Long getValue() {
-        return connectionCache.size();
-      }
-    });
-
-    this.metrics.register(concat(JdbcMeta.class, "StatementCacheSize"), new 
Gauge<Long>() {
-      @Override public Long getValue() {
-        return statementCache.size();
-      }
-    });
-  }
-
-  // For testing purposes
-  protected AtomicInteger getStatementIdGenerator() {
-    return statementIdGenerator;
-  }
-
-  // For testing purposes
-  protected Cache<Integer, StatementInfo> getStatementCache() {
-    return statementCache;
-  }
-
-  /**
-   * Converts from JDBC metadata to Avatica columns.
-   */
-  protected static List<ColumnMetaData>
-  columns(ResultSetMetaData metaData) throws SQLException {
-    if (metaData == null) {
-      return Collections.emptyList();
-    }
-    final List<ColumnMetaData> columns = new ArrayList<>();
-    for (int i = 1; i <= metaData.getColumnCount(); i++) {
-      final SqlType sqlType = SqlType.valueOf(metaData.getColumnType(i));
-      final ColumnMetaData.Rep rep = ColumnMetaData.Rep.of(sqlType.internal);
-      final ColumnMetaData.AvaticaType t;
-      if (sqlType == SqlType.ARRAY || sqlType == SqlType.STRUCT || sqlType == 
SqlType.MULTISET) {
-        ColumnMetaData.AvaticaType arrayValueType = 
ColumnMetaData.scalar(Types.JAVA_OBJECT,
-            metaData.getColumnTypeName(i), ColumnMetaData.Rep.OBJECT);
-        t = ColumnMetaData.array(arrayValueType, 
metaData.getColumnTypeName(i), rep);
-      } else {
-        t = ColumnMetaData.scalar(metaData.getColumnType(i), 
metaData.getColumnTypeName(i), rep);
-      }
-      ColumnMetaData md =
-          new ColumnMetaData(i - 1, metaData.isAutoIncrement(i),
-              metaData.isCaseSensitive(i), metaData.isSearchable(i),
-              metaData.isCurrency(i), metaData.isNullable(i),
-              metaData.isSigned(i), metaData.getColumnDisplaySize(i),
-              metaData.getColumnLabel(i), metaData.getColumnName(i),
-              metaData.getSchemaName(i), metaData.getPrecision(i),
-              metaData.getScale(i), metaData.getTableName(i),
-              metaData.getCatalogName(i), t, metaData.isReadOnly(i),
-              metaData.isWritable(i), metaData.isDefinitelyWritable(i),
-              metaData.getColumnClassName(i));
-      columns.add(md);
-    }
-    return columns;
-  }
-
-  /**
-   * Converts from JDBC metadata to Avatica parameters
-   */
-  protected static List<AvaticaParameter> parameters(ParameterMetaData 
metaData)
-      throws SQLException {
-    if (metaData == null) {
-      return Collections.emptyList();
-    }
-    final List<AvaticaParameter> params = new ArrayList<>();
-    for (int i = 1; i <= metaData.getParameterCount(); i++) {
-      params.add(
-          new AvaticaParameter(metaData.isSigned(i), metaData.getPrecision(i),
-              metaData.getScale(i), metaData.getParameterType(i),
-              metaData.getParameterTypeName(i),
-              metaData.getParameterClassName(i), "?" + i));
-    }
-    return params;
-  }
-
-  protected static Signature signature(ResultSetMetaData metaData,
-      ParameterMetaData parameterMetaData, String sql,
-      Meta.StatementType statementType) throws  SQLException {
-    final CursorFactory cf = CursorFactory.LIST;  // because 
JdbcResultSet#frame
-    return new Signature(columns(metaData), sql, parameters(parameterMetaData),
-        null, cf, statementType);
-  }
-
-  protected static Signature signature(ResultSetMetaData metaData)
-      throws SQLException {
-    return signature(metaData, null, null, null);
-  }
-
-  public Map<DatabaseProperty, Object> getDatabaseProperties(ConnectionHandle 
ch) {
-    try {
-      final Map<DatabaseProperty, Object> map = new HashMap<>();
-      final Connection conn = getConnection(ch.id);
-      final DatabaseMetaData metaData = conn.getMetaData();
-      for (DatabaseProperty p : DatabaseProperty.values()) {
-        addProperty(map, metaData, p);
-      }
-      return map;
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  private static Object addProperty(Map<DatabaseProperty, Object> map,
-      DatabaseMetaData metaData, DatabaseProperty p) throws SQLException {
-    Object propertyValue;
-    if (p.isJdbc) {
-      try {
-        propertyValue = p.method.invoke(metaData);
-      } catch (IllegalAccessException | InvocationTargetException e) {
-        throw new RuntimeException(e);
-      }
-    } else {
-      propertyValue = p.defaultValue;
-    }
-
-    return map.put(p, propertyValue);
-  }
-
-  public MetaResultSet getTables(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat tableNamePattern, List<String> typeList) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getTables(catalog, 
schemaPattern.s,
-              tableNamePattern.s, toArray(typeList));
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-    * Registers a StatementInfo for the given ResultSet, returning the id under
-    * which it is registered. This should be used for metadata ResultSets, 
which
-    * have an implicit statement created.
-    */
-  private int registerMetaStatement(ResultSet rs) throws SQLException {
-    final int id = statementIdGenerator.getAndIncrement();
-    StatementInfo statementInfo = new StatementInfo(rs.getStatement());
-    statementInfo.setResultSet(rs);
-    statementCache.put(id, statementInfo);
-    return id;
-  }
-
-  public MetaResultSet getColumns(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat tableNamePattern, Pat columnNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getColumns(catalog, 
schemaPattern.s,
-              tableNamePattern.s, columnNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getSchemas(ConnectionHandle ch, String catalog, Pat 
schemaPattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getSchemas(catalog, 
schemaPattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getCatalogs(ConnectionHandle ch) {
-    try {
-      final ResultSet rs = getConnection(ch.id).getMetaData().getCatalogs();
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getTableTypes(ConnectionHandle ch) {
-    try {
-      final ResultSet rs = getConnection(ch.id).getMetaData().getTableTypes();
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getProcedures(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat procedureNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getProcedures(catalog, 
schemaPattern.s,
-              procedureNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getProcedureColumns(ConnectionHandle ch, String 
catalog, Pat schemaPattern,
-      Pat procedureNamePattern, Pat columnNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getProcedureColumns(catalog,
-              schemaPattern.s, procedureNamePattern.s, columnNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getColumnPrivileges(ConnectionHandle ch, String 
catalog, String schema,
-      String table, Pat columnNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getColumnPrivileges(catalog, 
schema,
-              table, columnNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getTablePrivileges(ConnectionHandle ch, String catalog, 
Pat schemaPattern,
-      Pat tableNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getTablePrivileges(catalog,
-              schemaPattern.s, tableNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getBestRowIdentifier(ConnectionHandle ch, String 
catalog, String schema,
-      String table, int scope, boolean nullable) {
-    LOG.trace("getBestRowIdentifier catalog:{} schema:{} table:{} scope:{} 
nullable:{}", catalog,
-        schema, table, scope, nullable);
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getBestRowIdentifier(catalog, 
schema,
-              table, scope, nullable);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getVersionColumns(ConnectionHandle ch, String catalog, 
String schema,
-      String table) {
-    LOG.trace("getVersionColumns catalog:{} schema:{} table:{}", catalog, 
schema, table);
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getVersionColumns(catalog, 
schema, table);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getPrimaryKeys(ConnectionHandle ch, String catalog, 
String schema,
-      String table) {
-    LOG.trace("getPrimaryKeys catalog:{} schema:{} table:{}", catalog, schema, 
table);
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getPrimaryKeys(catalog, schema, 
table);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getImportedKeys(ConnectionHandle ch, String catalog, 
String schema,
-      String table) {
-    return null;
-  }
-
-  public MetaResultSet getExportedKeys(ConnectionHandle ch, String catalog, 
String schema,
-      String table) {
-    return null;
-  }
-
-  public MetaResultSet getCrossReference(ConnectionHandle ch, String 
parentCatalog,
-      String parentSchema, String parentTable, String foreignCatalog,
-      String foreignSchema, String foreignTable) {
-    return null;
-  }
-
-  public MetaResultSet getTypeInfo(ConnectionHandle ch) {
-    try {
-      final ResultSet rs = getConnection(ch.id).getMetaData().getTypeInfo();
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getIndexInfo(ConnectionHandle ch, String catalog, 
String schema,
-      String table, boolean unique, boolean approximate) {
-    return null;
-  }
-
-  public MetaResultSet getUDTs(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat typeNamePattern, int[] types) {
-    return null;
-  }
-
-  public MetaResultSet getSuperTypes(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat typeNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getSuperTables(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat tableNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getAttributes(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat typeNamePattern, Pat attributeNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getClientInfoProperties(ConnectionHandle ch) {
-    return null;
-  }
-
-  public MetaResultSet getFunctions(ConnectionHandle ch, String catalog, Pat 
schemaPattern,
-      Pat functionNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getFunctionColumns(ConnectionHandle ch, String catalog, 
Pat schemaPattern,
-      Pat functionNamePattern, Pat columnNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getPseudoColumns(ConnectionHandle ch, String catalog, 
Pat schemaPattern,
-      Pat tableNamePattern, Pat columnNamePattern) {
-    return null;
-  }
-
-  public Iterable<Object> createIterable(StatementHandle handle, QueryState 
state,
-      Signature signature, List<TypedValue> parameterValues, Frame firstFrame) 
{
-    return null;
-  }
-
-  protected Connection getConnection(String id) throws SQLException {
-    if (id == null) {
-      throw new NullPointerException("Connection id is null.");
-    }
-    Connection conn = connectionCache.getIfPresent(id);
-    if (conn == null) {
-      throw new NoSuchConnectionException("Connection not found: invalid id, 
closed, or expired: "
-          + id);
-    }
-    return conn;
-  }
-
-  public StatementHandle createStatement(ConnectionHandle ch) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      final Statement statement = conn.createStatement();
-      final int id = statementIdGenerator.getAndIncrement();
-      statementCache.put(id, new StatementInfo(statement));
-      StatementHandle h = new StatementHandle(ch.id, id, null);
-      LOG.trace("created statement {}", h);
-      return h;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public void closeStatement(StatementHandle h) {
-    StatementInfo info = statementCache.getIfPresent(h.id);
-    if (info == null || info.statement == null) {
-      LOG.debug("client requested close unknown statement {}", h);
-      return;
-    }
-    LOG.trace("closing statement {}", h);
-    try {
-      ResultSet results = info.getResultSet();
-      if (info.isResultSetInitialized() && null != results) {
-        results.close();
-      }
-      info.statement.close();
-    } catch (SQLException e) {
-      throw propagate(e);
-    } finally {
-      statementCache.invalidate(h.id);
-    }
-  }
-
-  @Override public void openConnection(ConnectionHandle ch,
-      Map<String, String> info) {
-    Properties fullInfo = new Properties();
-    fullInfo.putAll(this.info);
-    if (info != null) {
-      fullInfo.putAll(info);
-    }
-
-    synchronized (this) {
-      try {
-        if (connectionCache.asMap().containsKey(ch.id)) {
-          throw new RuntimeException("Connection already exists: " + ch.id);
-        }
-        Connection conn = DriverManager.getConnection(url, fullInfo);
-        connectionCache.put(ch.id, conn);
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  @Override public void closeConnection(ConnectionHandle ch) {
-    Connection conn = connectionCache.getIfPresent(ch.id);
-    if (conn == null) {
-      LOG.debug("client requested close unknown connection {}", ch);
-      return;
-    }
-    LOG.trace("closing connection {}", ch);
-    try {
-      conn.close();
-    } catch (SQLException e) {
-      throw propagate(e);
-    } finally {
-      connectionCache.invalidate(ch.id);
-    }
-  }
-
-  protected void apply(Connection conn, ConnectionProperties connProps)
-      throws SQLException {
-    if (connProps.isAutoCommit() != null) {
-      conn.setAutoCommit(connProps.isAutoCommit());
-    }
-    if (connProps.isReadOnly() != null) {
-      conn.setReadOnly(connProps.isReadOnly());
-    }
-    if (connProps.getTransactionIsolation() != null) {
-      conn.setTransactionIsolation(connProps.getTransactionIsolation());
-    }
-    if (connProps.getCatalog() != null) {
-      conn.setCatalog(connProps.getCatalog());
-    }
-    if (connProps.getSchema() != null) {
-      conn.setSchema(connProps.getSchema());
-    }
-  }
-
-  @Override public ConnectionProperties connectionSync(ConnectionHandle ch,
-      ConnectionProperties connProps) {
-    LOG.trace("syncing properties for connection {}", ch);
-    try {
-      Connection conn = getConnection(ch.id);
-      ConnectionPropertiesImpl props = new 
ConnectionPropertiesImpl(conn).merge(connProps);
-      if (props.isDirty()) {
-        apply(conn, props);
-        props.setDirty(false);
-      }
-      return props;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  RuntimeException propagate(Throwable e) {
-    if (e instanceof RuntimeException) {
-      throw (RuntimeException) e;
-    } else if (e instanceof Error) {
-      throw (Error) e;
-    } else {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public StatementHandle prepare(ConnectionHandle ch, String sql,
-      long maxRowCount) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      final PreparedStatement statement = conn.prepareStatement(sql);
-      final int id = getStatementIdGenerator().getAndIncrement();
-      Meta.StatementType statementType = null;
-      if (statement.isWrapperFor(AvaticaPreparedStatement.class)) {
-        final AvaticaPreparedStatement avaticaPreparedStatement;
-        avaticaPreparedStatement =
-            statement.unwrap(AvaticaPreparedStatement.class);
-        statementType = avaticaPreparedStatement.getStatementType();
-      }
-      // Set the maximum number of rows
-      setMaxRows(statement, maxRowCount);
-      getStatementCache().put(id, new StatementInfo(statement));
-      StatementHandle h = new StatementHandle(ch.id, id,
-          signature(statement.getMetaData(), statement.getParameterMetaData(),
-              sql, statementType));
-      LOG.trace("prepared statement {}", h);
-      return h;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @SuppressWarnings("deprecation")
-  public ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-      long maxRowCount, PrepareCallback callback) throws 
NoSuchStatementException {
-    return prepareAndExecute(h, sql, maxRowCount, 
AvaticaUtils.toSaturatedInt(maxRowCount),
-        callback);
-  }
-
-  public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long 
maxRowCount,
-      int maxRowsInFirstFrame, PrepareCallback callback) throws 
NoSuchStatementException {
-    try {
-      final StatementInfo info = getStatementCache().getIfPresent(h.id);
-      if (info == null) {
-        throw new NoSuchStatementException(h);
-      }
-      final Statement statement = info.statement;
-      // Make sure that we limit the number of rows for the query
-      setMaxRows(statement, maxRowCount);
-      boolean ret = statement.execute(sql);
-      info.setResultSet(statement.getResultSet());
-      // Either execute(sql) returned true or the resultSet was null
-      assert ret || null == info.getResultSet();
-      final List<MetaResultSet> resultSets = new ArrayList<>();
-      if (null == info.getResultSet()) {
-        // Create a special result set that just carries update count
-        resultSets.add(
-            JdbcResultSet.count(h.connectionId, h.id,
-                AvaticaUtils.getLargeUpdateCount(statement)));
-      } else {
-        resultSets.add(
-            JdbcResultSet.create(h.connectionId, h.id, info.getResultSet(), 
maxRowsInFirstFrame));
-      }
-      LOG.trace("prepAndExec statement {}", h);
-      // TODO: review client to ensure statementId is updated when appropriate
-      return new ExecuteResult(resultSets);
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  /**
-   * Sets the provided maximum number of rows on the given statement.
-   *
-   * @param statement The JDBC Statement to operate on
-   * @param maxRowCount The maximum number of rows which should be returned 
for the query
-   */
-  void setMaxRows(Statement statement, long maxRowCount) throws SQLException {
-    // Special handling of maxRowCount as JDBC 0 is unlimited, our meta 0 row
-    if (maxRowCount > 0) {
-      AvaticaUtils.setLargeMaxRows(statement, maxRowCount);
-    } else if (maxRowCount < 0) {
-      statement.setMaxRows(0);
-    }
-  }
-
-  public boolean syncResults(StatementHandle sh, QueryState state, long offset)
-      throws NoSuchStatementException {
-    try {
-      final Connection conn = getConnection(sh.connectionId);
-      final StatementInfo info = statementCache.getIfPresent(sh.id);
-      if (null == info) {
-        throw new NoSuchStatementException(sh);
-      }
-      final Statement statement = info.statement;
-      // Let the state recreate the necessary ResultSet on the Statement
-      info.setResultSet(state.invoke(conn, statement));
-
-      if (null != info.getResultSet()) {
-        // If it is non-null, try to advance to the requested offset.
-        return info.advanceResultSetToOffset(info.getResultSet(), offset);
-      }
-
-      // No results, nothing to do. Client can move on.
-      return false;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) 
throws
-      NoSuchStatementException, MissingResultsException {
-    LOG.trace("fetching {} offset:{} fetchMaxRowCount:{}", h, offset, 
fetchMaxRowCount);
-    try {
-      final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
-      if (null == statementInfo) {
-        // Statement might have expired, or never existed on this server.
-        throw new NoSuchStatementException(h);
-      }
-
-      if (!statementInfo.isResultSetInitialized()) {
-        // The Statement exists, but the results are missing. Need to call 
syncResults(...)
-        throw new MissingResultsException(h);
-      }
-      if (statementInfo.getResultSet() == null) {
-        return Frame.EMPTY;
-      } else {
-        return JdbcResultSet.frame(statementInfo, 
statementInfo.getResultSet(), offset,
-            fetchMaxRowCount, calendar);
-      }
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  private static String[] toArray(List<String> typeList) {
-    if (typeList == null) {
-      return null;
-    }
-    return typeList.toArray(new String[typeList.size()]);
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public ExecuteResult execute(StatementHandle h, List<TypedValue> 
parameterValues,
-      long maxRowCount) throws NoSuchStatementException {
-    return execute(h, parameterValues, 
AvaticaUtils.toSaturatedInt(maxRowCount));
-  }
-
-  @Override public ExecuteResult execute(StatementHandle h,
-      List<TypedValue> parameterValues, int maxRowsInFirstFrame) throws 
NoSuchStatementException {
-    try {
-      if (MetaImpl.checkParameterValueHasNull(parameterValues)) {
-        throw new SQLException("exception while executing query: unbound 
parameter");
-      }
-
-      final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
-      if (null == statementInfo) {
-        throw new NoSuchStatementException(h);
-      }
-      final List<MetaResultSet> resultSets;
-      final PreparedStatement preparedStatement =
-          (PreparedStatement) statementInfo.statement;
-
-      if (parameterValues != null) {
-        for (int i = 0; i < parameterValues.size(); i++) {
-          TypedValue o = parameterValues.get(i);
-          preparedStatement.setObject(i + 1, o.toJdbc(calendar));
-        }
-      }
-
-      if (preparedStatement.execute()) {
-        final Meta.Frame frame;
-        final Signature signature2;
-        if (preparedStatement.isWrapperFor(AvaticaPreparedStatement.class)) {
-          signature2 = h.signature;
-        } else {
-          h.signature = signature(preparedStatement.getMetaData(),
-              preparedStatement.getParameterMetaData(), h.signature.sql,
-              Meta.StatementType.SELECT);
-          signature2 = h.signature;
-        }
-
-        // Make sure we set this for subsequent fetch()'s to find the result 
set.
-        statementInfo.setResultSet(preparedStatement.getResultSet());
-
-        if (statementInfo.getResultSet() == null) {
-          frame = Frame.EMPTY;
-          resultSets = Collections.<MetaResultSet>singletonList(
-              JdbcResultSet.empty(h.connectionId, h.id, signature2));
-        } else {
-          resultSets = Collections.<MetaResultSet>singletonList(
-              JdbcResultSet.create(h.connectionId, h.id, 
statementInfo.getResultSet(),
-                  maxRowsInFirstFrame, signature2));
-        }
-      } else {
-        resultSets = Collections.<MetaResultSet>singletonList(
-            JdbcResultSet.count(h.connectionId, h.id, 
preparedStatement.getUpdateCount()));
-      }
-
-      return new ExecuteResult(resultSets);
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public void commit(ConnectionHandle ch) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      conn.commit();
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public void rollback(ConnectionHandle ch) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      conn.rollback();
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public ExecuteBatchResult prepareAndExecuteBatch(StatementHandle h,
-      List<String> sqlCommands) throws NoSuchStatementException {
-    try {
-      // Get the statement
-      final StatementInfo info = statementCache.getIfPresent(h.id);
-      if (info == null) {
-        throw new NoSuchStatementException(h);
-      }
-
-      // addBatch() for each sql command
-      final Statement stmt = info.statement;
-      for (String sqlCommand : sqlCommands) {
-        stmt.addBatch(sqlCommand);
-      }
-
-      // Execute the batch and return the results
-      return new ExecuteBatchResult(AvaticaUtils.executeLargeBatch(stmt));
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public ExecuteBatchResult executeBatch(StatementHandle h,
-      List<List<TypedValue>> updateBatches) throws NoSuchStatementException {
-    try {
-      final StatementInfo info = statementCache.getIfPresent(h.id);
-      if (null == info) {
-        throw new NoSuchStatementException(h);
-      }
-
-      final PreparedStatement preparedStmt = (PreparedStatement) 
info.statement;
-      int rowUpdate = 1;
-      for (List<TypedValue> batch : updateBatches) {
-        int i = 1;
-        for (TypedValue value : batch) {
-          // Set the TypedValue in the PreparedStatement
-          try {
-            preparedStmt.setObject(i, value.toJdbc(calendar));
-            i++;
-          } catch (SQLException e) {
-            throw new RuntimeException("Failed to set value on row #" + 
rowUpdate
-                + " and column #" + i, e);
-          }
-          // Track the update number for better error messages
-          rowUpdate++;
-        }
-        preparedStmt.addBatch();
-      }
-      return new 
ExecuteBatchResult(AvaticaUtils.executeLargeBatch(preparedStmt));
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public ExecuteBatchResult executeBatchProtobuf(StatementHandle h,
-      List<Requests.UpdateBatch> updateBatches) throws 
NoSuchStatementException {
-    try {
-      final StatementInfo info = statementCache.getIfPresent(h.id);
-      if (null == info) {
-        throw new NoSuchStatementException(h);
-      }
-
-      final PreparedStatement preparedStmt = (PreparedStatement) 
info.statement;
-      for (Requests.UpdateBatch update : updateBatches) {
-        int i = 1;
-        for (Common.TypedValue value : update.getParameterValuesList()) {
-          // Use the value and then increment
-          preparedStmt.setObject(i++, TypedValue.protoToJdbc(value, calendar));
-        }
-        preparedStmt.addBatch();
-      }
-      return new 
ExecuteBatchResult(AvaticaUtils.executeLargeBatch(preparedStmt));
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  /** Configurable statement cache settings. */
-  public enum StatementCacheSettings {
-    /** JDBC connection property for setting connection cache concurrency 
level. */
-    CONCURRENCY_LEVEL(STMT_CACHE_KEY_BASE + ".concurrency", "100"),
-
-    /** JDBC connection property for setting connection cache initial 
capacity. */
-    INITIAL_CAPACITY(STMT_CACHE_KEY_BASE + ".initialcapacity", "1000"),
-
-    /** JDBC connection property for setting connection cache maximum 
capacity. */
-    MAX_CAPACITY(STMT_CACHE_KEY_BASE + ".maxcapacity", "10000"),
-
-    /** JDBC connection property for setting connection cache expiration 
duration.
-     *
-     * <p>Used in conjunction with {@link #EXPIRY_UNIT}.</p>
-     */
-    EXPIRY_DURATION(STMT_CACHE_KEY_BASE + ".expirydiration", "5"),
-
-    /** JDBC connection property for setting connection cache expiration unit.
-     *
-     * <p>Used in conjunction with {@link #EXPIRY_DURATION}.</p>
-     */
-    EXPIRY_UNIT(STMT_CACHE_KEY_BASE + ".expiryunit", TimeUnit.MINUTES.name());
-
-    private final String key;
-    private final String defaultValue;
-
-    StatementCacheSettings(String key, String defaultValue) {
-      this.key = key;
-      this.defaultValue = defaultValue;
-    }
-
-    /** The configuration key for specifying this setting. */
-    public String key() {
-      return key;
-    }
-
-    /** The default value for this setting. */
-    public String defaultValue() {
-      return defaultValue;
-    }
-  }
-
-  /** Configurable connection cache settings. */
-  public enum ConnectionCacheSettings {
-    /** JDBC connection property for setting connection cache concurrency 
level. */
-    CONCURRENCY_LEVEL(CONN_CACHE_KEY_BASE + ".concurrency", "10"),
-
-    /** JDBC connection property for setting connection cache initial 
capacity. */
-    INITIAL_CAPACITY(CONN_CACHE_KEY_BASE + ".initialcapacity", "100"),
-
-    /** JDBC connection property for setting connection cache maximum 
capacity. */
-    MAX_CAPACITY(CONN_CACHE_KEY_BASE + ".maxcapacity", "1000"),
-
-    /** JDBC connection property for setting connection cache expiration 
duration. */
-    EXPIRY_DURATION(CONN_CACHE_KEY_BASE + ".expiryduration", "10"),
-
-    /** JDBC connection property for setting connection cache expiration unit. 
*/
-    EXPIRY_UNIT(CONN_CACHE_KEY_BASE + ".expiryunit", TimeUnit.MINUTES.name());
-
-    private final String key;
-    private final String defaultValue;
-
-    ConnectionCacheSettings(String key, String defaultValue) {
-      this.key = key;
-      this.defaultValue = defaultValue;
-    }
-
-    /** The configuration key for specifying this setting. */
-    public String key() {
-      return key;
-    }
-
-    /** The default value for this setting. */
-    public String defaultValue() {
-      return defaultValue;
-    }
-  }
-
-  /** Callback for {@link #connectionCache} member expiration. */
-  private class ConnectionExpiryHandler
-      implements RemovalListener<String, Connection> {
-
-    public void onRemoval(RemovalNotification<String, Connection> 
notification) {
-      String connectionId = notification.getKey();
-      Connection doomed = notification.getValue();
-      LOG.debug("Expiring connection {} because {}", connectionId, 
notification.getCause());
-      try {
-        if (doomed != null) {
-          doomed.close();
-        }
-      } catch (Throwable t) {
-        LOG.info("Exception thrown while expiring connection {}", 
connectionId, t);
-      }
-    }
-  }
-
-  /** Callback for {@link #statementCache} member expiration. */
-  private class StatementExpiryHandler
-      implements RemovalListener<Integer, StatementInfo> {
-    public void onRemoval(RemovalNotification<Integer, StatementInfo> 
notification) {
-      Integer stmtId = notification.getKey();
-      StatementInfo doomed = notification.getValue();
-      if (doomed == null) {
-        // log/throw?
-        return;
-      }
-      LOG.debug("Expiring statement {} because {}", stmtId, 
notification.getCause());
-      try {
-        if (doomed.getResultSet() != null) {
-          doomed.getResultSet().close();
-        }
-        if (doomed.statement != null) {
-          doomed.statement.close();
-        }
-      } catch (Throwable t) {
-        LOG.info("Exception thrown while expiring statement {}", stmtId, t);
-      }
-    }
-  }
-}
-
-// End JdbcMeta.java

Reply via email to