shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsBuilder.java
/**
     * Build meta data contexts.
     * 
     * @param metaDataPersistService persist service
     * @exception SQLException SQL exception
     * @return meta data contexts
     */
Build meta data contexts.

@param metaDataPersistService persist service
@exception SQLException SQL exception
@return meta data contexts
Build meta data contexts . @param metaDataPersistService persist service @exception SQLException SQL exception @return meta data contexts
public MetaDataContexts build(final MetaDataPersistService metaDataPersistService) throws SQLException {
        Map<String, ShardingSphereMetaData> kernelMetaData = new HashMap<>(schemaRuleConfigs.size(), 1);
        Map<String, ShardingSphereMetaData> federationMetaData = new HashMap<>(schemaRuleConfigs.size(), 1);
        for (String each : schemaRuleConfigs.keySet()) {
            Map<String, DataSource> dataSourceMap = dataSources.get(each);
            Collection<RuleConfiguration> ruleConfigs = schemaRuleConfigs.get(each);
            DatabaseType databaseType = DatabaseTypeRecognizer.getDatabaseType(dataSourceMap.values());
            Collection<ShardingSphereRule> rules = SchemaRulesBuilder.buildRules(new SchemaRulesBuilderMaterials(each, ruleConfigs, databaseType, dataSourceMap, props));
            ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData(ruleConfigs, rules);
            ShardingSphereResource resource = buildResource(databaseType, dataSourceMap);
            Collection<TableMetaData> tableMetaDataList = schemas.get(each).getTables().values();
            federationMetaData.put(each, new ShardingSphereMetaData(each, resource, ruleMetaData, SchemaBuilder.buildFederationSchema(tableMetaDataList, rules)));
            kernelMetaData.put(each, new ShardingSphereMetaData(each, resource, ruleMetaData, SchemaBuilder.buildKernelSchema(tableMetaDataList, rules)));
        }
        return new MetaDataContexts(metaDataPersistService, kernelMetaData, 
                buildGlobalSchemaMetaData(kernelMetaData), executorEngine, props, OptimizerContextFactory.create(federationMetaData));
    }
public MetaDataContexts build ( final MetaDataPersistService metaDataPersistService ) throws SQLException { Map < String , ShardingSphereMetaData > kernelMetaData = new HashMap < > ( schemaRuleConfigs . size ( ) , 1 ) ; Map < String , ShardingSphereMetaData > federationMetaData = new HashMap < > ( schemaRuleConfigs . size ( ) , 1 ) ; for ( String each : schemaRuleConfigs . keySet ( ) ) { Map < String , DataSource > dataSourceMap = dataSources . get ( each ) ; Collection < RuleConfiguration > ruleConfigs = schemaRuleConfigs . get ( each ) ; DatabaseType databaseType = DatabaseTypeRecognizer . getDatabaseType ( dataSourceMap . values ( ) ) ; Collection < ShardingSphereRule > rules = SchemaRulesBuilder . buildRules ( new SchemaRulesBuilderMaterials ( each , ruleConfigs , databaseType , dataSourceMap , props ) ) ; ShardingSphereRuleMetaData ruleMetaData = new ShardingSphereRuleMetaData ( ruleConfigs , rules ) ; ShardingSphereResource resource = buildResource ( databaseType , dataSourceMap ) ; Collection < TableMetaData > tableMetaDataList = schemas . get ( each ) . getTables ( ) . values ( ) ; federationMetaData . put ( each , new ShardingSphereMetaData ( each , resource , ruleMetaData , SchemaBuilder . buildFederationSchema ( tableMetaDataList , rules ) ) ) ; kernelMetaData . put ( each , new ShardingSphereMetaData ( each , resource , ruleMetaData , SchemaBuilder . buildKernelSchema ( tableMetaDataList , rules ) ) ) ; } return new MetaDataContexts ( metaDataPersistService , kernelMetaData , buildGlobalSchemaMetaData ( kernelMetaData ) , executorEngine , props , OptimizerContextFactory . create ( federationMetaData ) ) ; }
Build meta data contexts.
Build meta data contexts .