Return-Path: X-Original-To: apmail-calcite-commits-archive@www.apache.org Delivered-To: apmail-calcite-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BCEC0181FE for ; Mon, 7 Mar 2016 18:27:40 +0000 (UTC) Received: (qmail 7783 invoked by uid 500); 7 Mar 2016 18:27:40 -0000 Delivered-To: apmail-calcite-commits-archive@calcite.apache.org Received: (qmail 7685 invoked by uid 500); 7 Mar 2016 18:27:40 -0000 Mailing-List: contact commits-help@calcite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@calcite.apache.org Delivered-To: mailing list commits@calcite.apache.org Received: (qmail 7196 invoked by uid 99); 7 Mar 2016 18:27:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Mar 2016 18:27:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 23BC1DFFF0; Mon, 7 Mar 2016 18:27:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@calcite.apache.org Date: Mon, 07 Mar 2016 18:27:54 -0000 Message-Id: In-Reply-To: <112922d6d34941dc8041dbbf3c4189f4@git.apache.org> References: <112922d6d34941dc8041dbbf3c4189f4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [16/59] [partial] calcite git commit: [CALCITE-1078] Detach avatica from the core calcite Maven project http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/fonts/fontawesome-webfont.woff ---------------------------------------------------------------------- diff --git a/avatica/site/fonts/fontawesome-webfont.woff b/avatica/site/fonts/fontawesome-webfont.woff new file mode 100755 index 0000000..628b6a5 Binary files /dev/null and b/avatica/site/fonts/fontawesome-webfont.woff differ http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/img/cake.jpg ---------------------------------------------------------------------- diff --git a/avatica/site/img/cake.jpg b/avatica/site/img/cake.jpg new file mode 100644 index 0000000..af370c6 Binary files /dev/null and b/avatica/site/img/cake.jpg differ http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/img/feather.png ---------------------------------------------------------------------- diff --git a/avatica/site/img/feather.png b/avatica/site/img/feather.png new file mode 100644 index 0000000..a2da98a Binary files /dev/null and b/avatica/site/img/feather.png differ http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/img/logo.png ---------------------------------------------------------------------- diff --git a/avatica/site/img/logo.png b/avatica/site/img/logo.png new file mode 100644 index 0000000..b883465 Binary files /dev/null and b/avatica/site/img/logo.png differ http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/img/pie-chart.png ---------------------------------------------------------------------- diff --git a/avatica/site/img/pie-chart.png b/avatica/site/img/pie-chart.png new file mode 100644 index 0000000..59e2ddb Binary files /dev/null and b/avatica/site/img/pie-chart.png differ http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/img/window-types.png ---------------------------------------------------------------------- diff --git a/avatica/site/img/window-types.png b/avatica/site/img/window-types.png new file mode 100644 index 0000000..366c00a Binary files /dev/null and b/avatica/site/img/window-types.png differ http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/index.html ---------------------------------------------------------------------- diff --git a/avatica/site/index.html b/avatica/site/index.html new file mode 100644 index 0000000..8857d27 --- /dev/null +++ b/avatica/site/index.html @@ -0,0 +1,75 @@ +--- +layout: default +title: Apache Calcite • Dynamic data management framework +overview: true +--- +{% comment %} +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. +{% endcomment %} + +
+
+
+

The foundation for your next high-performance database.

+
+
+
+
+
+ + + +
+
+
+
+
+ + +
+
http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/js/html5shiv.min.js ---------------------------------------------------------------------- diff --git a/avatica/site/js/html5shiv.min.js b/avatica/site/js/html5shiv.min.js new file mode 100644 index 0000000..d4c731a --- /dev/null +++ b/avatica/site/js/html5shiv.min.js @@ -0,0 +1,4 @@ +/** +* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed +*/ +!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag ()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined" ==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/js/respond.min.js ---------------------------------------------------------------------- diff --git a/avatica/site/js/respond.min.js b/avatica/site/js/respond.min.js new file mode 100644 index 0000000..80a7b69 --- /dev/null +++ b/avatica/site/js/respond.min.js @@ -0,0 +1,5 @@ +/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl + * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT + * */ + +!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?: o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeC hild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substr ing(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b

+ +

Calcite Twitter

+ +

The official @ApacheCalcite +Twitter account pushes announcements about Calcite. If you give a talk about +Calcite, let us know and we'll tweet it out and add it to the news section +of the website.

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/news/releases/index.html ---------------------------------------------------------------------- diff --git a/avatica/site/news/releases/index.html b/avatica/site/news/releases/index.html new file mode 100644 index 0000000..c6c9fa6 --- /dev/null +++ b/avatica/site/news/releases/index.html @@ -0,0 +1,26 @@ +--- +layout: news +title: Releases +permalink: /news/releases/ +author: all +--- +{% comment %} +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. +{% endcomment %} + +{% for post in site.categories.release %} + {% include news_item.html %} +{% endfor %} http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/config/assemblies/source-assembly.xml ---------------------------------------------------------------------- diff --git a/avatica/src/main/config/assemblies/source-assembly.xml b/avatica/src/main/config/assemblies/source-assembly.xml new file mode 100644 index 0000000..2b1f930 --- /dev/null +++ b/avatica/src/main/config/assemblies/source-assembly.xml @@ -0,0 +1,103 @@ + + + + source-release + + zip + tar.gz + + + + + . + / + true + + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/).*${project.build.directory}.*] + + + + + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?maven-eclipse\.xml] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.project] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.classpath] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.iws] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.idea(/.*)?] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?out(/.*)?] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.ipr] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.iml] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.settings(/.*)?] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.externalToolBuilders(/.*)?] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.deployables(/.*)?] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.wtpmodules(/.*)?] + + + + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.gitignore(/.*)?] + + + **/.buildpath + **/sandbox/** + + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?cobertura\.ser] + + + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?pom\.xml\.releaseBackup] + + %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?release\.properties] + + + + + + ${project.build.directory}/maven-shared-archive-resources/META-INF + + / + + + ${project.build.directory} + + git.properties + + / + + + http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/config/checkstyle/checker.xml ---------------------------------------------------------------------- diff --git a/avatica/src/main/config/checkstyle/checker.xml b/avatica/src/main/config/checkstyle/checker.xml new file mode 100644 index 0000000..167511b --- /dev/null +++ b/avatica/src/main/config/checkstyle/checker.xml @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/config/checkstyle/header.txt ---------------------------------------------------------------------- diff --git a/avatica/src/main/config/checkstyle/header.txt b/avatica/src/main/config/checkstyle/header.txt new file mode 100644 index 0000000..2a42971 --- /dev/null +++ b/avatica/src/main/config/checkstyle/header.txt @@ -0,0 +1,16 @@ +/* + * 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. + */ http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/config/checkstyle/suppressions.xml ---------------------------------------------------------------------- diff --git a/avatica/src/main/config/checkstyle/suppressions.xml b/avatica/src/main/config/checkstyle/suppressions.xml new file mode 100644 index 0000000..d9ae88a --- /dev/null +++ b/avatica/src/main/config/checkstyle/suppressions.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java ---------------------------------------------------------------------- diff --git a/avatica/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java b/avatica/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java deleted file mode 100644 index 62c4dd2..0000000 --- a/avatica/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java +++ /dev/null @@ -1,77 +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 com.google.protobuf; - -/** - * Helper class to extract byte arrays from {@link ByteString} without copy. - * - * Without this protobufs would force us to copy every single byte array out - * of the objects de-serialized from the wire (which already do one copy, on - * top of the copies the JVM does to go from kernel buffer to C buffer and - * from C buffer to JVM buffer). - * - * Graciously copied from Apache HBase. - */ -public final class HBaseZeroCopyByteString extends LiteralByteString { - // Gotten from AsyncHBase code base with permission. - /** Private constructor so this class cannot be instantiated. */ - private HBaseZeroCopyByteString() { - super(null); - throw new UnsupportedOperationException("Should never be here."); - } - - /** - * Wraps a byte array in a {@link ByteString} without copying it. - * - * @param array The byte array to wrap - * @return a ByteString wrapping the array - */ - public static ByteString wrap(final byte[] array) { - return new LiteralByteString(array); - } - - /** - * Wraps a subset of a byte array in a {@link ByteString} without copying it. - * - * @param array The byte array to wrap - * @param offset the start of data in the array - * @param length The number of bytes of data at offset - * @return a ByteString wrapping the array - */ - public static ByteString wrap(final byte[] array, int offset, int length) { - return new BoundedByteString(array, offset, length); - } - - - /** - * Extracts the byte array from the given {@link ByteString} without copy. - * @param buf A buffer from which to extract the array. This buffer must be - * actually an instance of a {@code LiteralByteString}. - * - * @param buf ByteString to access - * @return The underlying byte array of the ByteString - */ - public static byte[] zeroCopyGetBytes(final ByteString buf) { - if (buf instanceof LiteralByteString) { - return ((LiteralByteString) buf).bytes; - } - throw new UnsupportedOperationException("Need a LiteralByteString, got a " - + buf.getClass().getName()); - } -} - -// End HBaseZeroCopyByteString.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/java/com/google/protobuf/package-info.java ---------------------------------------------------------------------- diff --git a/avatica/src/main/java/com/google/protobuf/package-info.java b/avatica/src/main/java/com/google/protobuf/package-info.java deleted file mode 100644 index 92f110e..0000000 --- a/avatica/src/main/java/com/google/protobuf/package-info.java +++ /dev/null @@ -1,26 +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. - */ - -/** - * Avatica-custom classes to access protected classes in Google Protobuf. - */ -@PackageMarker -package com.google.protobuf; - -import org.apache.calcite.avatica.util.PackageMarker; - -// End package-info.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java ---------------------------------------------------------------------- diff --git a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java deleted file mode 100644 index df03b03..0000000 --- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java +++ /dev/null @@ -1,94 +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.AvaticaRuntimeException; -import org.apache.calcite.avatica.remote.Service.ErrorResponse; -import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse; - -import java.util.Collections; -import java.util.List; - -/** - * The client-side representation of {@link AvaticaRuntimeException}. This exception is not intended - * for consumption by clients, {@link AvaticaSqlException} serves that purpose. This exception only - * exists to pass the original error attributes to a higher level of execution without modifying - * existing exception-handling logic. - */ -public class AvaticaClientRuntimeException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - private final int errorCode; - private final String sqlState; - private final AvaticaSeverity severity; - private final List serverExceptions; - private final RpcMetadataResponse metadata; - - public AvaticaClientRuntimeException(String errorMessage, int errorCode, String sqlState, - AvaticaSeverity severity, List serverExceptions, RpcMetadataResponse metadata) { - super(errorMessage); - this.errorCode = errorCode; - this.sqlState = sqlState; - this.severity = severity; - this.serverExceptions = serverExceptions; - this.metadata = metadata; - } - - public AvaticaClientRuntimeException(String message, Throwable cause) { - super(message, cause); - errorCode = ErrorResponse.UNKNOWN_ERROR_CODE; - sqlState = ErrorResponse.UNKNOWN_SQL_STATE; - severity = AvaticaSeverity.UNKNOWN; - serverExceptions = Collections.singletonList(""); - metadata = null; - } - - public int getErrorCode() { - return errorCode; - } - - public String getSqlState() { - return sqlState; - } - - public AvaticaSeverity getSeverity() { - return severity; - } - - public List getServerExceptions() { - return serverExceptions; - } - - public RpcMetadataResponse getRpcMetadata() { - return metadata; - } - - @Override public String toString() { - StringBuilder sb = new StringBuilder(64); - sb.append(getClass().getSimpleName()).append(": ") - .append(getMessage()).append(". Error ").append(getErrorCode()) - .append(" (").append(sqlState).append(") ").append(getSeverity()).append("\n\n"); - for (String serverException : getServerExceptions()) { - sb.append(serverException).append("\n"); - } - return sb.toString(); - } - -} - -// End AvaticaClientRuntimeException.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java ---------------------------------------------------------------------- diff --git a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java deleted file mode 100644 index 2d89f45..0000000 --- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java +++ /dev/null @@ -1,696 +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.Meta.MetaResultSet; -import org.apache.calcite.avatica.remote.Service.ErrorResponse; -import org.apache.calcite.avatica.remote.Service.OpenConnectionRequest; -import org.apache.calcite.avatica.remote.TypedValue; - -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.NClob; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLClientInfoException; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Savepoint; -import java.sql.Statement; -import java.sql.Struct; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Properties; -import java.util.TimeZone; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executor; - -/** - * Implementation of JDBC connection - * for the Avatica framework. - * - *

Abstract to allow newer versions of JDBC to add methods. - */ -public abstract class AvaticaConnection implements Connection { - - /** The name of the sole column returned by DML statements, containing - * the number of rows modified. */ - public static final String ROWCOUNT_COLUMN_NAME = "ROWCOUNT"; - - public static final String NUM_EXECUTE_RETRIES_KEY = "avatica.statement.retries"; - public static final String NUM_EXECUTE_RETRIES_DEFAULT = "5"; - - /** The name of the sole column returned by an EXPLAIN statement. - * - *

Actually Avatica does not care what this column is called, but here is - * a useful place to define a suggested value. */ - public static final String PLAN_COLUMN_NAME = "PLAN"; - - protected int statementCount; - private boolean closed; - private int holdability; - private int networkTimeout; - - public final String id; - public final Meta.ConnectionHandle handle; - protected final UnregisteredDriver driver; - protected final AvaticaFactory factory; - final String url; - protected final Properties info; - protected final Meta meta; - protected final AvaticaDatabaseMetaData metaData; - public final Helper helper = Helper.INSTANCE; - public final Map properties = new HashMap<>(); - public final Map statementMap = - new ConcurrentHashMap<>(); - protected final long maxRetriesPerExecute; - - /** - * Creates an AvaticaConnection. - * - *

Not public; method is called only from the driver or a derived - * class.

- * - * @param driver Driver - * @param factory Factory for JDBC objects - * @param url Server URL - * @param info Other connection properties - */ - protected AvaticaConnection(UnregisteredDriver driver, - AvaticaFactory factory, - String url, - Properties info) { - this.id = UUID.randomUUID().toString(); - this.handle = new Meta.ConnectionHandle(this.id); - this.driver = driver; - this.factory = factory; - this.url = url; - this.info = info; - this.meta = driver.createMeta(this); - this.metaData = factory.newDatabaseMetaData(this); - this.holdability = metaData.getResultSetHoldability(); - this.maxRetriesPerExecute = getNumStatementRetries(info); - } - - /** Computes the number of retries - * {@link AvaticaStatement#executeInternal(Meta.Signature, boolean)} - * should retry before failing. */ - long getNumStatementRetries(Properties props) { - return Long.valueOf(Objects.requireNonNull(props) - .getProperty(NUM_EXECUTE_RETRIES_KEY, NUM_EXECUTE_RETRIES_DEFAULT)); - } - - /** Returns a view onto this connection's configuration properties. Code - * in Avatica and derived projects should use this view rather than calling - * {@link java.util.Properties#getProperty(String)}. Derived projects will - * almost certainly subclass {@link ConnectionConfig} with their own - * properties. */ - public ConnectionConfig config() { - return new ConnectionConfigImpl(info); - } - - /** - * Opens the connection on the server. - */ - public void openConnection() { - // Open the connection on the server - this.meta.openConnection(handle, OpenConnectionRequest.serializeProperties(info)); - } - - // Connection methods - - public AvaticaStatement createStatement() throws SQLException { - //noinspection MagicConstant - return createStatement(ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY, - holdability); - } - - public PreparedStatement prepareStatement(String sql) throws SQLException { - //noinspection MagicConstant - return prepareStatement( - sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, - holdability); - } - - public CallableStatement prepareCall(String sql) throws SQLException { - throw helper.unsupported(); - } - - public String nativeSQL(String sql) throws SQLException { - throw helper.unsupported(); - } - - public void setAutoCommit(boolean autoCommit) throws SQLException { - meta.connectionSync(handle, new ConnectionPropertiesImpl().setAutoCommit(autoCommit)); - } - - public boolean getAutoCommit() throws SQLException { - return unbox(sync().isAutoCommit(), true); - } - - public void commit() throws SQLException { - meta.commit(handle); - } - - public void rollback() throws SQLException { - meta.rollback(handle); - } - - public void close() throws SQLException { - if (!closed) { - closed = true; - - // Per specification, if onConnectionClose throws, this method will throw - // a SQLException, but statement will still be closed. - try { - meta.closeConnection(handle); - driver.handler.onConnectionClose(this); - } catch (RuntimeException e) { - throw helper.createException("While closing connection", e); - } - } - } - - public boolean isClosed() throws SQLException { - return closed; - } - - public DatabaseMetaData getMetaData() throws SQLException { - return metaData; - } - - public void setReadOnly(boolean readOnly) throws SQLException { - meta.connectionSync(handle, new ConnectionPropertiesImpl().setReadOnly(readOnly)); - } - - public boolean isReadOnly() throws SQLException { - return unbox(sync().isReadOnly(), true); - } - - public void setCatalog(String catalog) throws SQLException { - meta.connectionSync(handle, new ConnectionPropertiesImpl().setCatalog(catalog)); - } - - public String getCatalog() { - return sync().getCatalog(); - } - - public void setTransactionIsolation(int level) throws SQLException { - meta.connectionSync(handle, new ConnectionPropertiesImpl().setTransactionIsolation(level)); - } - - public int getTransactionIsolation() throws SQLException { - //noinspection MagicConstant - return unbox(sync().getTransactionIsolation(), TRANSACTION_NONE); - } - - public SQLWarning getWarnings() throws SQLException { - return null; - } - - public void clearWarnings() throws SQLException { - // no-op since connection pooling often calls this. - } - - public Statement createStatement( - int resultSetType, int resultSetConcurrency) throws SQLException { - //noinspection MagicConstant - return createStatement(resultSetType, resultSetConcurrency, holdability); - } - - public PreparedStatement prepareStatement( - String sql, - int resultSetType, - int resultSetConcurrency) throws SQLException { - //noinspection MagicConstant - return prepareStatement( - sql, resultSetType, resultSetConcurrency, holdability); - } - - public CallableStatement prepareCall( - String sql, - int resultSetType, - int resultSetConcurrency) throws SQLException { - throw helper.unsupported(); - } - - public Map> getTypeMap() throws SQLException { - throw helper.unsupported(); - } - - public void setTypeMap(Map> map) throws SQLException { - throw helper.unsupported(); - } - - public void setHoldability(int holdability) throws SQLException { - if (!(holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT - || holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT)) { - throw new SQLException("invalid value"); - } - this.holdability = holdability; - } - - public int getHoldability() throws SQLException { - return holdability; - } - - public Savepoint setSavepoint() throws SQLException { - throw helper.unsupported(); - } - - public Savepoint setSavepoint(String name) throws SQLException { - throw helper.unsupported(); - } - - public void rollback(Savepoint savepoint) throws SQLException { - throw helper.unsupported(); - } - - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - throw helper.unsupported(); - } - - public AvaticaStatement createStatement( - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - return factory.newStatement(this, null, resultSetType, resultSetConcurrency, - resultSetHoldability); - } - - public PreparedStatement prepareStatement( - String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - try { - final Meta.StatementHandle h = meta.prepare(handle, sql, -1); - return factory.newPreparedStatement(this, h, h.signature, resultSetType, - resultSetConcurrency, resultSetHoldability); - } catch (RuntimeException e) { - throw helper.createException("while preparing SQL: " + sql, e); - } - } - - public CallableStatement prepareCall( - String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - throw helper.unsupported(); - } - - public PreparedStatement prepareStatement( - String sql, int autoGeneratedKeys) throws SQLException { - throw helper.unsupported(); - } - - public PreparedStatement prepareStatement( - String sql, int[] columnIndexes) throws SQLException { - throw helper.unsupported(); - } - - public PreparedStatement prepareStatement( - String sql, String[] columnNames) throws SQLException { - throw helper.unsupported(); - } - - public Clob createClob() throws SQLException { - throw helper.unsupported(); - } - - public Blob createBlob() throws SQLException { - throw helper.unsupported(); - } - - public NClob createNClob() throws SQLException { - throw helper.unsupported(); - } - - public SQLXML createSQLXML() throws SQLException { - throw helper.unsupported(); - } - - public boolean isValid(int timeout) throws SQLException { - throw helper.unsupported(); - } - - public void setClientInfo(String name, String value) - throws SQLClientInfoException { - throw helper.clientInfo(); - } - - public void setClientInfo(Properties properties) - throws SQLClientInfoException { - throw helper.clientInfo(); - } - - public String getClientInfo(String name) throws SQLException { - throw helper.unsupported(); - } - - public Properties getClientInfo() throws SQLException { - throw helper.unsupported(); - } - - public Array createArrayOf(String typeName, Object[] elements) - throws SQLException { - throw helper.unsupported(); - } - - public Struct createStruct(String typeName, Object[] attributes) - throws SQLException { - throw helper.unsupported(); - } - - public void setSchema(String schema) throws SQLException { - meta.connectionSync(handle, new ConnectionPropertiesImpl().setSchema(schema)); - } - - public String getSchema() { - return sync().getSchema(); - } - - public void abort(Executor executor) throws SQLException { - throw helper.unsupported(); - } - - public void setNetworkTimeout( - Executor executor, int milliseconds) throws SQLException { - this.networkTimeout = milliseconds; - } - - public int getNetworkTimeout() throws SQLException { - return networkTimeout; - } - - public T unwrap(Class iface) throws SQLException { - if (iface.isInstance(this)) { - return iface.cast(this); - } - throw helper.createException( - "does not implement '" + iface + "'"); - } - - public boolean isWrapperFor(Class iface) throws SQLException { - return iface.isInstance(this); - } - - /** Returns the time zone of this connection. Determines the offset applied - * when converting datetime values from the database into - * {@link java.sql.Timestamp} values. */ - public TimeZone getTimeZone() { - final String timeZoneName = config().timeZone(); - return timeZoneName == null - ? TimeZone.getDefault() - : TimeZone.getTimeZone(timeZoneName); - } - - /** - * Executes a prepared query, closing any previously open result set. - * - * @param statement Statement - * @param signature Prepared query - * @param firstFrame First frame of rows, or null if we need to execute - * @param state The state used to create the given result - * @param isUpdate Was the caller context via {@link PreparedStatement#executeUpdate()}. - * @return Result set - * @throws java.sql.SQLException if a database error occurs - */ - protected ResultSet executeQueryInternal(AvaticaStatement statement, - Meta.Signature signature, Meta.Frame firstFrame, QueryState state, boolean isUpdate) - throws SQLException { - // Close the previous open result set, if there is one. - Meta.Frame frame = firstFrame; - Meta.Signature signature2 = signature; - - synchronized (statement) { - if (statement.openResultSet != null) { - final AvaticaResultSet rs = statement.openResultSet; - statement.openResultSet = null; - try { - rs.close(); - } catch (Exception e) { - throw helper.createException( - "Error while closing previous result set", e); - } - } - - try { - if (statement.isWrapperFor(AvaticaPreparedStatement.class)) { - final AvaticaPreparedStatement pstmt = (AvaticaPreparedStatement) statement; - Meta.StatementHandle handle = pstmt.handle; - if (isUpdate) { - // Make a copy of the StatementHandle, nulling out the Signature. - // CALCITE-1086 we don't need to send the Signature to the server - // when we're only performing an update. Saves on serialization. - handle = new Meta.StatementHandle(handle.connectionId, handle.id, null); - } - final Meta.ExecuteResult executeResult = - meta.execute(handle, pstmt.getParameterValues(), - statement.getFetchSize()); - final MetaResultSet metaResultSet = executeResult.resultSets.get(0); - frame = metaResultSet.firstFrame; - statement.updateCount = metaResultSet.updateCount; - signature2 = executeResult.resultSets.get(0).signature; - } - } catch (Exception e) { - e.printStackTrace(); - throw helper.createException(e.getMessage(), e); - } - - final TimeZone timeZone = getTimeZone(); - if (frame == null && signature2 == null && statement.updateCount != -1) { - statement.openResultSet = null; - } else { - // Duplicative SQL, for support non-prepared statements - statement.openResultSet = - factory.newResultSet(statement, state, signature2, timeZone, frame); - } - } - // Release the monitor before executing, to give another thread the - // opportunity to call cancel. - try { - if (statement.openResultSet != null) { - statement.openResultSet.execute(); - isUpdateCapable(statement); - } - } catch (Exception e) { - throw helper.createException( - "exception while executing query: " + e.getMessage(), e); - } - return statement.openResultSet; - } - - /** Returns whether a a statement is capable of updates and if so, - * and the statement's {@code updateCount} is still -1, proceeds to - * get updateCount value from statement's resultSet. - * - *

Handles "ROWCOUNT" object as Number or List - * - * @param statement Statement - * @throws SQLException on error - */ - private void isUpdateCapable(final AvaticaStatement statement) - throws SQLException { - Meta.Signature signature = statement.getSignature(); - if (signature == null || signature.statementType == null) { - return; - } - if (signature.statementType.canUpdate() && statement.updateCount == -1) { - statement.openResultSet.next(); - Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME); - if (obj instanceof Number) { - statement.updateCount = ((Number) obj).intValue(); - } else if (obj instanceof List) { - @SuppressWarnings("unchecked") - final List numbers = (List) obj; - statement.updateCount = numbers.get(0).intValue(); - } else { - throw helper.createException("Not a valid return result."); - } - statement.openResultSet = null; - } - } - - protected Meta.ExecuteResult prepareAndExecuteInternal( - final AvaticaStatement statement, final String sql, long maxRowCount) - throws SQLException, NoSuchStatementException { - final Meta.PrepareCallback callback = - new Meta.PrepareCallback() { - public Object getMonitor() { - return statement; - } - - public void clear() throws SQLException { - if (statement.openResultSet != null) { - final AvaticaResultSet rs = statement.openResultSet; - statement.openResultSet = null; - try { - rs.close(); - } catch (Exception e) { - throw helper.createException( - "Error while closing previous result set", e); - } - } - } - - public void assign(Meta.Signature signature, Meta.Frame firstFrame, - long updateCount) throws SQLException { - statement.setSignature(signature); - - if (updateCount != -1) { - statement.updateCount = updateCount; - } else { - final TimeZone timeZone = getTimeZone(); - statement.openResultSet = factory.newResultSet(statement, new QueryState(sql), - signature, timeZone, firstFrame); - } - } - - public void execute() throws SQLException { - if (statement.openResultSet != null) { - statement.openResultSet.execute(); - isUpdateCapable(statement); - } - } - }; - return meta.prepareAndExecute(statement.handle, sql, maxRowCount, callback); - } - - protected ResultSet createResultSet(Meta.MetaResultSet metaResultSet, QueryState state) - throws SQLException { - final Meta.StatementHandle h = new Meta.StatementHandle( - metaResultSet.connectionId, metaResultSet.statementId, null); - final AvaticaStatement statement = lookupStatement(h); - // These are all the metadata operations, no updates - ResultSet resultSet = executeQueryInternal(statement, metaResultSet.signature.sanitize(), - metaResultSet.firstFrame, state, false); - if (metaResultSet.ownStatement) { - resultSet.getStatement().closeOnCompletion(); - } - return resultSet; - } - - /** Creates a statement wrapper around an existing handle. */ - protected AvaticaStatement lookupStatement(Meta.StatementHandle h) - throws SQLException { - final AvaticaStatement statement = statementMap.get(h.id); - if (statement != null) { - return statement; - } - //noinspection MagicConstant - return factory.newStatement(this, Objects.requireNonNull(h), - ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, holdability); - } - - // do not make public - protected static Trojan createTrojan() { - return new Trojan(); - } - - /** Converts a {@link Boolean} to a {@code boolean}, with a default value. */ - private boolean unbox(Boolean b, boolean defaultValue) { - return b == null ? defaultValue : b; - } - - /** Converts an {@link Integer} to an {@code int}, with a default value. */ - private int unbox(Integer i, int defaultValue) { - return i == null ? defaultValue : i; - } - - private Meta.ConnectionProperties sync() { - return meta.connectionSync(handle, new ConnectionPropertiesImpl()); - } - - /** A way to call package-protected methods. But only a sub-class of - * connection can create one. */ - public static class Trojan { - // must be private - private Trojan() { - } - - /** A means for anyone who has a trojan to call the protected method - * {@link org.apache.calcite.avatica.AvaticaResultSet#execute()}. - * @throws SQLException if execute fails for some reason. */ - public ResultSet execute(AvaticaResultSet resultSet) throws SQLException { - return resultSet.execute(); - } - - /** A means for anyone who has a trojan to call the protected method - * {@link org.apache.calcite.avatica.AvaticaStatement#getParameterValues()}. - */ - public List getParameterValues(AvaticaStatement statement) { - return statement.getParameterValues(); - } - - /** A means for anyone who has a trojan to get the protected field - * {@link org.apache.calcite.avatica.AvaticaConnection#meta}. */ - public Meta getMeta(AvaticaConnection connection) { - return connection.meta; - } - } - - /** - * A Callable-like interface but without a "throws Exception". - * - * @param The return type from {@code call}. - */ - public interface CallableWithoutException { - T call(); - } - - /** - * Invokes the given "callable", retrying the call when the server responds with an error - * denoting that the connection is missing on the server. - * - * @param callable The function to invoke. - * @return The value from the result of the callable. - */ - public T invokeWithRetries(CallableWithoutException callable) { - RuntimeException lastException = null; - for (int i = 0; i < maxRetriesPerExecute; i++) { - try { - return callable.call(); - } catch (AvaticaClientRuntimeException e) { - lastException = e; - if (ErrorResponse.MISSING_CONNECTION_ERROR_CODE == e.getErrorCode()) { - this.openConnection(); - continue; - } - throw e; - } - } - if (null != lastException) { - throw lastException; - } else { - // Shouldn't ever happen. - throw new IllegalStateException(); - } - } -} - -// End AvaticaConnection.java