1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.infra.url.etcd;
19
20 import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
21 import org.apache.shardingsphere.infra.exception.ShardingSpherePreconditions;
22 import org.apache.shardingsphere.infra.url.spi.ShardingSphereModeConfigurationURLLoader;
23 import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
24
25 import java.util.Properties;
26
27
28
29
30 public final class EtcdModeConfigurationURLLoader implements ShardingSphereModeConfigurationURLLoader {
31
32 @Override
33 public ModeConfiguration load(final String serverLists, final Properties queryProps) {
34 ShardingSpherePreconditions.checkState(queryProps.containsKey("namespace"), () -> new RuntimeException("Missing required property 'namespace' for ETCD URL loader."));
35 return new ModeConfiguration("Cluster", new ClusterPersistRepositoryConfiguration("etcd", queryProps.getProperty("namespace"), serverLists, queryProps));
36 }
37
38 @Override
39 public String getType() {
40 return "etcd:";
41 }
42 }