@Override public YamlDataSourceConfiguration apply(final DataSourceConfiguration input) { YamlDataSourceConfiguration result = new YamlDataSourceConfiguration(); result.setDataSourceClassName(input.getDataSourceClassName()); result.setProperties(input.getProperties()); return result; } }));
@Override public DataSourceConfiguration apply(final YamlDataSourceConfiguration input) { DataSourceConfiguration result = new DataSourceConfiguration(input.getDataSourceClassName()); result.getProperties().putAll(input.getProperties()); return result; } });
/** * 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); return createDataSource(dataSourceMap, config.getShardingRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
/** * Create master-slave data source. * * @param dataSourceMap data source map * @param yamlByteArray yaml byte array for master-slave rule configuration without data sources * @return master-slave data source * @throws SQLException SQL exception */ public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final byte[] yamlByteArray) throws SQLException { YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlByteArray); return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
/** * 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); return createDataSource(dataSourceMap, config.getShardingRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
/** * 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 { YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile); return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
/** * 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); return createDataSource(config.getDataSources(), config.getShardingRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
/** * Create master-slave data source. * * @param yamlByteArray yaml byte array for master-slave rule configuration with data sources * @return master-slave data source * @throws SQLException SQL exception */ public static DataSource createDataSource(final byte[] yamlByteArray) throws SQLException { YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlByteArray); return createDataSource(config.getDataSources(), config.getMasterSlaveRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
/** * 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); return createDataSource(config.getDataSources(), config.getShardingRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
/** * 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 { YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile); return createDataSource(config.getDataSources(), config.getMasterSlaveRule(), config.getConfigMap(), config.getProps(), config.getOrchestration().getOrchestrationConfiguration()); }
private static void startWithRegistryCenter(final YamlProxyServerConfiguration serverConfig, final Collection<String> shardingSchemaNames, final Map<String, YamlProxyRuleConfiguration> ruleConfigs, final int port) throws InterruptedException { try (ShardingOrchestrationFacade shardingOrchestrationFacade = new ShardingOrchestrationFacade(serverConfig.getOrchestration().getOrchestrationConfiguration(), shardingSchemaNames)) { initShardingOrchestrationFacade(serverConfig, ruleConfigs, shardingOrchestrationFacade); GlobalRegistry.getInstance().init(getSchemaDataSourceParameterMap(shardingOrchestrationFacade), getSchemaRules(shardingOrchestrationFacade), shardingOrchestrationFacade.getConfigService().loadAuthentication(), shardingOrchestrationFacade.getConfigService().loadConfigMap(), shardingOrchestrationFacade.getConfigService().loadProperties(), true); initOpenTracing(); ShardingProxy.getInstance().start(port); } }
private static void startWithRegistryCenter(final YamlProxyServerConfiguration serverConfig, final Collection<String> shardingSchemaNames, final Map<String, YamlProxyRuleConfiguration> ruleConfigs, final int port) throws InterruptedException { try (ShardingOrchestrationFacade shardingOrchestrationFacade = new ShardingOrchestrationFacade(serverConfig.getOrchestration().getOrchestrationConfiguration(), shardingSchemaNames)) { initShardingOrchestrationFacade(serverConfig, ruleConfigs, shardingOrchestrationFacade); GlobalRegistry.getInstance().init(getSchemaDataSourceParameterMap(shardingOrchestrationFacade), getSchemaRules(shardingOrchestrationFacade), shardingOrchestrationFacade.getConfigService().loadAuthentication(), shardingOrchestrationFacade.getConfigService().loadConfigMap(), shardingOrchestrationFacade.getConfigService().loadProperties(), true); initOpenTracing(); ShardingProxy.getInstance().start(port); } }