All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cdap.cdap.app.guice.UnsupportedExploreClient Maven / Gradle / Ivy

There is a newer version: 6.10.1
Show newest version
/*
 * Copyright © 2018-2019 Cask Data, Inc.
 *
 * Licensed 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 io.cdap.cdap.app.guice;

import com.google.common.util.concurrent.ListenableFuture;
import io.cdap.cdap.api.dataset.DatasetSpecification;
import io.cdap.cdap.api.dataset.lib.PartitionKey;
import io.cdap.cdap.common.ServiceUnavailableException;
import io.cdap.cdap.explore.client.ExploreClient;
import io.cdap.cdap.explore.client.ExploreExecutionResult;
import io.cdap.cdap.explore.service.ExploreException;
import io.cdap.cdap.explore.service.MetaDataInfo;
import io.cdap.cdap.proto.NamespaceMeta;
import io.cdap.cdap.proto.id.DatasetId;
import io.cdap.cdap.proto.id.NamespaceId;
import io.cdap.cdap.security.spi.authentication.UnauthenticatedException;

import java.io.IOException;
import java.util.List;
import javax.annotation.Nullable;

/**
 * A {@link ExploreClient} implementation that throws {@link UnsupportedOperationException} on
 * every method call. This is used in runtime environment that explore is not supported.
 */
public final class UnsupportedExploreClient implements ExploreClient {
  @Override
  public void ping() throws UnauthenticatedException, ServiceUnavailableException, ExploreException {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture enableExploreDataset(DatasetId datasetInstance) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture enableExploreDataset(DatasetId datasetInstance,
                                                     DatasetSpecification spec, boolean truncating) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture updateExploreDataset(DatasetId datasetInstance,
                                                     DatasetSpecification oldSpec, DatasetSpecification newSpec) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture disableExploreDataset(DatasetId datasetInstance) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture disableExploreDataset(DatasetId datasetInstance, DatasetSpecification spec) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture addPartition(DatasetId datasetInstance, DatasetSpecification spec,
                                             PartitionKey key, String path) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture dropPartition(DatasetId datasetInstance, DatasetSpecification spec, PartitionKey key) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture concatenatePartition(DatasetId datasetInstance,
                                                     DatasetSpecification spec, PartitionKey key) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture submit(NamespaceId namespace, String statement) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture columns(@Nullable String catalog, @Nullable String schemaPattern,
                                                          String tableNamePattern, String columnNamePattern) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture catalogs() {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture schemas(@Nullable String catalog, @Nullable String schemaPattern) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture functions(@Nullable String catalog, @Nullable String schemaPattern,
                                                            String functionNamePattern) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture info(MetaDataInfo.InfoType infoType) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture tables(@Nullable String catalog, @Nullable String schemaPattern,
                                                         String tableNamePattern, @Nullable List tableTypes) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture tableTypes() {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture dataTypes() {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture addNamespace(NamespaceMeta namespaceMeta) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public ListenableFuture removeNamespace(NamespaceId namespace) {
    throw new UnsupportedOperationException("Explore is not supported. This method should not be called.");
  }

  @Override
  public void close() throws IOException {
    // no-op
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy