Refactor: Make createActivation() common

The function is almost the same for ubi and static layout, except a few
differences that creates the ubi objects.

Add below pure virtual functions for ubi to create ubi specific objects
* createActivationObject()
* createVersionObject()

Then it is possible to move most of the code in createActivation() into
the commone one.

Tested: On the last commit of the patch series, run code update and
        factory reset on Witherspoon and all work fine.

Change-Id: Ieb3e783bc5b251529a55909f9e9f644230b274e7
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/item_updater.hpp b/item_updater.hpp
index 0e4c45c..8b1bf0d 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -170,7 +170,27 @@
      *
      * @param[in]  msg       - Data associated with subscribed signal
      */
-    virtual void createActivation(sdbusplus::message::message& msg) = 0;
+    virtual void createActivation(sdbusplus::message::message& msg);
+
+    /** @brief Create Activation object */
+    virtual std::unique_ptr<Activation> createActivationObject(
+        const std::string& path, const std::string& versionId,
+        const std::string& extVersion,
+        sdbusplus::xyz::openbmc_project::Software::server::Activation::
+            Activations activationStatus,
+        AssociationList& assocs) = 0;
+
+    /** @brief Create Version object */
+    virtual std::unique_ptr<Version>
+        createVersionObject(const std::string& objPath,
+                            const std::string& versionId,
+                            const std::string& versionString,
+                            sdbusplus::xyz::openbmc_project::Software::server::
+                                Version::VersionPurpose versionPurpose,
+                            const std::string& filePath) = 0;
+
+    /** @brief Validate if image is valid or not */
+    virtual bool validateImage(const std::string& path) = 0;
 
     /** @brief Persistent sdbusplus D-Bus bus connection. */
     sdbusplus::bus::bus& bus;