gpt4 book ai didi

io.shardingsphere.core.yaml.sharding.YamlShardingRuleConfiguration类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 10:33:31 28 4
gpt4 key购买 nike

本文整理了Java中io.shardingsphere.core.yaml.sharding.YamlShardingRuleConfiguration类的一些代码示例,展示了YamlShardingRuleConfiguration类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlShardingRuleConfiguration类的具体详情如下:
包路径:io.shardingsphere.core.yaml.sharding.YamlShardingRuleConfiguration
类名称:YamlShardingRuleConfiguration

YamlShardingRuleConfiguration介绍

暂无

代码示例

代码示例来源:origin: io.shardingsphere/sharding-orchestration-core

/**
 * Load sharding rule configuration.
 *
 * @param data data
 * @return sharding rule configuration
 */
public static ShardingRuleConfiguration loadShardingRuleConfiguration(final String data) {
  return new Yaml().loadAs(data, YamlShardingRuleConfiguration.class).getShardingRuleConfiguration();
}

代码示例来源:origin: io.shardingsphere/sharding-orchestration-core

/**
 * Dump sharding rule configuration.
 *
 * @param shardingRuleConfig sharding rule configuration
 * @return YAML string
 */
public static String dumpShardingRuleConfiguration(final ShardingRuleConfiguration shardingRuleConfig) {
  return new Yaml(new DefaultYamlRepresenter()).dumpAsMap(new YamlShardingRuleConfiguration(shardingRuleConfig));
}

代码示例来源:origin: io.shardingsphere/sharding-jdbc-orchestration

private static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final YamlShardingRuleConfiguration yamlConfig, 
                      final Map<String, Object> configMap, final Properties props, final OrchestrationConfiguration orchestrationConfig) throws SQLException {
  if (null == yamlConfig) {
    return new OrchestrationShardingDataSource(orchestrationConfig);
  } else {
    ShardingDataSource shardingDataSource = new ShardingDataSource(
        dataSourceMap, new ShardingRule(yamlConfig.getShardingRuleConfiguration(), dataSourceMap.keySet()), configMap, props);
    return new OrchestrationShardingDataSource(shardingDataSource, orchestrationConfig);
  }
}

代码示例来源:origin: io.shardingsphere/sharding-jdbc-core

/**
 * Create sharding data source.
 *
 * @param dataSourceMap data source map
 * @param yamlFile yaml file for rule configuration of databases and tables sharding without data sources
 * @return sharding data source
 * @throws SQLException SQL exception
 * @throws IOException IO exception
 */
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException {
  YamlShardingConfiguration config = YamlShardingConfiguration.unmarshal(yamlFile);
  return ShardingDataSourceFactory.createDataSource(
      dataSourceMap, config.getShardingRule().getShardingRuleConfiguration(), config.getConfigMap(), config.getProps());
}

代码示例来源:origin: io.shardingsphere/sharding-jdbc-core

/**
   * Create sharding data source.
   *
   * @param dataSourceMap data source map
   * @param yamlBytes yaml bytes for rule configuration of databases and tables sharding without data sources
   * @return sharding data source
   * @throws SQLException SQL exception
   * @throws IOException IO exception
   */
  public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final byte[] yamlBytes) throws SQLException, IOException {
    YamlShardingConfiguration config = YamlShardingConfiguration.unmarshal(yamlBytes);
    return ShardingDataSourceFactory.createDataSource(
        dataSourceMap, config.getShardingRule().getShardingRuleConfiguration(), config.getConfigMap(), config.getProps());
  }
}

代码示例来源:origin: io.shardingsphere/sharding-jdbc-core

/**
 * Create sharding data source.
 *
 * @param yamlFile yaml file for rule configuration of databases and tables sharding with data sources
 * @return sharding data source
 * @throws SQLException SQL exception
 * @throws IOException IO exception
 */
public static DataSource createDataSource(final File yamlFile) throws SQLException, IOException {
  YamlShardingConfiguration config = YamlShardingConfiguration.unmarshal(yamlFile);
  return ShardingDataSourceFactory.createDataSource(
      config.getDataSources(), config.getShardingRule().getShardingRuleConfiguration(), config.getConfigMap(), config.getProps());
}

代码示例来源:origin: io.shardingsphere/sharding-jdbc-core

/**
 * Create sharding data source.
 *
 * @param yamlBytes yaml bytes for rule configuration of databases and tables sharding with data sources
 * @return sharding data source
 * @throws SQLException SQL exception
 * @throws IOException IO exception
 */
public static DataSource createDataSource(final byte[] yamlBytes) throws SQLException, IOException {
  YamlShardingConfiguration config = YamlShardingConfiguration.unmarshal(yamlBytes);
  return ShardingDataSourceFactory.createDataSource(
      config.getDataSources(), config.getShardingRule().getShardingRuleConfiguration(), config.getConfigMap(), config.getProps());
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com