blob: 6aeb49e645d5df9618e20074d7f629e5f5c5ef7b [file] [log] [blame]
Yuta HIGUCHI66ca1bf2014-03-12 18:34:09 -07001package net.onrc.onos.datastore;
2
Yuta HIGUCHI6a643132014-03-18 22:39:27 -07003import net.onrc.onos.datastore.hazelcast.HZClient;
Yuta HIGUCHI66ca1bf2014-03-12 18:34:09 -07004import net.onrc.onos.datastore.ramcloud.RCClient;
5
Yuta HIGUCHI6a643132014-03-18 22:39:27 -07006// This class probably need to be a service
Yuta HIGUCHI66ca1bf2014-03-12 18:34:09 -07007public class DataStoreClient {
Yuta HIGUCHI6a643132014-03-18 22:39:27 -07008 private static final String BACKEND = System.getProperty("net.onrc.onos.datastore.backend", "hazelcast");
9
10 // Suppresses default constructor, ensuring non-instantiability.
11 private DataStoreClient() {}
12
Yuta HIGUCHI66ca1bf2014-03-12 18:34:09 -070013 public static IKVClient getClient() {
14 // TODO read config and return appropriate IKVClient
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070015 switch (BACKEND) {
16 case "ramcloud":
17 return RCClient.getClient();
18 case "hazelcast":
19 return HZClient.getClient();
20 default:
21 return HZClient.getClient();
22 }
Yuta HIGUCHI66ca1bf2014-03-12 18:34:09 -070023 }
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070024
25
Yuta HIGUCHI66ca1bf2014-03-12 18:34:09 -070026}