ONOS-6204 initial impl of dist. flow objective store

Change-Id: I968bea6f95d91b5b30e9d0e11c6948502684022c
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualFlowObjectiveStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualFlowObjectiveStore.java
index 1ac5396..e2ecdf3 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualFlowObjectiveStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualFlowObjectiveStore.java
@@ -72,13 +72,25 @@
         eventQ = new LinkedBlockingQueue<>();
         tpool.execute(new FlowObjectiveNotifier());
 
-        nextGroupsMap = Maps.newConcurrentMap();
+        initNextGroupsMap();
 
         nextIds = storageService.getAtomicCounter("next-objective-counter");
         log.info("Started");
     }
 
-    private ConcurrentMap<Integer, byte[]> getNextGroups(NetworkId networkId) {
+    public void deactivate() {
+        log.info("Stopped");
+    }
+
+    protected void initNextGroupsMap() {
+        nextGroupsMap = Maps.newConcurrentMap();
+    }
+
+    protected void updateNextGroupsMap(NetworkId networkId,
+                                       ConcurrentMap<Integer, byte[]> nextGroups) {
+    }
+
+    protected ConcurrentMap<Integer, byte[]> getNextGroups(NetworkId networkId) {
         nextGroupsMap.computeIfAbsent(networkId, n -> Maps.newConcurrentMap());
         return nextGroupsMap.get(networkId);
     }
@@ -87,6 +99,7 @@
     public void putNextGroup(NetworkId networkId, Integer nextId, NextGroup group) {
         ConcurrentMap<Integer, byte[]> nextGroups = getNextGroups(networkId);
         nextGroups.put(nextId, group.data());
+        updateNextGroupsMap(networkId, nextGroups);
 
         eventQ.add(new VirtualObjectiveEvent(networkId, ObjectiveEvent.Type.ADD, nextId));
     }
@@ -94,14 +107,22 @@
     @Override
     public NextGroup getNextGroup(NetworkId networkId, Integer nextId) {
         ConcurrentMap<Integer, byte[]> nextGroups = getNextGroups(networkId);
-        return new DefaultNextGroup(nextGroups.get(nextId));
+        byte[] groupData = nextGroups.get(nextId);
+        if (groupData != null) {
+            return new DefaultNextGroup(groupData);
+        }
+        return null;
     }
 
     @Override
     public NextGroup removeNextGroup(NetworkId networkId, Integer nextId) {
         ConcurrentMap<Integer, byte[]> nextGroups = getNextGroups(networkId);
+        byte[] nextGroup = nextGroups.remove(nextId);
+        updateNextGroupsMap(networkId, nextGroups);
+
         eventQ.add(new VirtualObjectiveEvent(networkId, ObjectiveEvent.Type.REMOVE, nextId));
-        return new DefaultNextGroup(nextGroups.remove(nextId));
+
+        return new DefaultNextGroup(nextGroup);
     }
 
     @Override