http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java deleted file mode 100644 index 633af78..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java +++ /dev/null @@ -1,40 +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.metrics; - -/** - * A metric which measures the distribution of values. - */ -public interface Histogram extends Metric { - - /** - * Adds a new value to the distribution. - * - * @param value The value to add - */ - void update(int value); - - /** - * Adds a new value to the distribution. - * - * @param value The value to add - */ - void update(long value); - -} - -// End Histogram.java
http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java deleted file mode 100644 index b27f023..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java +++ /dev/null @@ -1,38 +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.metrics; - -/** - * A metric which measure the rate at which some operation is invoked. - */ -public interface Meter extends Metric { - - /** - * Records one occurrence. - */ - void mark(); - - /** - * Records {@code events} occurrences. - * - * @param events Number of occurrences to record. - */ - void mark(long events); - -} - -// End Meter.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.java deleted file mode 100644 index fe133da..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.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. - */ -package org.apache.calcite.avatica.metrics; - -/** - * Parent interface for all metrics. - */ -public interface Metric { - -} - -// End Metric.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java deleted file mode 100644 index 0d1cb4b..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java +++ /dev/null @@ -1,68 +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.metrics; - -/** - * General purpose factory for creating various metrics. Modeled off of the Dropwizard Metrics API. - */ -public interface MetricsSystem { - - /** - * Get or construct a {@link Timer} used to measure durations and report rates. - * - * @param name The name of the Timer. - * @return An instance of {@link Timer}. - */ - Timer getTimer(String name); - - /** - * Get or construct a {@link Histogram} used to measure a distribution of values. - * - * @param name The name of the Histogram. - * @return An instance of {@link Histogram}. - */ - Histogram getHistogram(String name); - - /** - * Get or construct a {@link Meter} used to measure durations and report distributions (a - * combination of a {@link Timer} and a {@link Histogram}. - * - * @param name The name of the Meter. - * @return An instance of {@link Meter}. - */ - Meter getMeter(String name); - - /** - * Get or construct a {@link Counter} used to track a mutable number. - * - * @param name The name of the Counter - * @return An instance of {@link Counter}. - */ - Counter getCounter(String name); - - /** - * Register a {@link Gauge}. The Gauge will be invoked at a period defined by the implementation - * of {@link MetricsSystem}. - * - * @param name The name of the Gauge. - * @param gauge A callback to compute the current value. - */ - <T> void register(String name, Gauge<T> gauge); - -} - -// End MetricsSystem.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java deleted file mode 100644 index 99b6e8c..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java +++ /dev/null @@ -1,33 +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.metrics; - -/** - * A container used by a {@link MetricsSystemFactory} to create a {@link MetricsSystem}. - * - * @param <T> Configuration/State for the {@link MetricsSystem}. - */ -public interface MetricsSystemConfiguration<T> { - - /** - * @return Some state or configuration to create a {@link MetricsSystem}. - */ - T get(); - -} - -// End MetricsSystemConfiguration.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java deleted file mode 100644 index 484b230..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java +++ /dev/null @@ -1,32 +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.metrics; - -/** - * A factory class for creating instances of {@link MetricsSystem}. - */ -public interface MetricsSystemFactory { - - /** - * Creates an instance of a {@link MetricsSystem}. - * - * @return A new {@link MetricsSystem}. - */ - MetricsSystem create(MetricsSystemConfiguration<?> config); -} - -// End MetricsSystemFactory.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java deleted file mode 100644 index 3a15c5b..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.calcite.avatica.metrics; - -import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.ServiceLoader; - -/** - * A utility encapsulating use of {@link ServiceLoader} to instantiate a {@link MetricsSystem}. - */ -public class MetricsSystemLoader { - private static final Logger LOG = LoggerFactory.getLogger(MetricsSystemLoader.class); - private static final MetricsSystemLoader INSTANCE = new MetricsSystemLoader(); - - private MetricsSystemLoader() {} - - /** - * Creates a {@link MetricsSystem} instance using the corresponding {@link MetricsSystemFactory} - * available to {@link ServiceLoader} on the classpath. If there is not exactly one instance of - * a {@link MetricsSystemFactory}, an instance of {@link NoopMetricsSystem} will be returned. - * - * @param config State to pass to the {@link MetricsSystemFactory}. - * @return A {@link MetricsSystem} implementation. - */ - public static MetricsSystem load(MetricsSystemConfiguration<?> config) { - return INSTANCE._load(Objects.requireNonNull(config)); - } - - MetricsSystem _load(MetricsSystemConfiguration<?> config) { - List<MetricsSystemFactory> availableFactories = getFactories(); - - if (1 == availableFactories.size()) { - // One and only one instance -- what we want/expect - MetricsSystemFactory factory = availableFactories.get(0); - LOG.info("Loaded MetricsSystem {}", factory.getClass()); - return factory.create(config); - } else if (availableFactories.isEmpty()) { - // None-provided default to no metrics - LOG.info("No metrics implementation available on classpath. Using No-op implementation"); - return NoopMetricsSystem.getInstance(); - } else { - // Tell the user they're doing something wrong, and choose the first impl. - StringBuilder sb = new StringBuilder(); - for (MetricsSystemFactory factory : availableFactories) { - if (sb.length() > 0) { - sb.append(", "); - } - sb.append(factory.getClass()); - } - LOG.warn("Found multiple MetricsSystemFactory implementations: {}." - + " Using No-op implementation", sb); - return NoopMetricsSystem.getInstance(); - } - } - - List<MetricsSystemFactory> getFactories() { - ServiceLoader<MetricsSystemFactory> loader = ServiceLoader.load(MetricsSystemFactory.class); - List<MetricsSystemFactory> availableFactories = new ArrayList<>(); - for (MetricsSystemFactory factory : loader) { - availableFactories.add(factory); - } - return availableFactories; - } -} - -// End MetricsSystemLoader.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java deleted file mode 100644 index e627d31..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java +++ /dev/null @@ -1,37 +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.metrics; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * This is a dummy annotation that forces javac to produce output for - * otherwise empty package-info.java. - * - * <p>The result is maven-compiler-plugin can properly identify the scope of - * changed files - * - * <p>See more details in - * <a href="https://jira.codehaus.org/browse/MCOMPILER-205"> - * maven-compiler-plugin: incremental compilation broken</a> - */ -@Retention(RetentionPolicy.SOURCE) -public @interface PackageMarker { -} - -// End PackageMarker.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java deleted file mode 100644 index be792cc..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java +++ /dev/null @@ -1,37 +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.metrics; - -/** - * A metric which encompasses a {@link Histogram} and {@link Meter}. - */ -public interface Timer extends Metric { - - Context start(); - - /** - * A object that tracks an active timing state. - */ - public interface Context extends AutoCloseable { - /** - * Stops the timer. - */ - void close(); - } -} - -// End Timer.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java deleted file mode 100644 index 9ce8476..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java +++ /dev/null @@ -1,36 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.Counter; - -/** - * {@link Counter} implementation which does nothing. - */ -public class NoopCounter implements Counter { - - @Override public void increment() {} - - @Override public void increment(long n) {} - - @Override public void decrement() {} - - @Override public void decrement(long n) {} - -} - -// End NoopCounter.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java deleted file mode 100644 index ee056e9..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java +++ /dev/null @@ -1,32 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.Histogram; - -/** - * {@link Histogram} which does nothing. - */ -public class NoopHistogram implements Histogram { - - @Override public void update(int value) {} - - @Override public void update(long value) {} - -} - -// End NoopHistogram.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java deleted file mode 100644 index 4ad68c9..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java +++ /dev/null @@ -1,32 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.Meter; - -/** - * {@link Meter} which does nothing. - */ -public class NoopMeter implements Meter { - - @Override public void mark() {} - - @Override public void mark(long events) {} - -} - -// End NoopMeter.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java deleted file mode 100644 index 12b5af1..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java +++ /dev/null @@ -1,69 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.Counter; -import org.apache.calcite.avatica.metrics.Gauge; -import org.apache.calcite.avatica.metrics.Histogram; -import org.apache.calcite.avatica.metrics.Meter; -import org.apache.calcite.avatica.metrics.Metric; -import org.apache.calcite.avatica.metrics.MetricsSystem; -import org.apache.calcite.avatica.metrics.Timer; - -/** - * {@link MetricsSystem} implementation which does nothing. Returns {@link Metric} implementations - * which also does nothing (avoiding null instances). - */ -public class NoopMetricsSystem implements MetricsSystem { - - private static final NoopMetricsSystem NOOP_METRICS = new NoopMetricsSystem(); - - private static final Timer TIMER = new NoopTimer(); - private static final Histogram HISTOGRAM = new NoopHistogram(); - private static final Meter METER = new NoopMeter(); - private static final Counter COUNTER = new NoopCounter(); - - /** - * @return A {@link NoopMetricsSystem} instance. - */ - public static NoopMetricsSystem getInstance() { - return NOOP_METRICS; - } - - private NoopMetricsSystem() {} - - @Override public Timer getTimer(String name) { - return TIMER; - } - - @Override public Histogram getHistogram(String name) { - return HISTOGRAM; - } - - @Override public Meter getMeter(String name) { - return METER; - } - - @Override public Counter getCounter(String name) { - return COUNTER; - } - - @Override public <T> void register(String name, Gauge<T> gauge) {} - -} - -// End NoopMetricsSystem.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java deleted file mode 100644 index 42b3f24..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java +++ /dev/null @@ -1,40 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration; - -/** - * An empty configuration for the {@link NoopMetricsSystem}. - */ -public class NoopMetricsSystemConfiguration implements MetricsSystemConfiguration<Void> { - - private static final NoopMetricsSystemConfiguration INSTANCE = - new NoopMetricsSystemConfiguration(); - - public static NoopMetricsSystemConfiguration getInstance() { - return INSTANCE; - } - - private NoopMetricsSystemConfiguration() {} - - @Override public Void get() { - return null; - } -} - -// End NoopMetricsSystemConfiguration.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java deleted file mode 100644 index c15f978..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java +++ /dev/null @@ -1,35 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration; -import org.apache.calcite.avatica.metrics.MetricsSystemFactory; - -/** - * A {@link MetricsSystemFactory} for the {@link NoopMetricsSystem}. - * - * No service file is provided for this implementation. It is the fallback implementation if - * no implementation or more than one implementation is found on the classpath. - */ -public class NoopMetricsSystemFactory implements MetricsSystemFactory { - - @Override public NoopMetricsSystem create(MetricsSystemConfiguration<?> config) { - return NoopMetricsSystem.getInstance(); - } -} - -// End NoopMetricsSystemFactory.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java deleted file mode 100644 index a45cd63..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java +++ /dev/null @@ -1,43 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.Timer; -import org.apache.calcite.avatica.metrics.Timer.Context; - -/** - * {@link Timer} which does nothing. - */ -public class NoopTimer implements Timer { - - private static final NoopContext CONTEXT = new NoopContext(); - - @Override public NoopContext start() { - return CONTEXT; - } - - /** - * {@link Context} which does nothing. - */ - public static class NoopContext implements Context { - - @Override public void close() {} - - } -} - -// End NoopTimer.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/package-info.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/package-info.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/package-info.java deleted file mode 100644 index 826a655..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/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. - */ - -/** - * No-operation implementation for the Avatica Metrics framework. - */ -@PackageMarker -package org.apache.calcite.avatica.metrics.noop; - -import org.apache.calcite.avatica.metrics.PackageMarker; - -// End package-info.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java b/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java deleted file mode 100644 index efed28c..0000000 --- a/avatica-metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java +++ /dev/null @@ -1,24 +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. - */ - -/** - * Metrics for the Avatica framework. - */ -@PackageMarker -package org.apache.calcite.avatica.metrics; - -// End package-info.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java b/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java deleted file mode 100644 index 1c405ee..0000000 --- a/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java +++ /dev/null @@ -1,114 +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.metrics; - -import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem; -import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystemConfiguration; - -import org.junit.Test; -import org.mockito.Mockito; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -/** - * Test class for {@link MetricsSystemLoader}. - */ -public class MetricsSystemLoaderTest { - - @Test public void testSingleInstance() { - final List<MetricsSystemFactory> factories = - Collections.<MetricsSystemFactory>singletonList(new MarkedNoopMetricsSystemFactory()); - MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class); - - Mockito.when(loader.getFactories()).thenReturn(factories); - Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod(); - - // One MetricsSystemFactory should return the MetricsSystem it creates - MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance()); - assertEquals(MarkedMetricsSystem.INSTANCE, system); - } - - @Test public void testMultipleInstances() { - // The type of the factories doesn't matter (we can send duplicates for testing purposes) - final List<MetricsSystemFactory> factories = - Arrays.<MetricsSystemFactory>asList(new MarkedNoopMetricsSystemFactory(), - new MarkedNoopMetricsSystemFactory()); - MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class); - - Mockito.when(loader.getFactories()).thenReturn(factories); - Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod(); - - // We had two factories loaded, therefore we'll fall back to the NoopMetricsSystem - MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance()); - assertEquals(NoopMetricsSystem.getInstance(), system); - } - - @Test public void testNoInstances() { - // The type of the factories doesn't matter (we can send duplicates for testing purposes) - final List<MetricsSystemFactory> factories = Collections.emptyList(); - MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class); - - Mockito.when(loader.getFactories()).thenReturn(factories); - Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod(); - - // We had no factories loaded, therefore we'll fall back to the NoopMetricsSystem - MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance()); - assertEquals(NoopMetricsSystem.getInstance(), system); - } - - /** - * A test factory implementation which can return a recognized MetricsSystem implementation. - */ - private static class MarkedNoopMetricsSystemFactory implements MetricsSystemFactory { - public MarkedMetricsSystem create(MetricsSystemConfiguration<?> config) { - return MarkedMetricsSystem.INSTANCE; - } - } - - /** - * A metrics system implementation that is identifiable for testing. - */ - private static class MarkedMetricsSystem implements MetricsSystem { - private static final MarkedMetricsSystem INSTANCE = new MarkedMetricsSystem(); - - private MarkedMetricsSystem() {} - - @Override public Timer getTimer(String name) { - return null; - } - - @Override public Histogram getHistogram(String name) { - return null; - } - - @Override public Meter getMeter(String name) { - return null; - } - - @Override public Counter getCounter(String name) { - return null; - } - - @Override public <T> void register(String name, Gauge<T> gauge) {} - } -} - -// End MetricsSystemLoaderTest.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java b/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java deleted file mode 100644 index 3060b2f..0000000 --- a/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java +++ /dev/null @@ -1,37 +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.metrics.noop; - -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -/** - * Test class for {@link NoopMetricsSystemFactory}. - */ -public class NoopMetricsSystemFactoryTest { - - @Test public void testSingleton() { - NoopMetricsSystemFactory factory = new NoopMetricsSystemFactory(); - NoopMetricsSystemConfiguration config = NoopMetricsSystemConfiguration.getInstance(); - assertTrue("The factory should only return one NoopMetricsSystem instance", - factory.create(config) == factory.create(config)); - } - -} - -// End NoopMetricsSystemFactoryTest.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java b/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java deleted file mode 100644 index f28d123..0000000 --- a/avatica-metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java +++ /dev/null @@ -1,73 +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.metrics.noop; - -import org.apache.calcite.avatica.metrics.Counter; -import org.apache.calcite.avatica.metrics.Gauge; -import org.apache.calcite.avatica.metrics.Histogram; -import org.apache.calcite.avatica.metrics.Meter; -import org.apache.calcite.avatica.metrics.MetricsSystem; -import org.apache.calcite.avatica.metrics.Timer; -import org.apache.calcite.avatica.metrics.Timer.Context; - -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -/** - * Tests for {@link NoopMetricsSystem}. - */ -public class NoopMetricsSystemTest { - - @Test public void testNoNulls() { - // The NOOP implementation should act as a real implementation, no "nulls" allowed. - MetricsSystem metrics = NoopMetricsSystem.getInstance(); - - Counter counter = metrics.getCounter("counter"); - counter.decrement(); - counter.increment(); - counter.decrement(1L); - counter.increment(1L); - - Histogram histogram = metrics.getHistogram("histogram"); - histogram.update(1); - histogram.update(1L); - - Timer timer = metrics.getTimer("timer"); - Context context = timer.start(); - context.close(); - Context contextTwo = timer.start(); - assertTrue("Timer's context should be a singleton", context == contextTwo); - - Meter meter = metrics.getMeter("meter"); - meter.mark(); - meter.mark(5L); - - metrics.register("gauge", new Gauge<Long>() { - @Override public Long getValue() { - return 42L; - } - }); - } - - @Test public void testSingleton() { - assertTrue("Should be a singleton", - NoopMetricsSystem.getInstance() == NoopMetricsSystem.getInstance()); - } -} - -// End NoopMetricsSystemTest.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-metrics/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/avatica-metrics/src/test/resources/log4j.properties b/avatica-metrics/src/test/resources/log4j.properties deleted file mode 100644 index 834e2db..0000000 --- a/avatica-metrics/src/test/resources/log4j.properties +++ /dev/null @@ -1,24 +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. - -# Root logger is configured at INFO and is sent to A1 -log4j.rootLogger=INFO, A1 - -# A1 goes to the console -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# Set the pattern for each log message -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-noop/pom.xml ---------------------------------------------------------------------- diff --git a/avatica-noop/pom.xml b/avatica-noop/pom.xml deleted file mode 100644 index 3a05cdd..0000000 --- a/avatica-noop/pom.xml +++ /dev/null @@ -1,110 +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</groupId> - <artifactId>calcite</artifactId> - <version>1.7.0-SNAPSHOT</version> - </parent> - - <artifactId>calcite-avatica-noop</artifactId> - <packaging>jar</packaging> - <name>Calcite Avatica Noop</name> - <description>A Noop JDBC driver.</description> - - <properties> - <top.dir>${project.basedir}/..</top.dir> - </properties> - - <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> - - <!-- Produce a tests jar so that avatica-server/pom.xml can reference for suite. - TODO: remove after moving over to annotation-based TestSuite definitions. --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-remote-resources-plugin</artifactId> - <executions> - <execution> - <id>non-root-resources</id> - <goals> - <goal>process</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java ---------------------------------------------------------------------- diff --git a/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java b/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java deleted file mode 100644 index 6870717..0000000 --- a/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java +++ /dev/null @@ -1,256 +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.noop; - -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.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.Collections; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.Executor; - -/** - * A {@link Connection} implementation which does nothing. - */ -public class AvaticaNoopConnection implements Connection { - - private static final AvaticaNoopConnection INSTANCE = new AvaticaNoopConnection(); - - public static AvaticaNoopConnection getInstance() { - return INSTANCE; - } - - private AvaticaNoopConnection() {} - - private UnsupportedOperationException unsupported() { - return new UnsupportedOperationException("Unsupported"); - } - - @Override public <T> T unwrap(Class<T> iface) throws SQLException { - throw unsupported(); - } - - @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { - throw unsupported(); - } - - @Override public Statement createStatement() throws SQLException { - return AvaticaNoopStatement.getInstance(); - } - - @Override public PreparedStatement prepareStatement(String sql) throws SQLException { - return AvaticaNoopPreparedStatement.getInstance(); - } - - @Override public CallableStatement prepareCall(String sql) throws SQLException { - throw unsupported(); - } - - @Override public String nativeSQL(String sql) throws SQLException { - throw unsupported(); - } - - @Override public void setAutoCommit(boolean autoCommit) throws SQLException {} - - @Override public boolean getAutoCommit() throws SQLException { - return false; - } - - @Override public void commit() throws SQLException {} - - @Override public void rollback() throws SQLException {} - - @Override public void close() throws SQLException {} - - @Override public boolean isClosed() throws SQLException { - return true; - } - - @Override public DatabaseMetaData getMetaData() throws SQLException { - return AvaticaNoopDatabaseMetaData.getInstance(); - } - - @Override public void setReadOnly(boolean readOnly) throws SQLException {} - - @Override public boolean isReadOnly() throws SQLException { - return false; - } - - @Override public void setCatalog(String catalog) throws SQLException {} - - @Override public String getCatalog() throws SQLException { - return null; - } - - @Override public void setTransactionIsolation(int level) throws SQLException {} - - @Override public int getTransactionIsolation() throws SQLException { - return 0; - } - - @Override public SQLWarning getWarnings() throws SQLException { - return null; - } - - @Override public void clearWarnings() throws SQLException {} - - @Override public Statement createStatement(int resultSetType, int resultSetConcurrency) - throws SQLException { - return AvaticaNoopStatement.getInstance(); - } - - @Override public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - return AvaticaNoopPreparedStatement.getInstance(); - } - - @Override public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - throw unsupported(); - } - - @Override public Map<String, Class<?>> getTypeMap() throws SQLException { - return Collections.emptyMap(); - } - - @Override public void setTypeMap(Map<String, Class<?>> map) throws SQLException {} - - @Override public void setHoldability(int holdability) throws SQLException {} - - @Override public int getHoldability() throws SQLException { - throw unsupported(); - } - - @Override public Savepoint setSavepoint() throws SQLException { - throw unsupported(); - } - - @Override public Savepoint setSavepoint(String name) throws SQLException { - throw unsupported(); - } - - @Override public void rollback(Savepoint savepoint) throws SQLException { - throw unsupported(); - } - - @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { - throw unsupported(); - } - - @Override public Statement createStatement(int resultSetType, int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - return AvaticaNoopStatement.getInstance(); - } - - @Override public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) throws SQLException { - return AvaticaNoopPreparedStatement.getInstance(); - } - - @Override public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) throws SQLException { - throw unsupported(); - } - - @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - return AvaticaNoopPreparedStatement.getInstance(); - } - - @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - return AvaticaNoopPreparedStatement.getInstance(); - } - - @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - return AvaticaNoopPreparedStatement.getInstance(); - } - - @Override public Clob createClob() throws SQLException { - throw unsupported(); - } - - @Override public Blob createBlob() throws SQLException { - throw unsupported(); - } - - @Override public NClob createNClob() throws SQLException { - throw unsupported(); - } - - @Override public SQLXML createSQLXML() throws SQLException { - throw unsupported(); - } - - @Override public boolean isValid(int timeout) throws SQLException { - return true; - } - - @Override public void setClientInfo(String name, String value) throws SQLClientInfoException {} - - @Override public void setClientInfo(Properties properties) throws SQLClientInfoException {} - - @Override public String getClientInfo(String name) throws SQLException { - throw unsupported(); - } - - @Override public Properties getClientInfo() throws SQLException { - throw unsupported(); - } - - @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { - throw unsupported(); - } - - @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { - throw unsupported(); - } - - @Override public void setSchema(String schema) throws SQLException {} - - @Override public String getSchema() throws SQLException { - return null; - } - - @Override public void abort(Executor executor) throws SQLException { - throw unsupported(); - } - - @Override public void setNetworkTimeout(Executor executor, int milliseconds) - throws SQLException {} - - @Override public int getNetworkTimeout() throws SQLException { - throw unsupported(); - } - -} - -// End AvaticaNoopConnection.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java ---------------------------------------------------------------------- diff --git a/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java b/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java deleted file mode 100644 index 2b58590..0000000 --- a/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java +++ /dev/null @@ -1,770 +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.noop; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.SQLException; - -/** - * A {@link DatabaseMetaData} implementation which does nothing. - */ -public class AvaticaNoopDatabaseMetaData implements DatabaseMetaData { - - private static final AvaticaNoopDatabaseMetaData INSTANCE = new AvaticaNoopDatabaseMetaData(); - - public static AvaticaNoopDatabaseMetaData getInstance() { - return INSTANCE; - } - - private AvaticaNoopDatabaseMetaData() {} - - private UnsupportedOperationException unsupported() { - return new UnsupportedOperationException("Unsupported"); - } - - @Override public <T> T unwrap(Class<T> iface) throws SQLException { - throw unsupported(); - } - - @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { - return false; - } - - @Override public boolean allProceduresAreCallable() throws SQLException { - return false; - } - - @Override public boolean allTablesAreSelectable() throws SQLException { - return false; - } - - @Override public String getURL() throws SQLException { - throw unsupported(); - } - - @Override public String getUserName() throws SQLException { - throw unsupported(); - } - - @Override public boolean isReadOnly() throws SQLException { - return false; - } - - @Override public boolean nullsAreSortedHigh() throws SQLException { - return false; - } - - @Override public boolean nullsAreSortedLow() throws SQLException { - return false; - } - - @Override public boolean nullsAreSortedAtStart() throws SQLException { - return false; - } - - @Override public boolean nullsAreSortedAtEnd() throws SQLException { - return false; - } - - @Override public String getDatabaseProductName() throws SQLException { - throw unsupported(); - } - - @Override public String getDatabaseProductVersion() throws SQLException { - throw unsupported(); - } - - @Override public String getDriverName() throws SQLException { - throw unsupported(); - } - - @Override public String getDriverVersion() throws SQLException { - throw unsupported(); - } - - @Override public int getDriverMajorVersion() { - return 0; - } - - @Override public int getDriverMinorVersion() { - return 0; - } - - @Override public boolean usesLocalFiles() throws SQLException { - return false; - } - - @Override public boolean usesLocalFilePerTable() throws SQLException { - return false; - } - - @Override public boolean supportsMixedCaseIdentifiers() throws SQLException { - return false; - } - - @Override public boolean storesUpperCaseIdentifiers() throws SQLException { - return false; - } - - @Override public boolean storesLowerCaseIdentifiers() throws SQLException { - return false; - } - - @Override public boolean storesMixedCaseIdentifiers() throws SQLException { - return false; - } - - @Override public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { - return false; - } - - @Override public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { - return false; - } - - @Override public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { - return false; - } - - @Override public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { - return false; - } - - @Override public String getIdentifierQuoteString() throws SQLException { - throw unsupported(); - } - - @Override public String getSQLKeywords() throws SQLException { - throw unsupported(); - } - - @Override public String getNumericFunctions() throws SQLException { - throw unsupported(); - } - - @Override public String getStringFunctions() throws SQLException { - throw unsupported(); - } - - @Override public String getSystemFunctions() throws SQLException { - throw unsupported(); - } - - @Override public String getTimeDateFunctions() throws SQLException { - throw unsupported(); - } - - @Override public String getSearchStringEscape() throws SQLException { - throw unsupported(); - } - - @Override public String getExtraNameCharacters() throws SQLException { - throw unsupported(); - } - - @Override public boolean supportsAlterTableWithAddColumn() throws SQLException { - return false; - } - - @Override public boolean supportsAlterTableWithDropColumn() throws SQLException { - return false; - } - - @Override public boolean supportsColumnAliasing() throws SQLException { - return false; - } - - @Override public boolean nullPlusNonNullIsNull() throws SQLException { - return false; - } - - @Override public boolean supportsConvert() throws SQLException { - return false; - } - - @Override public boolean supportsConvert(int fromType, int toType) throws SQLException { - return false; - } - - @Override public boolean supportsTableCorrelationNames() throws SQLException { - return false; - } - - @Override public boolean supportsDifferentTableCorrelationNames() throws SQLException { - return false; - } - - @Override public boolean supportsExpressionsInOrderBy() throws SQLException { - return false; - } - - @Override public boolean supportsOrderByUnrelated() throws SQLException { - return false; - } - - @Override public boolean supportsGroupBy() throws SQLException { - return false; - } - - @Override public boolean supportsGroupByUnrelated() throws SQLException { - return false; - } - - @Override public boolean supportsGroupByBeyondSelect() throws SQLException { - return false; - } - - @Override public boolean supportsLikeEscapeClause() throws SQLException { - return false; - } - - @Override public boolean supportsMultipleResultSets() throws SQLException { - return false; - } - - @Override public boolean supportsMultipleTransactions() throws SQLException { - return false; - } - - @Override public boolean supportsNonNullableColumns() throws SQLException { - return false; - } - - @Override public boolean supportsMinimumSQLGrammar() throws SQLException { - return false; - } - - @Override public boolean supportsCoreSQLGrammar() throws SQLException { - return false; - } - - @Override public boolean supportsExtendedSQLGrammar() throws SQLException { - return false; - } - - @Override public boolean supportsANSI92EntryLevelSQL() throws SQLException { - return false; - } - - @Override public boolean supportsANSI92IntermediateSQL() throws SQLException { - return false; - } - - @Override public boolean supportsANSI92FullSQL() throws SQLException { - return false; - } - - @Override public boolean supportsIntegrityEnhancementFacility() throws SQLException { - return false; - } - - @Override public boolean supportsOuterJoins() throws SQLException { - return false; - } - - @Override public boolean supportsFullOuterJoins() throws SQLException { - return false; - } - - @Override public boolean supportsLimitedOuterJoins() throws SQLException { - return false; - } - - @Override public String getSchemaTerm() throws SQLException { - throw unsupported(); - } - - @Override public String getProcedureTerm() throws SQLException { - throw unsupported(); - } - - @Override public String getCatalogTerm() throws SQLException { - throw unsupported(); - } - - @Override public boolean isCatalogAtStart() throws SQLException { - return false; - } - - @Override public String getCatalogSeparator() throws SQLException { - throw unsupported(); - } - - @Override public boolean supportsSchemasInDataManipulation() throws SQLException { - return false; - } - - @Override public boolean supportsSchemasInProcedureCalls() throws SQLException { - return false; - } - - @Override public boolean supportsSchemasInTableDefinitions() throws SQLException { - return false; - } - - @Override public boolean supportsSchemasInIndexDefinitions() throws SQLException { - return false; - } - - @Override public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { - return false; - } - - @Override public boolean supportsCatalogsInDataManipulation() throws SQLException { - return false; - } - - @Override public boolean supportsCatalogsInProcedureCalls() throws SQLException { - return false; - } - - @Override public boolean supportsCatalogsInTableDefinitions() throws SQLException { - return false; - } - - @Override public boolean supportsCatalogsInIndexDefinitions() throws SQLException { - return false; - } - - @Override public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { - return false; - } - - @Override public boolean supportsPositionedDelete() throws SQLException { - return false; - } - - @Override public boolean supportsPositionedUpdate() throws SQLException { - return false; - } - - @Override public boolean supportsSelectForUpdate() throws SQLException { - return false; - } - - @Override public boolean supportsStoredProcedures() throws SQLException { - return false; - } - - @Override public boolean supportsSubqueriesInComparisons() throws SQLException { - return false; - } - - @Override public boolean supportsSubqueriesInExists() throws SQLException { - return false; - } - - @Override public boolean supportsSubqueriesInIns() throws SQLException { - return false; - } - - @Override public boolean supportsSubqueriesInQuantifieds() throws SQLException { - return false; - } - - @Override public boolean supportsCorrelatedSubqueries() throws SQLException { - return false; - } - - @Override public boolean supportsUnion() throws SQLException { - return false; - } - - @Override public boolean supportsUnionAll() throws SQLException { - return false; - } - - @Override public boolean supportsOpenCursorsAcrossCommit() throws SQLException { - return false; - } - - @Override public boolean supportsOpenCursorsAcrossRollback() throws SQLException { - return false; - } - - @Override public boolean supportsOpenStatementsAcrossCommit() throws SQLException { - return false; - } - - @Override public boolean supportsOpenStatementsAcrossRollback() throws SQLException { - return false; - } - - @Override public int getMaxBinaryLiteralLength() throws SQLException { - return 0; - } - - @Override public int getMaxCharLiteralLength() throws SQLException { - return 0; - } - - @Override public int getMaxColumnNameLength() throws SQLException { - return 0; - } - - @Override public int getMaxColumnsInGroupBy() throws SQLException { - return 0; - } - - @Override public int getMaxColumnsInIndex() throws SQLException { - return 0; - } - - @Override public int getMaxColumnsInOrderBy() throws SQLException { - return 0; - } - - @Override public int getMaxColumnsInSelect() throws SQLException { - return 0; - } - - @Override public int getMaxColumnsInTable() throws SQLException { - return 0; - } - - @Override public int getMaxConnections() throws SQLException { - return 0; - } - - @Override public int getMaxCursorNameLength() throws SQLException { - return 0; - } - - @Override public int getMaxIndexLength() throws SQLException { - return 0; - } - - @Override public int getMaxSchemaNameLength() throws SQLException { - return 0; - } - - @Override public int getMaxProcedureNameLength() throws SQLException { - return 0; - } - - @Override public int getMaxCatalogNameLength() throws SQLException { - return 0; - } - - @Override public int getMaxRowSize() throws SQLException { - return 0; - } - - @Override public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { - return false; - } - - @Override public int getMaxStatementLength() throws SQLException { - return 0; - } - - @Override public int getMaxStatements() throws SQLException { - return 0; - } - - @Override public int getMaxTableNameLength() throws SQLException { - return 0; - } - - @Override public int getMaxTablesInSelect() throws SQLException { - return 0; - } - - @Override public int getMaxUserNameLength() throws SQLException { - return 0; - } - - @Override public int getDefaultTransactionIsolation() throws SQLException { - return 0; - } - - @Override public boolean supportsTransactions() throws SQLException { - return false; - } - - @Override public boolean supportsTransactionIsolationLevel(int level) throws SQLException { - return false; - } - - @Override public boolean supportsDataDefinitionAndDataManipulationTransactions() - throws SQLException { - return false; - } - - @Override public boolean supportsDataManipulationTransactionsOnly() throws SQLException { - return false; - } - - @Override public boolean dataDefinitionCausesTransactionCommit() throws SQLException { - return false; - } - - @Override public boolean dataDefinitionIgnoredInTransactions() throws SQLException { - return false; - } - - @Override public ResultSet getProcedures(String catalog, String schemaPattern, - String procedureNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getProcedureColumns(String catalog, String schemaPattern, - String procedureNamePattern, String columnNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getTables(String catalog, String schemaPattern, - String tableNamePattern, String[] types) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getSchemas() throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getCatalogs() throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getTableTypes() throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getColumns(String catalog, String schemaPattern, - String tableNamePattern, String columnNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getColumnPrivileges(String catalog, String schema, String table, - String columnNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getTablePrivileges(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getBestRowIdentifier(String catalog, String schema, String table, - int scope, boolean nullable) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getVersionColumns(String catalog, String schema, String table) - throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) - throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getImportedKeys(String catalog, String schema, String table) - throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getExportedKeys(String catalog, String schema, String table) - throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema, - String parentTable, String foreignCatalog, String foreignSchema, - String foreignTable) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getTypeInfo() throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getIndexInfo(String catalog, String schema, String table, - boolean unique, boolean approximate) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public boolean supportsResultSetType(int type) throws SQLException { - return false; - } - - @Override public boolean supportsResultSetConcurrency(int type, int concurrency) - throws SQLException { - return false; - } - - @Override public boolean ownUpdatesAreVisible(int type) throws SQLException { - return false; - } - - @Override public boolean ownDeletesAreVisible(int type) throws SQLException { - return false; - } - - @Override public boolean ownInsertsAreVisible(int type) throws SQLException { - return false; - } - - @Override public boolean othersUpdatesAreVisible(int type) throws SQLException { - return false; - } - - @Override public boolean othersDeletesAreVisible(int type) throws SQLException { - return false; - } - - @Override public boolean othersInsertsAreVisible(int type) throws SQLException { - return false; - } - - @Override public boolean updatesAreDetected(int type) throws SQLException { - return false; - } - - @Override public boolean deletesAreDetected(int type) throws SQLException { - return false; - } - - @Override public boolean insertsAreDetected(int type) throws SQLException { - return false; - } - - @Override public boolean supportsBatchUpdates() throws SQLException { - return false; - } - - @Override public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, - int[] types) throws SQLException { - throw unsupported(); - } - - @Override public Connection getConnection() throws SQLException { - throw unsupported(); - } - - @Override public boolean supportsSavepoints() throws SQLException { - return false; - } - - @Override public boolean supportsNamedParameters() throws SQLException { - return false; - } - - @Override public boolean supportsMultipleOpenResults() throws SQLException { - return false; - } - - @Override public boolean supportsGetGeneratedKeys() throws SQLException { - return false; - } - - @Override public ResultSet getSuperTypes(String catalog, String schemaPattern, - String typeNamePattern) throws SQLException { - throw unsupported(); - } - - @Override public ResultSet getSuperTables(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { - throw unsupported(); - } - - @Override public ResultSet getAttributes(String catalog, String schemaPattern, - String typeNamePattern, String attributeNamePattern) throws SQLException { - throw unsupported(); - } - - @Override public boolean supportsResultSetHoldability(int holdability) throws SQLException { - return false; - } - - @Override public int getResultSetHoldability() throws SQLException { - return 0; - } - - @Override public int getDatabaseMajorVersion() throws SQLException { - return 0; - } - - @Override public int getDatabaseMinorVersion() throws SQLException { - return 0; - } - - @Override public int getJDBCMajorVersion() throws SQLException { - return 0; - } - - @Override public int getJDBCMinorVersion() throws SQLException { - return 0; - } - - @Override public int getSQLStateType() throws SQLException { - return 0; - } - - @Override public boolean locatorsUpdateCopy() throws SQLException { - return false; - } - - @Override public boolean supportsStatementPooling() throws SQLException { - return false; - } - - @Override public RowIdLifetime getRowIdLifetime() throws SQLException { - throw unsupported(); - } - - @Override public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException { - throw unsupported(); - } - - @Override public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { - return false; - } - - @Override public boolean autoCommitFailureClosesAllResultSets() throws SQLException { - return false; - } - - @Override public ResultSet getClientInfoProperties() throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getFunctions(String catalog, String schemaPattern, - String functionNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getFunctionColumns(String catalog, String schemaPattern, - String functionNamePattern, String columnNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public ResultSet getPseudoColumns(String catalog, String schemaPattern, - String tableNamePattern, String columnNamePattern) throws SQLException { - return AvaticaNoopResultSet.getInstance(); - } - - @Override public boolean generatedKeyAlwaysReturned() throws SQLException { - return false; - } -} - -// End AvaticaNoopDatabaseMetaData.java http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java ---------------------------------------------------------------------- diff --git a/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java b/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java deleted file mode 100644 index 76f5356..0000000 --- a/avatica-noop/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java +++ /dev/null @@ -1,74 +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.noop; - -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.Properties; -import java.util.logging.Logger; - -/** - * A Noop JDBC Driver. - */ -public class AvaticaNoopDriver implements Driver { - - private static final AvaticaNoopDriver INSTANCE = new AvaticaNoopDriver(); - - static { - try { - DriverManager.registerDriver(INSTANCE); - } catch (Exception e) { - System.err.println("Failed to register driver"); - e.printStackTrace(System.err); - } - } - - @Override public Connection connect(String url, Properties info) throws SQLException { - return AvaticaNoopConnection.getInstance(); - } - - @Override public boolean acceptsURL(String url) throws SQLException { - return url.startsWith("jdbc:avatica:noop"); - } - - @Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) - throws SQLException { - return new DriverPropertyInfo[0]; - } - - @Override public int getMajorVersion() { - return 1; - } - - @Override public int getMinorVersion() { - return 7; - } - - @Override public boolean jdbcCompliant() { - return true; - } - - @Override public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return Logger.getLogger(""); - } -} - -// End AvaticaNoopDriver.java
