io.cdap.plugin.db.ConnectionConfigAccessor Maven / Gradle / Ivy
/*
* Copyright © 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.plugin.db;
import com.google.common.base.Strings;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.hadoop.conf.Configuration;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Allows to specify and access connection configuration properties of {@link Configuration}.
*/
public class ConnectionConfigAccessor {
public static final String OVERRIDE_SCHEMA = "io.cdap.plugin.db.override.schema";
private static final String CONNECTION_ARGUMENTS = "io.cdap.plugin.db.connection.arguments";
private static final String INIT_QUERIES = "io.cdap.plugin.db.init.queries";
public static final String AUTO_COMMIT_ENABLED = "io.cdap.plugin.db.output.autocommit.enabled";
public static final String FETCH_SIZE = "io.cdap.plugin.db.fetch.size";
private static final Gson GSON = new Gson();
private static final Type STRING_MAP_TYPE = new TypeToken