1 package org.onap.ccsdk.sli.core.sli.provider.base;
3 import java.util.ArrayList;
4 import java.util.HashMap;
7 import java.util.Properties;
8 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
9 import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
10 import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
14 public class InMemorySvcLogicStore implements SvcLogicStore {
15 private static final Logger logger = LoggerFactory.getLogger(InMemorySvcLogicStore.class);
16 public Map<String, SvcLogicGraph> graphStore;
18 public InMemorySvcLogicStore() {
19 graphStore = new HashMap<String, SvcLogicGraph>();
23 public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException {
24 String storeId = new String(module + ":" + rpc);
25 return graphStore.containsKey(storeId);
29 public SvcLogicGraph fetch(String module, String rpc, String version, String mode) throws SvcLogicException {
30 String storeId = new String(module + ":" + rpc);
31 return graphStore.get(storeId);
35 public void store(SvcLogicGraph graph) throws SvcLogicException {
37 String storeId = new String(graph.getModule() + ":" + graph.getRpc());
38 graphStore.put(storeId, graph);
39 logger.info(graph.toString() + " stored in InMemorySvcLogicStore.");
44 public void init(Properties props) throws SvcLogicException {
49 public void delete(String module, String rpc, String version, String mode) throws SvcLogicException {
50 String storeId = new String(module + ":" + rpc);
51 if (graphStore.containsKey(storeId)) {
52 graphStore.remove(storeId);
57 public void activate(SvcLogicGraph graph) throws SvcLogicException {
62 public void activate(String module, String rpc, String version, String mode) throws SvcLogicException {