当前位置: 首页>>代码示例>>Java>>正文


Java AvaticaUtils.instantiatePlugin方法代码示例

本文整理汇总了Java中org.apache.calcite.avatica.AvaticaUtils.instantiatePlugin方法的典型用法代码示例。如果您正苦于以下问题:Java AvaticaUtils.instantiatePlugin方法的具体用法?Java AvaticaUtils.instantiatePlugin怎么用?Java AvaticaUtils.instantiatePlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.avatica.AvaticaUtils的用法示例。


在下文中一共展示了AvaticaUtils.instantiatePlugin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseDataSource

import org.apache.calcite.avatica.AvaticaUtils; //导入方法依赖的package包/类
private static DataSource parseDataSource(Map<String, Object> operand) throws IOException {
	final String connection = (String) operand.get("connection");

	Map<String, Object> jdbcConfig;
	if (connection != null) {
		try (InputStream connConfig = ClassLoader.getSystemResourceAsStream(connection)) {
			jdbcConfig = new ObjectMapper().readValue(
					connConfig,
					new TypeReference<Map<String, Object>>(){}
			);
		}
	} else {
		jdbcConfig = operand;
	}

	final String dataSourceName = (String) jdbcConfig.get("dataSource");
	if (dataSourceName != null) {
		return AvaticaUtils.instantiatePlugin(DataSource.class, dataSourceName);
	}

	final String jdbcUrl = (String) jdbcConfig.get("jdbcUrl");
	final String jdbcDriver = (String) jdbcConfig.get("jdbcDriver");
	final String jdbcUser = (String) jdbcConfig.get("jdbcUser");
	final String jdbcPassword = (String) jdbcConfig.get("jdbcPassword");
	return dataSource(jdbcUrl, jdbcDriver, jdbcUser, jdbcPassword);
}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:27,代码来源:JournalledJdbcSchema.java

示例2: toOp

import org.apache.calcite.avatica.AvaticaUtils; //导入方法依赖的package包/类
private SqlOperator toOp(String op, Map<String, Object> map) {
  // TODO: build a map, for more efficient lookup
  // TODO: look up based on SqlKind
  final List<SqlOperator> operatorList =
      SqlStdOperatorTable.instance().getOperatorList();
  for (SqlOperator operator : operatorList) {
    if (operator.getName().equals(op)) {
      return operator;
    }
  }
  String class_ = (String) map.get("class");
  if (class_ != null) {
    return AvaticaUtils.instantiatePlugin(SqlOperator.class, class_);
  }
  return null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:RelJson.java

示例3: visit

import org.apache.calcite.avatica.AvaticaUtils; //导入方法依赖的package包/类
public void visit(JsonCustomSchema jsonSchema) {
  try {
    final SchemaPlus parentSchema = currentMutableSchema("sub-schema");
    checkRequiredAttributes(jsonSchema, "name", "factory");
    final SchemaFactory schemaFactory =
        AvaticaUtils.instantiatePlugin(SchemaFactory.class,
            jsonSchema.factory);
    final Schema schema =
        schemaFactory.create(
            parentSchema, jsonSchema.name, operandMap(jsonSchema, jsonSchema.operand));
    final SchemaPlus schemaPlus = parentSchema.add(jsonSchema.name, schema);
    populateSchema(jsonSchema, schemaPlus);
  } catch (Exception e) {
    throw new RuntimeException("Error instantiating " + jsonSchema, e);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:ModelHandler.java

示例4: build

import org.apache.calcite.avatica.AvaticaUtils; //导入方法依赖的package包/类
/** Builds a lattice. */
public Lattice build() {
  LatticeStatisticProvider.Factory statisticProvider =
      this.statisticProvider != null
          ? AvaticaUtils.instantiatePlugin(
              LatticeStatisticProvider.Factory.class,
              this.statisticProvider)
          : Lattices.CACHED_SQL;
  Preconditions.checkArgument(rootSchema.isRoot(), "must be root schema");
  return new Lattice(rootSchema, ImmutableList.copyOf(nodes), auto,
      algorithm, algorithmMaxMillis, statisticProvider, rowCountEstimate,
      columns, defaultMeasureListBuilder.build(), tileListBuilder.build());
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:Lattice.java

示例5: create

import org.apache.calcite.avatica.AvaticaUtils; //导入方法依赖的package包/类
/**
 * Creates a JdbcSchema, taking credentials from a map.
 *
 * @param parentSchema Parent schema
 * @param name Name
 * @param operand Map of property/value pairs
 * @return A JdbcSchema
 */
public static JdbcSchema create(
    SchemaPlus parentSchema,
    String name,
    Map<String, Object> operand) {
  DataSource dataSource;
  try {
    final String dataSourceName = (String) operand.get("dataSource");
    if (dataSourceName != null) {
      dataSource =
          AvaticaUtils.instantiatePlugin(DataSource.class, dataSourceName);
    } else {
      final String jdbcUrl = (String) operand.get("jdbcUrl");
      final String jdbcDriver = (String) operand.get("jdbcDriver");
      final String jdbcUser = (String) operand.get("jdbcUser");
      final String jdbcPassword = (String) operand.get("jdbcPassword");
      dataSource = dataSource(jdbcUrl, jdbcDriver, jdbcUser, jdbcPassword);
    }
  } catch (Exception e) {
    throw new RuntimeException("Error while reading dataSource", e);
  }
  String jdbcCatalog = (String) operand.get("jdbcCatalog");
  String jdbcSchema = (String) operand.get("jdbcSchema");
  String sqlDialectFactory = (String) operand.get("sqlDialectFactory");

  if (sqlDialectFactory == null || sqlDialectFactory.isEmpty()) {
    return JdbcSchema.create(
        parentSchema, name, dataSource, jdbcCatalog, jdbcSchema);
  } else {
    SqlDialectFactory factory = AvaticaUtils.instantiatePlugin(
        SqlDialectFactory.class, sqlDialectFactory);
    return JdbcSchema.create(
        parentSchema, name, dataSource, factory, jdbcCatalog, jdbcSchema);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:43,代码来源:JdbcSchema.java


注:本文中的org.apache.calcite.avatica.AvaticaUtils.instantiatePlugin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。