blob: bdf5df595cf18753aa520d0484d9a5510e88b84c [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() {
Yuta HIGUCHI826b4a42014-03-24 13:10:33 -070014 // TODO read config and return appropriate IKVClient
15 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}