make building handlers from json more generic

Problem: version-handler, a new feature that will be added to this
repository will also parse json files from the same directory ipmi-flash
does. Currently buildjson is a mix of some code that can be reused and
other code that is pretty specific to firmware updates; this makes it
hard to reuse the code.

Solution: factor out the generic parts and place it in bmc and then
leave the specific parts in firmware-handler. Also code changes have
been made to buildjson: wrap functions in a templated class that leaves
feature specific parsing as a pure virtual method.

Tested:
Ran the unit tests, which do test the parsing functionality.

Signed-off-by: Jason Ling <jasonling@google.com>
Change-Id: I021dc829a82d1719b4cb862cdfb224eca629a44d
diff --git a/bmc/firmware-handler/main.cpp b/bmc/firmware-handler/main.cpp
index eeca589..32d83f0 100644
--- a/bmc/firmware-handler/main.cpp
+++ b/bmc/firmware-handler/main.cpp
@@ -16,9 +16,9 @@
 
 #include "config.h"
 
-#include "buildjson.hpp"
 #include "file_handler.hpp"
 #include "firmware_handler.hpp"
+#include "firmware_handlers_builder.hpp"
 #include "flags.hpp"
 #include "general_systemd.hpp"
 #include "image_handler.hpp"
@@ -113,9 +113,10 @@
 #endif
 
     ActionMap actionPacks = {};
+    FirmwareHandlersBuilder builder;
 
-    std::vector<HandlerConfig> configsFromJson =
-        BuildHandlerConfigs(jsonConfigurationPath);
+    std::vector<HandlerConfig<ActionPack>> configsFromJson =
+        builder.buildHandlerConfigs(jsonConfigurationPath);
 
     std::vector<HandlerPack> supportedFirmware;