本文整理了Java中org.apache.shardingsphere.core.yaml.masterslave.YamlMasterSlaveRuleConfiguration.getMasterSlaveRuleConfiguration()
方法的一些代码示例,展示了YamlMasterSlaveRuleConfiguration.getMasterSlaveRuleConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlMasterSlaveRuleConfiguration.getMasterSlaveRuleConfiguration()
方法的具体详情如下:
包路径:org.apache.shardingsphere.core.yaml.masterslave.YamlMasterSlaveRuleConfiguration
类名称:YamlMasterSlaveRuleConfiguration
方法名:getMasterSlaveRuleConfiguration
[英]Get master-slave rule configuration.
[中]获取主从规则配置。
代码示例来源:origin: apache/incubator-shardingsphere
@Override
public MasterSlaveRuleConfiguration load(final String data) {
return new Yaml().loadAs(data, YamlMasterSlaveRuleConfiguration.class).getMasterSlaveRuleConfiguration();
}
}
代码示例来源:origin: apache/incubator-shardingsphere
private static Map<String, RuleConfiguration> getRuleConfiguration(final Map<String, YamlProxyRuleConfiguration> localRuleConfigs) {
Map<String, RuleConfiguration> result = new HashMap<>();
for (Entry<String, YamlProxyRuleConfiguration> entry : localRuleConfigs.entrySet()) {
result.put(entry.getKey(), null != entry.getValue().getShardingRule() ? entry.getValue().getShardingRule().getShardingRuleConfiguration()
: entry.getValue().getMasterSlaveRule().getMasterSlaveRuleConfiguration());
}
return result;
}
}
代码示例来源:origin: apache/incubator-shardingsphere
private static Map<String, RuleConfiguration> getRuleConfiguration(final Map<String, YamlProxyRuleConfiguration> localRuleConfigs) {
Map<String, RuleConfiguration> result = new HashMap<>();
for (Entry<String, YamlProxyRuleConfiguration> entry : localRuleConfigs.entrySet()) {
result.put(entry.getKey(), null != entry.getValue().getShardingRule() ? entry.getValue().getShardingRule().getShardingRuleConfiguration()
: entry.getValue().getMasterSlaveRule().getMasterSlaveRuleConfiguration());
}
return result;
}
}
代码示例来源:origin: apache/incubator-shardingsphere
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: apache/incubator-shardingsphere
/**
* 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: apache/incubator-shardingsphere
YamlMasterSlaveRuleConfiguration each = entry.getValue();
each.setName(entry.getKey());
masterSlaveRuleConfigs.add(entry.getValue().getMasterSlaveRuleConfiguration());
代码示例来源:origin: apache/incubator-shardingsphere
/**
* 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: apache/incubator-shardingsphere
/**
* 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: apache/incubator-shardingsphere
/**
* 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());
}
内容来源于网络,如有侵权,请联系作者删除!