@@ -0,0 +1,2580 @@
+/*%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.core.property;%0A%0Aimport io.shardingsphere.core.constant.DatabaseType;%0A%0Aimport javax.sql.DataSource;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * Data source property manager.%0A *%0A * @author panjuan%0A */%0Apublic class DataSourcePropertyManager %7B%0A    %0A    private final Map%3CString, DataSourceProperty%3E dataSourcePropertyMap;%0A    %0A    public DataSourcePropertyManager(final Map%3CString, DataSource%3E dataSourceMap, final DatabaseType databaseType) %7B%0A        dataSourcePropertyMap = initDataSourcePropertyMap(dataSourceMap, databaseType);%0A    %7D%0A    %0A    private Map%3CString, DataSourceProperty%3E initDataSourcePropertyMap(final Map%3CString, DataSource%3E dataSourceMap,%0A            final DatabaseType databaseType) %7B%0A        Map%3CString, DataSourceProperty%3E result = new LinkedHashMap%3C%3E();%0A        for (Map.Entry%3CString, DataSource%3E each : dataSourceMap.entrySet()) %7B%0A            result.put(each.getKey(), DataSourcePropertyFactory.createDataSourcePropertyParser(databaseType).parseDataSource(each.getValue()));%0A        %7D%0A        return result;%0A    %7D%0A    %0A    /**%0A     * Get all instance data source names.%0A     *%0A     * @return instance data source name list.%0A     */%0A    public List%3CString%3E getAllInstanceDataSourceNames() %7B%0A        List%3CString%3E result = new LinkedList%3C%3E();%0A        for (Map.Entry%3CString, DataSourceProperty%3E each : dataSourcePropertyMap.entrySet()) %7B%0A            if (!isExisted(each.getKey(), result)) %7B%0A                result.add(each.getKey());%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A    %0A    private boolean isExisted(final String dataSourceName, final List%3CString%3E existedDataSourceNames) %7B%0A        for (String each : existedDataSourceNames) %7B%0A            if (dataSourcePropertyMap.get(each).isPointAtSameInstance(dataSourcePropertyMap.get(dataSourceName))) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

add DataSourcePropertyManager