Update dump manager and entry to have multiple types

Created a base dump entry, who ever implementing a new
dump type need to inherit from the base dump entry.

Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: Ie85d393f75ec697a7b02b84d131a4a8c0116c3e7
diff --git a/Makefile.am b/Makefile.am
index 32d14cf..b9c9928 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,6 +21,7 @@
 phosphor_dump_manager_SOURCES = \
 	dump_manager_main.cpp \
 	dump_entry.cpp \
+        bmc_dump_entry.cpp \
 	dump_manager.cpp \
 	watch.cpp \
 	xyz/openbmc_project/Dump/Internal/Create/server.cpp \
diff --git a/bmc_dump_entry.cpp b/bmc_dump_entry.cpp
new file mode 100644
index 0000000..10395d8
--- /dev/null
+++ b/bmc_dump_entry.cpp
@@ -0,0 +1,34 @@
+#include "bmc_dump_entry.hpp"
+
+#include "dump_manager.hpp"
+
+#include <phosphor-logging/log.hpp>
+
+namespace phosphor
+{
+namespace dump
+{
+namespace bmc
+{
+using namespace phosphor::logging;
+
+void Entry::delete_()
+{
+    // Delete Dump file from Permanent location
+    try
+    {
+        fs::remove_all(file.parent_path());
+    }
+    catch (fs::filesystem_error& e)
+    {
+        // Log Error message and continue
+        log<level::ERR>(e.what());
+    }
+
+    // Remove Dump entry D-bus object
+    phosphor::dump::Entry::delete_();
+}
+
+} // namespace bmc
+} // namespace dump
+} // namespace phosphor
diff --git a/bmc_dump_entry.hpp b/bmc_dump_entry.hpp
new file mode 100644
index 0000000..8a535e1
--- /dev/null
+++ b/bmc_dump_entry.hpp
@@ -0,0 +1,73 @@
+#pragma once
+
+#include "dump_entry.hpp"
+#include "xyz/openbmc_project/Dump/Entry/BMC/server.hpp"
+#include "xyz/openbmc_project/Dump/Entry/server.hpp"
+#include "xyz/openbmc_project/Object/Delete/server.hpp"
+#include "xyz/openbmc_project/Time/EpochTime/server.hpp"
+
+#include <experimental/filesystem>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/server/object.hpp>
+
+namespace phosphor
+{
+namespace dump
+{
+namespace bmc
+{
+template <typename T>
+using ServerObject = typename sdbusplus::server::object::object<T>;
+
+using EntryIfaces = sdbusplus::server::object::object<
+    sdbusplus::xyz::openbmc_project::Dump::Entry::server::BMC>;
+
+namespace fs = std::experimental::filesystem;
+
+class Manager;
+
+/** @class Entry
+ *  @brief OpenBMC Dump Entry implementation.
+ *  @details A concrete implementation for the
+ *  xyz.openbmc_project.Dump.Entry DBus API
+ */
+class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry
+{
+  public:
+    Entry() = delete;
+    Entry(const Entry&) = delete;
+    Entry& operator=(const Entry&) = delete;
+    Entry(Entry&&) = delete;
+    Entry& operator=(Entry&&) = delete;
+    ~Entry() = default;
+
+    /** @brief Constructor for the Dump Entry Object
+     *  @param[in] bus - Bus to attach to.
+     *  @param[in] objPath - Object path to attach to
+     *  @param[in] dumpId - Dump id.
+     *  @param[in] timeStamp - Dump creation timestamp
+     *             since the epoch.
+     *  @param[in] fileSize - Dump file size in bytes.
+     *  @param[in] file - Name of dump file.
+     *  @param[in] parent - The dump entry's parent.
+     */
+    Entry(sdbusplus::bus::bus& bus, const std::string& objPath, uint32_t dumpId,
+          uint64_t timeStamp, uint64_t fileSize, const fs::path& file,
+          phosphor::dump::Manager& parent) :
+        EntryIfaces(bus, objPath.c_str(), true),
+        phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize,
+                              parent),
+        file(file){};
+
+    /** @brief Delete this d-bus object.
+     */
+    void delete_() override;
+
+  private:
+    /** @Dump file name */
+    fs::path file;
+};
+
+} // namespace bmc
+} // namespace dump
+} // namespace phosphor
diff --git a/dump_entry.cpp b/dump_entry.cpp
index 6048b1c..86fa81b 100644
--- a/dump_entry.cpp
+++ b/dump_entry.cpp
@@ -13,17 +13,6 @@
 
 void Entry::delete_()
 {
-    // Delete Dump file from Permanent location
-    try
-    {
-        fs::remove_all(file.parent_path());
-    }
-    catch (fs::filesystem_error& e)
-    {
-        // Log Error message and continue
-        log<level::ERR>(e.what());
-    }
-
     // Remove Dump entry D-bus object
     parent.erase(id);
 }
diff --git a/dump_entry.hpp b/dump_entry.hpp
index e6b7ec5..1f5aab8 100644
--- a/dump_entry.hpp
+++ b/dump_entry.hpp
@@ -46,17 +46,15 @@
      *  @param[in] dumpId - Dump id.
      *  @param[in] timeStamp - Dump creation timestamp
      *             since the epoch.
-     *  @param[in] fileSize - Dump file size in bytes.
-     *  @param[in] file - Dump file name.
+     *  @param[in] dumpSize - Dump file size in bytes.
      *  @param[in] parent - The dump entry's parent.
      */
     Entry(sdbusplus::bus::bus& bus, const std::string& objPath, uint32_t dumpId,
-          uint64_t timeStamp, uint64_t fileSize, const fs::path& file,
-          Manager& parent) :
+          uint64_t timeStamp, uint64_t dumpSize, Manager& parent) :
         EntryIfaces(bus, objPath.c_str(), true),
-        file(file), parent(parent), id(dumpId)
+        parent(parent), id(dumpId)
     {
-        size(fileSize);
+        size(dumpSize);
         elapsed(timeStamp);
         // Emit deferred signal.
         this->emit_object_added();
@@ -66,10 +64,13 @@
      */
     void delete_() override;
 
-  private:
-    /** @Dump file name */
-    fs::path file;
+    /** @brief Method to initiate the offload of dump
+     */
+    void initiateOffload() override
+    {
+    }
 
+  protected:
     /** @brief This entry's parent */
     Manager& parent;
 
diff --git a/dump_manager.cpp b/dump_manager.cpp
index 9a8d0f4..accd0da 100644
--- a/dump_manager.cpp
+++ b/dump_manager.cpp
@@ -2,6 +2,7 @@
 
 #include "dump_manager.hpp"
 
+#include "bmc_dump_entry.hpp"
 #include "dump_internal.hpp"
 #include "xyz/openbmc_project/Common/error.hpp"
 #include "xyz/openbmc_project/Dump/Create/error.hpp"
@@ -113,10 +114,10 @@
         // Entry Object path.
         auto objPath = fs::path(OBJ_ENTRY) / std::to_string(id);
 
-        entries.insert(std::make_pair(
-            id,
-            std::make_unique<Entry>(bus, objPath.c_str(), id, stoull(msString),
-                                    fs::file_size(file), file, *this)));
+        entries.insert(
+            std::make_pair(id, std::make_unique<bmc::Entry>(
+                                   bus, objPath.c_str(), id, stoull(msString),
+                                   fs::file_size(file), file, *this)));
     }
     catch (const std::invalid_argument& e)
     {