Search in sources :

Example 1 with YamlOrchestrationShardingRuleConfiguration

use of io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration in project sharding-jdbc by shardingjdbc.

the class OrchestrationShardingDataSourceFactory method createDataSource.

/**
 * 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 {
    YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlFile);
    YamlShardingRuleConfiguration shardingRuleConfig = config.getShardingRule();
    return createDataSource(dataSourceMap, shardingRuleConfig, config.getOrchestration().getOrchestrationConfiguration());
}
Also used : YamlOrchestrationShardingRuleConfiguration(io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration) YamlShardingRuleConfiguration(io.shardingjdbc.core.yaml.sharding.YamlShardingRuleConfiguration)

Example 2 with YamlOrchestrationShardingRuleConfiguration

use of io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration in project sharding-jdbc by shardingjdbc.

the class OrchestrationShardingDataSourceFactory method createDataSource.

/**
 * Create sharding data source.
 *
 * @param yamlByteArray yaml byte array for rule configuration of databases and tables sharding with data sources
 * @return sharding data source
 * @throws SQLException SQL exception
 */
public static DataSource createDataSource(final byte[] yamlByteArray) throws SQLException {
    YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlByteArray);
    YamlShardingRuleConfiguration shardingRuleConfig = config.getShardingRule();
    return createDataSource(config.getDataSources(), shardingRuleConfig, config.getOrchestration().getOrchestrationConfiguration());
}
Also used : YamlOrchestrationShardingRuleConfiguration(io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration) YamlShardingRuleConfiguration(io.shardingjdbc.core.yaml.sharding.YamlShardingRuleConfiguration)

Example 3 with YamlOrchestrationShardingRuleConfiguration

use of io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration in project sharding-jdbc by shardingjdbc.

the class OrchestrationShardingDataSourceFactory method createDataSource.

/**
 * Create sharding data source.
 *
 * @param dataSourceMap data source map
 * @param yamlByteArray yaml byte array for rule configuration of databases and tables sharding without data sources
 * @return sharding data source
 * @throws SQLException SQL exception
 */
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final byte[] yamlByteArray) throws SQLException {
    YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlByteArray);
    YamlShardingRuleConfiguration shardingRuleConfig = config.getShardingRule();
    return createDataSource(dataSourceMap, shardingRuleConfig, config.getOrchestration().getOrchestrationConfiguration());
}
Also used : YamlOrchestrationShardingRuleConfiguration(io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration) YamlShardingRuleConfiguration(io.shardingjdbc.core.yaml.sharding.YamlShardingRuleConfiguration)

Example 4 with YamlOrchestrationShardingRuleConfiguration

use of io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration in project sharding-jdbc by shardingjdbc.

the class OrchestrationShardingDataSourceFactory method createDataSource.

/**
 * 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 {
    YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlFile);
    YamlShardingRuleConfiguration shardingRuleConfig = config.getShardingRule();
    return createDataSource(config.getDataSources(), shardingRuleConfig, config.getOrchestration().getOrchestrationConfiguration());
}
Also used : YamlOrchestrationShardingRuleConfiguration(io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration) YamlShardingRuleConfiguration(io.shardingjdbc.core.yaml.sharding.YamlShardingRuleConfiguration)

Aggregations

YamlShardingRuleConfiguration (io.shardingjdbc.core.yaml.sharding.YamlShardingRuleConfiguration)4 YamlOrchestrationShardingRuleConfiguration (io.shardingjdbc.orchestration.yaml.YamlOrchestrationShardingRuleConfiguration)4