本文整理了Java中io.shardingsphere.core.yaml.masterslave.YamlMasterSlaveRuleConfiguration
类的一些代码示例,展示了YamlMasterSlaveRuleConfiguration
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlMasterSlaveRuleConfiguration
类的具体详情如下:
包路径:io.shardingsphere.core.yaml.masterslave.YamlMasterSlaveRuleConfiguration
类名称:YamlMasterSlaveRuleConfiguration
暂无
代码示例来源:origin: io.shardingsphere/sharding-orchestration-core
/**
* Load master-slave rule configuration.
*
* @param data data
* @return master-slave rule configuration
*/
public static MasterSlaveRuleConfiguration loadMasterSlaveRuleConfiguration(final String data) {
return new Yaml().loadAs(data, YamlMasterSlaveRuleConfiguration.class).getMasterSlaveRuleConfiguration();
}
代码示例来源:origin: io.shardingsphere/sharding-orchestration-core
/**
* Dump master-slave rule configuration.
*
* @param masterSlaveRuleConfig master-slave rule configuration
* @return YAML string
*/
public static String dumpMasterSlaveRuleConfiguration(final MasterSlaveRuleConfiguration masterSlaveRuleConfig) {
return new Yaml(new DefaultYamlRepresenter()).dumpAsMap(new YamlMasterSlaveRuleConfiguration(masterSlaveRuleConfig));
}
代码示例来源:origin: io.shardingsphere/sharding-jdbc-orchestration
private static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final YamlMasterSlaveRuleConfiguration yamlConfig,
final Map<String, Object> configMap, final Properties props, final OrchestrationConfiguration orchestrationConfig) throws SQLException {
if (null == yamlConfig) {
return new OrchestrationMasterSlaveDataSource(orchestrationConfig);
} else {
MasterSlaveDataSource masterSlaveDataSource = new MasterSlaveDataSource(dataSourceMap, yamlConfig.getMasterSlaveRuleConfiguration(), configMap, props);
return new OrchestrationMasterSlaveDataSource(masterSlaveDataSource, orchestrationConfig);
}
}
代码示例来源:origin: io.shardingsphere/sharding-jdbc-core
/**
* Create master-slave data source.
*
* @param dataSourceMap data source map
* @param yamlFile yaml file for master-slave rule configuration without data sources
* @return master-slave 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 {
YamlMasterSlaveConfiguration config = YamlMasterSlaveConfiguration.unmarshal(yamlFile);
return MasterSlaveDataSourceFactory.createDataSource(dataSourceMap, config.getMasterSlaveRule().getMasterSlaveRuleConfiguration(), config.getConfigMap(), config.getProps());
}
代码示例来源:origin: io.shardingsphere/sharding-jdbc-core
/**
* Create master-slave data source.
*
* @param dataSourceMap data source map
* @param yamlBytes yaml bytes for master-slave rule configuration without data sources
* @return master-slave 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 {
YamlMasterSlaveConfiguration config = YamlMasterSlaveConfiguration.unmarshal(yamlBytes);
return MasterSlaveDataSourceFactory.createDataSource(dataSourceMap, config.getMasterSlaveRule().getMasterSlaveRuleConfiguration(), config.getConfigMap(), config.getProps());
}
}
代码示例来源:origin: io.shardingsphere/sharding-jdbc-core
/**
* Create master-slave data source.
*
* @param yamlFile yaml file for master-slave rule configuration with data sources
* @return master-slave data source
* @throws SQLException SQL exception
* @throws IOException IO exception
*/
public static DataSource createDataSource(final File yamlFile) throws SQLException, IOException {
YamlMasterSlaveConfiguration config = YamlMasterSlaveConfiguration.unmarshal(yamlFile);
return MasterSlaveDataSourceFactory.createDataSource(config.getDataSources(), config.getMasterSlaveRule().getMasterSlaveRuleConfiguration(), config.getConfigMap(), config.getProps());
}
代码示例来源:origin: io.shardingsphere/sharding-jdbc-core
/**
* Create master-slave data source.
*
* @param yamlBytes yaml bytes for master-slave rule configuration with data sources
* @return master-slave data source
* @throws SQLException SQL exception
* @throws IOException IO exception
*/
public static DataSource createDataSource(final byte[] yamlBytes) throws SQLException, IOException {
YamlMasterSlaveConfiguration config = YamlMasterSlaveConfiguration.unmarshal(yamlBytes);
return MasterSlaveDataSourceFactory.createDataSource(config.getDataSources(), config.getMasterSlaveRule().getMasterSlaveRuleConfiguration(), config.getConfigMap(), config.getProps());
}
内容来源于网络,如有侵权,请联系作者删除!