View Javadoc
1   package com.kodexa.client.registry;
2   
3   import com.kodexa.client.KodexaException;
4   import com.kodexa.client.store.DataStore;
5   import com.kodexa.client.store.DictionaryStore;
6   import com.kodexa.client.store.TableStore;
7   
8   import java.util.Map;
9   
10  
11  // TODO need to make sure this is plugin/extensible
12  public class StoreRegistry {
13  
14      private static StoreRegistryStoreRegistry">StoreRegistry INTERNAL_REGISTRY = new StoreRegistry();
15  
16      public static StoreRegistry getInstance() {
17          return INTERNAL_REGISTRY;
18      }
19  
20      public DataStore deserialize(String type, Map<String, Object> data) {
21  
22          switch (type) {
23              case "table": {
24                  return new TableStore(data);
25              }
26              case "dictionary": {
27                  return new DictionaryStore(data);
28              }
29          }
30  
31          throw new KodexaException("Unknown store");
32      }
33  
34  }