@@ -0,0 +1,2876 @@
+/*%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.jdbc.orchestration.api.datasource;%0A%0Aimport io.shardingsphere.core.api.config.MasterSlaveRuleConfiguration;%0Aimport io.shardingsphere.core.jdbc.core.datasource.MasterSlaveDataSource;%0Aimport io.shardingsphere.jdbc.orchestration.config.OrchestrationConfiguration;%0Aimport io.shardingsphere.jdbc.orchestration.internal.datasource.OrchestrationMasterSlaveDataSource;%0Aimport lombok.AccessLevel;%0Aimport lombok.NoArgsConstructor;%0A%0Aimport javax.sql.DataSource;%0Aimport java.sql.SQLException;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0A%0A/**%0A * Orchestration sharding data source factory.%0A *%0A * @author panjuan%0A */%0A@NoArgsConstructor(access = AccessLevel.PRIVATE)%0Apublic final class OrchestrationMasterSlaveDataSourceFactory %7B%0A    %0A    /**%0A     * Create master-slave data source.%0A     *%0A     * @param dataSourceMap data source map%0A     * @param masterSlaveRuleConfig master-slave rule configuration%0A     * @param configMap config map%0A     * @param props properties%0A     * @param orchestrationConfig orchestration configuration%0A     * @return master-slave data source%0A     * @throws SQLException SQL exception%0A     */%0A    public static DataSource createDataSource(final Map%3CString, DataSource%3E dataSourceMap, final MasterSlaveRuleConfiguration masterSlaveRuleConfig, final Map%3CString, Object%3E configMap, final Properties props, final OrchestrationConfiguration orchestrationConfig) throws SQLException %7B%0A        if (null == masterSlaveRuleConfig %7C%7C null == masterSlaveRuleConfig.getMasterDataSourceName()) %7B%0A            return createDataSource(orchestrationConfig);%0A        %7D%0A        MasterSlaveDataSource masterSlaveDataSource = new MasterSlaveDataSource(dataSourceMap, masterSlaveRuleConfig, configMap, props);%0A        return new OrchestrationMasterSlaveDataSource(masterSlaveDataSource, orchestrationConfig);%0A    %7D%0A    %0A    /**%0A     * Create master-slave data source.%0A     *%0A     * @param orchestrationConfig orchestration configuration%0A     * @return master-slave data source%0A     * @throws SQLException SQL exception%0A     */%0A    public static DataSource createDataSource(final OrchestrationConfiguration orchestrationConfig) throws SQLException %7B%0A        return new OrchestrationMasterSlaveDataSource(orchestrationConfig);%0A    %7D%0A%7D%0A%0A

add OrchestrationMasterSlaveDataSourceFactory.java