1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.infra.route.engine.impl;
19
20 import org.apache.shardingsphere.infra.session.query.QueryContext;
21 import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
22 import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
23 import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
24 import org.apache.shardingsphere.infra.route.context.RouteContext;
25 import org.apache.shardingsphere.infra.route.context.RouteMapper;
26 import org.apache.shardingsphere.infra.route.context.RouteUnit;
27 import org.apache.shardingsphere.infra.route.engine.SQLRouteExecutor;
28
29 import java.util.Collections;
30
31
32
33
34 public final class AllSQLRouteExecutor implements SQLRouteExecutor {
35
36 @Override
37 public RouteContext route(final ConnectionContext connectionContext, final QueryContext queryContext, final RuleMetaData globalRuleMetaData, final ShardingSphereDatabase database) {
38 RouteContext result = new RouteContext();
39 for (String each : database.getResourceMetaData().getStorageUnits().keySet()) {
40 result.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList()));
41 }
42 return result;
43 }
44 }