@@ -0,0 +1,3362 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.example.jdbc.nodep.config;%0A%0Aimport io.shardingsphere.api.config.ShardingRuleConfiguration;%0Aimport io.shardingsphere.api.config.TableRuleConfiguration;%0Aimport io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration;%0Aimport io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration;%0Aimport io.shardingsphere.example.algorithm.PreciseModuloShardingDatabaseAlgorithm;%0Aimport io.shardingsphere.example.algorithm.PreciseModuloShardingTableAlgorithm;%0Aimport io.shardingsphere.example.algorithm.RangeModuloShardingDatabaseAlgorithm;%0Aimport io.shardingsphere.example.algorithm.RangeModuloShardingTableAlgorithm;%0Aimport io.shardingsphere.example.config.DataSourceUtil;%0Aimport io.shardingsphere.example.config.ExampleConfiguration;%0Aimport io.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory;%0A%0Aimport javax.sql.DataSource;%0Aimport java.sql.SQLException;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0A%0Apublic final class ShardingTablesConfigurationRange implements ExampleConfiguration %7B%0A    %0A    @Override%0A    public DataSource getDataSource() throws SQLException %7B%0A        ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();%0A        shardingRuleConfig.getTableRuleConfigs().add(getOrderTableRuleConfiguration());%0A        shardingRuleConfig.getTableRuleConfigs().add(getOrderItemTableRuleConfiguration());%0A        shardingRuleConfig.getBindingTableGroups().add(%22t_order, t_order_item%22);%0A        shardingRuleConfig.setDefaultTableShardingStrategyConfig(new StandardShardingStrategyConfiguration(%22order_id%22, new PreciseModuloShardingTableAlgorithm(), new RangeModuloShardingTableAlgorithm()));%0A        return ShardingDataSourceFactory.createDataSource(createDataSourceMap(), shardingRuleConfig, new HashMap%3CString, Object%3E(), new Properties());%0A    %7D%0A    %0A    private static TableRuleConfiguration getOrderTableRuleConfiguration() %7B%0A        TableRuleConfiguration result = new TableRuleConfiguration();%0A        result.setLogicTable(%22t_order%22);%0A        result.setActualDataNodes(%22demo_ds.t_order_$%7B%5B0, 1%5D%7D%22);%0A        result.setKeyGeneratorColumnName(%22order_id%22);%0A        return result;%0A    %7D%0A    %0A    private static TableRuleConfiguration getOrderItemTableRuleConfiguration() %7B%0A        TableRuleConfiguration result = new TableRuleConfiguration();%0A        result.setLogicTable(%22t_order_item%22);%0A        result.setActualDataNodes(%22demo_ds.t_order_item_$%7B%5B0, 1%5D%7D%22);%0A        return result;%0A    %7D%0A    %0A    private static Map%3CString, DataSource%3E createDataSourceMap() %7B%0A        Map%3CString, DataSource%3E result = new HashMap%3C%3E();%0A        result.put(%22demo_ds%22, DataSourceUtil.createDataSource(%22demo_ds%22));%0A        return result;%0A    %7D%0A%7D%0A

add ShardingTablesConfigurationRange