Index: /trunk/src/VBox/Main/include/CloudClientImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/CloudClientImpl.h	(revision 73164)
+++ /trunk/src/VBox/Main/include/CloudClientImpl.h	(revision 73164)
@@ -0,0 +1,75 @@
+/* $Id$ */
+/** @file
+ * VirtualBox COM class implementation
+ */
+
+/*
+ * Copyright (C) 2006-2018 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#ifndef ____H_CLOUDCLIENTIMPL
+#define ____H_CLOUDCLIENTIMPL
+
+/* VBox includes */
+
+#include "CloudClientWrap.h"
+
+/* VBox forward declarations */
+class CloudUserProfileList;
+
+class CloudClient :
+    public CloudClientWrap
+{
+public:
+    DECLARE_EMPTY_CTOR_DTOR(CloudClient)
+    explicit CloudClient(CloudProviderId_T aCloudProvider);
+
+    HRESULT FinalConstruct();
+    void FinalRelease();
+
+    HRESULT init(VirtualBox *aVirtualBox);
+    HRESULT initCloudClient(CloudUserProfileList *aProfiles,
+                            VirtualBox *aParent,
+                            CloudProviderId_T aCloudProvider,
+                            const com::Utf8Str &aProfileName);
+    void uninit();
+
+private:
+    ComPtr<VirtualBox> const mParent;       /**< Strong reference to the parent object (VirtualBox/IMachine). */
+    ComPtr<Machine> mMachine;               /**< Strong reference to the machine object (Machine/IMachine). */
+    CloudProviderId_T mCloudProvider;
+    std::map <Utf8Str, Utf8Str> userProfile;
+
+private:
+    HRESULT getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString);
+
+    HRESULT createOperation(const com::Utf8Str &aProfileName,
+                            CloudOperation_T aCloudOperation,
+                            com::Guid &aOpId);
+    HRESULT runOperation(const com::Guid &aOpId,
+                         LONG64 aTimeout);
+    HRESULT checkOperationResult(const com::Guid &aOpId,
+                                 LONG64 *aStartOpTime,
+                                 LONG64 *aLastTime,
+                                 CloudOperationResult_T *aResult);
+    HRESULT getOperationParameterNames(CloudOperation_T aCloudOperation,
+                                       std::vector<com::Utf8Str> &aParameterNames);
+    HRESULT getOperationParameterProperties(const com::Utf8Str &aOpParameterName,
+                                            com::Utf8Str &aOpParameterType,
+                                            com::Utf8Str &aOpParameterDesc,
+                                            std::vector<com::Utf8Str> &aOpParameterValues);
+    HRESULT setParametersForOperation(const com::Guid &aOpId,
+                                      const std::vector<com::Utf8Str> &aValues);
+};
+#endif // !____H_CLOUDCLIENTIMPL
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
+
Index: /trunk/src/VBox/Main/include/CloudUserProfileListImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/CloudUserProfileListImpl.h	(revision 73164)
+++ /trunk/src/VBox/Main/include/CloudUserProfileListImpl.h	(revision 73164)
@@ -0,0 +1,139 @@
+/* $Id$ */
+/** @file
+ * VirtualBox COM class implementation
+ */
+
+/*
+ * Copyright (C) 2006-2018 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#ifndef ____H_CLOUDUSERPROFILELISTIMPL
+#define ____H_CLOUDUSERPROFILELISTIMPL
+
+//#include <map>
+#include <vector>
+
+/* VBox includes */
+#include "CloudClientImpl.h"
+#include "CloudUserProfileListWrap.h"
+#include "UnattendedScript.h"
+
+/* VBox forward declarations */
+class SimpleConfigFile;
+
+class CloudUserProfileList : public CloudUserProfileListWrap
+{
+public:
+    CloudUserProfileList();
+    virtual ~CloudUserProfileList();
+    HRESULT FinalConstruct();
+    void FinalRelease();
+    HRESULT init(VirtualBox *aVirtualBox);
+    void uninit();
+
+protected:
+    ComPtr<VirtualBox> const mParent;       /**< Strong reference to the parent object (VirtualBox/IMachine). */
+
+public:
+    HRESULT getProvider(CloudProviderId_T *aProvider);
+    HRESULT createCloudClient(const com::Utf8Str &aProfileName,
+                             ComPtr<ICloudClient> &aCloudClient);
+    HRESULT createProfile(const com::Utf8Str &aProfileName,
+                          const std::vector<com::Utf8Str> &aNames,
+                          const std::vector<com::Utf8Str> &aValues);
+    HRESULT updateProfile(const com::Utf8Str &aProfileName,
+                          const std::vector<com::Utf8Str> &aNames,
+                          const std::vector<com::Utf8Str> &aValues);
+    HRESULT getStoredProfilesNames(std::vector<com::Utf8Str> &aProfilesNames);
+    HRESULT getProfileProperties(const com::Utf8Str &aProfileName,
+                                 std::vector<com::Utf8Str> &aReturnNames,
+                                 std::vector<com::Utf8Str> &aReturnValues);
+    HRESULT getPropertyDescription(const com::Utf8Str &aName,
+                                   com::Utf8Str &aDescription);
+
+    virtual HRESULT getSupportedPropertiesNames(std::vector<com::Utf8Str> &aPropertiesNames);
+    virtual HRESULT readProfiles(const Utf8Str &strConfigPath);
+
+};
+
+
+class OCIUserProfileList :
+    public CloudUserProfileList
+{
+public:
+    OCIUserProfileList();
+    ~OCIUserProfileList();
+
+    HRESULT getProvider(CloudProviderId_T *aProvider)
+    {
+        *aProvider = CloudProviderId_OCI;
+        return S_OK;
+    }
+
+    HRESULT createCloudClient(const com::Utf8Str &aProfileName,
+                             ComPtr<ICloudClient> &aCloudClient);
+    HRESULT createProfile(const com::Utf8Str &aProfileName,
+                          const std::vector<com::Utf8Str> &aNames,
+                          const std::vector<com::Utf8Str> &aValues);
+    HRESULT updateProfile(const com::Utf8Str &aProfileName,
+                          const std::vector<com::Utf8Str> &aNames,
+                          const std::vector<com::Utf8Str> &aValues);
+    HRESULT getStoredProfilesNames(std::vector<com::Utf8Str> &aProfilesNames);
+    HRESULT getProfileProperties(const com::Utf8Str &aProfileName,
+                                 std::vector<com::Utf8Str> &aReturnNames,
+                                 std::vector<com::Utf8Str> &aReturnValues);
+    HRESULT getPropertyDescription(const com::Utf8Str &aName,
+                                   com::Utf8Str &aDescription);
+    HRESULT getSupportedPropertiesNames(std::vector<com::Utf8Str> &aPropertiesNames);
+
+    HRESULT readProfiles(const Utf8Str &strConfigPath);
+
+    HRESULT createProfile(const com::Utf8Str &aProfileName,
+                          const std::map <Utf8Str, Utf8Str> &aProfile);
+    HRESULT updateProfile(const com::Utf8Str &aProfileName,
+                          const std::map <Utf8Str, Utf8Str> &aProfile);
+    HRESULT getProfileProperties(const com::Utf8Str &aName,
+                                 std::map <Utf8Str, Utf8Str> &aProfileName);
+private:
+    Utf8Str mStrConfigPath;
+    SimpleConfigFile *mpProfiles;
+};
+
+
+class SimpleConfigFile : public GeneralTextScript
+{
+protected:
+    std::map < Utf8Str, std::map <Utf8Str, Utf8Str> > mSections;
+
+public:
+    explicit SimpleConfigFile(VirtualBoxBase *pSetError, const char *pszFilename = NULL);
+    virtual ~SimpleConfigFile();
+
+    HRESULT parse();
+    //////////////////New functions//////////////////////////////
+    HRESULT addSection(const Utf8Str &aSectionName, const std::map <Utf8Str, Utf8Str>& section);
+
+    size_t getNumberOfSections() const
+    {
+        return mSections.size();
+    }
+
+    std::vector <Utf8Str> getSectionsNames() const;
+    std::map <Utf8Str, Utf8Str> getSectionByName (const Utf8Str &strSectionName) const;
+    bool isSectionExist(const Utf8Str &strSectionName) const;
+    HRESULT updateSection (const Utf8Str &strSectionName,
+                           const std::map <Utf8Str, Utf8Str> &newSection);
+    //////////////////New functions//////////////////////////////
+};
+#endif // !____H_CLOUDUSERPROFILELISTIMPL
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
+
Index: /trunk/src/VBox/Main/include/CloudUserProfileManagerImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/CloudUserProfileManagerImpl.h	(revision 73164)
+++ /trunk/src/VBox/Main/include/CloudUserProfileManagerImpl.h	(revision 73164)
@@ -0,0 +1,52 @@
+/* $Id$ */
+/** @file
+ * VirtualBox COM class implementation
+ */
+
+/*
+ * Copyright (C) 2006-2018 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#ifndef ____H_CLOUDUSERPROFILEMANAGERIMPL
+#define ____H_CLOUDUSERPROFILEMANAGERIMPL
+
+/* VBox includes */
+#include "CloudUserProfileManagerWrap.h"
+#include "CloudUserProfileListImpl.h"
+
+/* VBox forward declarations */
+
+class ATL_NO_VTABLE CloudUserProfileManager :
+    public CloudUserProfileManagerWrap
+{
+public:
+
+    DECLARE_EMPTY_CTOR_DTOR(CloudUserProfileManager)
+
+    HRESULT FinalConstruct();
+    void FinalRelease();
+
+    HRESULT init(VirtualBox *aVirtualBox);
+    void uninit();
+
+private:
+    ComPtr<VirtualBox> const mParent;       /**< Strong reference to the parent object (VirtualBox/IMachine). */
+    std::vector<CloudProviderId_T> mSupportedProviders;
+
+    HRESULT getSupportedProviders(std::vector<CloudProviderId_T> &aProviderTypes);
+    HRESULT getAllProfiles(std::vector< ComPtr<ICloudUserProfileList> > &aProfilesList);
+    HRESULT getProfilesByProvider(CloudProviderId_T aProviderType, ComPtr<ICloudUserProfileList> &aProfiles);
+};
+
+#endif // !____H_CLOUDUSERPROFILEMANAGERIMPL
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
+
Index: /trunk/src/VBox/Main/src-server/CloudClientImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/CloudClientImpl.cpp	(revision 73164)
+++ /trunk/src/VBox/Main/src-server/CloudClientImpl.cpp	(revision 73164)
@@ -0,0 +1,250 @@
+/* $Id$*/
+/** @file
+ * ICloudClient  COM class implementations.
+ */
+
+/*
+ * Copyright (C) 2008-2018 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#include <iprt/path.h>
+#include <iprt/cpp/utils.h>
+#include <VBox/com/array.h>
+#include <map>
+
+#include "CloudClientImpl.h"
+#include "CloudUserProfileManagerImpl.h"
+#include "CloudUserProfileListImpl.h"
+#include "VirtualBoxImpl.h"
+#include "Global.h"
+#include "ProgressImpl.h"
+#include "MachineImpl.h"
+#include "AutoCaller.h"
+#include "Logging.h"
+
+using namespace std;
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// CloudClient constructor / destructor
+//
+// ////////////////////////////////////////////////////////////////////////////////
+CloudClient::CloudClient()
+    : mParent(NULL)
+{
+    LogRel(("CloudClient::CloudClient()\n"));
+}
+
+CloudClient::~CloudClient()
+{
+    LogRel(("CloudClient::~CloudClient()\n"));
+}
+
+CloudClient::CloudClient(CloudProviderId_T aCloudProvider)
+    : mParent(NULL)
+{
+    LogRel(("CloudClient::CloudClient(CloudProviderId_T %d)\n", mCloudProvider));
+    mCloudProvider = aCloudProvider;
+}
+
+HRESULT CloudClient::FinalConstruct()
+{
+    return BaseFinalConstruct();
+}
+
+void CloudClient::FinalRelease()
+{
+    uninit();
+
+    BaseFinalRelease();
+}
+
+void CloudClient::uninit()
+{
+    LogRel(("CloudClient::uninit()\n"));
+    /* Enclose the state transition Ready->InUninit->NotReady */
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+
+    unconst(mParent) = NULL;
+    mMachine.setNull();
+}
+
+HRESULT CloudClient::init(VirtualBox *aParent)
+{
+    LogRel(("aParent=%p\n", aParent));
+    ComAssertRet(aParent, E_INVALIDARG);
+
+    /* Enclose the state transition NotReady->InInit->Ready */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
+    unconst(mParent) = aParent;
+
+    mCloudProvider = CloudProviderId_OCI;
+
+    LogRel(("aParent=%p\n", aParent));
+
+    /*
+     * Confirm a successful initialization
+     */
+    autoInitSpan.setSucceeded();
+
+    return S_OK;
+}
+
+HRESULT CloudClient::initCloudClient(CloudUserProfileList *aProfiles,
+                                     VirtualBox *aParent,
+                                     CloudProviderId_T aCloudProvider,
+                                     const com::Utf8Str &aProfileName)
+{
+    LogRel(("aParent=%p\n", aParent));
+    ComAssertRet(aParent, E_INVALIDARG);
+
+    /* Enclose the state transition NotReady->InInit->Ready */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
+    unconst(mParent) = aParent;
+
+    HRESULT hrc = S_OK;
+
+    try
+    {
+        mCloudProvider = aCloudProvider;
+        LogRel(("CloudProvider = %d\n", mCloudProvider));
+        CloudUserProfileList *lProfiles = aProfiles;
+        std::vector<com::Utf8Str> lNames;
+        std::vector<com::Utf8Str> lValues;
+        hrc = lProfiles->getProfileProperties(aProfileName, lNames, lValues);
+        if (FAILED(hrc))
+        {
+            throw hrc;
+        }
+
+        for (size_t i=0;i<lNames.size();++i)
+        {
+            com::Utf8Str value = (i<lValues.size()) ? lValues.at(i) : "";
+            userProfile[lNames.at(i)] = value;
+        }
+
+        CloudProviderId_T aProvider;
+        hrc = lProfiles->getProvider(&aProvider);
+
+        switch(aProvider)
+        {
+            case CloudProviderId_OCI:
+            default:
+                LogRel(("Reading profile %s has been done\n", aProfileName.c_str()));
+                break;
+        }
+    }
+    catch (HRESULT arc)
+    {
+        hrc = arc;
+        LogRel(("Get cought an exception %d\n", hrc));
+    } 
+    catch (std::bad_alloc)
+    {
+        return E_OUTOFMEMORY;
+    }
+
+    /*
+     * Confirm a successful initialization
+     */
+    autoInitSpan.setSucceeded();
+
+    return hrc;
+}
+
+HRESULT CloudClient::getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString)
+{
+    LogRel(("CloudClient::getOperationParameters: %d, %s\n", aCloudOperation, aJsonString.c_str()));
+    HRESULT hrc = VERR_NOT_IMPLEMENTED;
+    /*
+     
+    createCloudAPI
+    */
+    return hrc;
+}
+
+HRESULT CloudClient::createOperation(const com::Utf8Str &aProfileName,
+                                     CloudOperation_T aCloudOperation,
+                                     com::Guid &aOpId)
+{
+    LogRel(("CloudClient::createOperation: %s, %d, %s\n", aProfileName.c_str(),
+            aCloudOperation,
+            aOpId.toString().c_str()));
+    HRESULT hrc = VERR_NOT_IMPLEMENTED;
+    return hrc;
+}
+
+HRESULT CloudClient::runOperation(const com::Guid &aOpId,
+                                  LONG64 aTimeout)
+{
+    LogRel(("CloudClient::runOperation: %s, %d\n", aOpId.toString().c_str(), aTimeout));
+    HRESULT hrc = VERR_NOT_IMPLEMENTED;
+    return hrc;
+}
+
+HRESULT CloudClient::checkOperationResult(const com::Guid &aOpId,
+                                          LONG64 *aStartOpTime,
+                                          LONG64 *aLastTime,
+                                          CloudOperationResult_T *aResult)
+{
+    LogRel(("CloudClient::checkOperationResult: %s, %d, %d, %d\n",
+            aOpId.toString().c_str(),
+            *aStartOpTime,
+            *aLastTime,
+            *aResult));
+    HRESULT hrc = VERR_NOT_IMPLEMENTED;
+    return hrc;
+}
+
+HRESULT CloudClient::getOperationParameterNames(CloudOperation_T aCloudOperation,
+                                                std::vector<com::Utf8Str> &aParameterNames)
+{
+    LogRel(("CloudClient::getOperationParameterNames: %d\n", aCloudOperation));
+    aParameterNames.clear();
+    HRESULT hrc = VERR_NOT_IMPLEMENTED;
+    return hrc;
+}
+
+HRESULT CloudClient::getOperationParameterProperties(const com::Utf8Str &aOpParameterName,
+                                                     com::Utf8Str &aOpParameterType,
+                                                     com::Utf8Str &aOpParameterDesc,
+                                                     std::vector<com::Utf8Str> &aOpParameterValues)
+{
+    LogRel(("CloudClient::getOperationParameterProperties: %s, %s, %s\n",
+            aOpParameterName.c_str(),
+            aOpParameterType.c_str(),
+            aOpParameterDesc.c_str()));
+    aOpParameterValues.clear();
+    HRESULT hrc = VERR_NOT_IMPLEMENTED;
+    return hrc;
+}
+
+HRESULT CloudClient::setParametersForOperation(const com::Guid &aOpId,
+                                               const std::vector<com::Utf8Str> &aValues)
+{
+    LogRel(("CloudClient::setParametersForOperation: %s\n", aOpId.toString().c_str()));
+    for (size_t i=0;i<aValues.size();++i)
+    {
+        LogRel(("value %d: %s\n", i, aValues.at(i).c_str()));
+    }
+
+    HRESULT hrc = VERR_NOT_IMPLEMENTED;
+    return hrc;
+}
+
Index: /trunk/src/VBox/Main/src-server/CloudUserProfileListImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/CloudUserProfileListImpl.cpp	(revision 73164)
+++ /trunk/src/VBox/Main/src-server/CloudUserProfileListImpl.cpp	(revision 73164)
@@ -0,0 +1,561 @@
+/* $Id$ */
+/** @file
+ * ICloudUserProfileList COM class implementations.
+ */
+
+/*
+ * Copyright (C) 2008-2018 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#include <iprt/path.h>
+#include <iprt/cpp/utils.h>
+#include <VBox/com/array.h>
+
+#include "CloudUserProfileListImpl.h"
+#include "VirtualBoxImpl.h"
+#include "Global.h"
+#include "ProgressImpl.h"
+#include "MachineImpl.h"
+#include "AutoCaller.h"
+#include "Logging.h"
+
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// SimpleConfigFile implementation
+//
+////////////////////////////////////////////////////////////////////////////////
+SimpleConfigFile::SimpleConfigFile(VirtualBoxBase *pSetError, const char *pszFilename)
+    : GeneralTextScript(pSetError, pszFilename)
+{
+    LogRel(("SimpleConfigFile::SimpleConfigFile(VirtualBoxBase *pSetError,...)\n"));
+}
+
+SimpleConfigFile::~SimpleConfigFile() 
+{
+    LogRel(("SimpleConfigFile::~SimpleConfigFile()\n"));
+}
+
+HRESULT SimpleConfigFile::parse()
+{
+    LogRel(("Starting to parse the existing profiles\n"));
+    HRESULT hrc = S_OK;
+    hrc = GeneralTextScript::parse();
+    if (SUCCEEDED(hrc))
+    {
+        size_t lines = getLineNumbersOfScript();
+        LogRel(("Initial parsing (GeneralTextScript::parse()) was succeeded \n"));
+        LogRel(("Read lines is %d \n", lines));
+        size_t startSectionPos=0;
+        bool fInSection = false;
+        std::map <Utf8Str, Utf8Str> sectionConfiguration;
+        Utf8Str strSectionName("Default section ");
+
+        for (size_t i=0; i<lines; ++i)
+        {
+            //find the beginning of section, it starts from the line like "[section name]"
+            //next find the end of section, it ends up when we find the beginning
+            //of the next section or reach the end of the contents.
+            //Go through the found lines and split each of them up by "=".
+            //Each correct line must look like "key=value"
+            //if there is not the character "=" in the line one is skipped
+            //class Utf8Str contains the function parseKeyValue() for this action
+            LogRel(("Parsing the line %d \n", i));
+            Utf8Str strLineContent = getContentOfLine(i);
+            if (strLineContent.isEmpty() || strLineContent.startsWith("#"))
+                continue;
+
+            LogRel(("Content of the line %d is %s \n", i, strLineContent.c_str()));
+
+            if ( strLineContent.startsWith("[") && strLineContent.endsWith("]") )
+            {
+                LogRel(("Found section in the line %d\n", i));
+                if ( fInSection == true )
+                {
+                    if ( i > startSectionPos )//at least we can have here 1 line in the section
+                    {
+                        LogRel(("Add section \"%s\" to the map \n", strSectionName.c_str()));
+                        mSections.insert(make_pair(strSectionName, sectionConfiguration));
+                        sectionConfiguration.clear();
+                        strSectionName.append(Utf8StrFmt("%d",i).c_str());
+                    }
+                }
+
+                strSectionName = strLineContent.substr(strLineContent.find("[")+1,
+                                                       strLineContent.find("]")-1);
+                LogRel(("Section name is \"%s\" \n", strSectionName.c_str()));
+                fInSection = true;
+                startSectionPos = i+1;
+            }
+            else
+            {
+                if ( fInSection == true )
+                {
+                    LogRel(("Continue to parse section \"%s\" \n", strSectionName.c_str()));
+                    if ( i >= startSectionPos )
+                    {
+                        LogRel(("Extracting key and value:\n"));
+                        Utf8Str key, value;
+                        size_t offEnd = strLineContent.parseKeyValue(key, value);
+                        if (offEnd == strLineContent.length())
+                        {
+                            LogRel(("%s=%s \n", key.c_str(), value.c_str()));
+                            sectionConfiguration.insert(make_pair(key,value));
+                        }
+                        else
+                        {
+                            //else something goes wrong, skip the line
+                            LogRel(("Coudn't extract key and value from the line %d\n", i));
+                        }
+                    }
+                }
+                else
+                {
+                    LogRel(("Goes to the next line %d\n", i+1));
+                }
+            }
+        }
+
+        if (fInSection == false)//there is not any section
+        {
+            LogRel(("There are not any sections in the config\n"));
+            hrc = VWRN_NOT_FOUND;
+        }
+        else //the last section hasn't a close tag (the close tag is just the beginning of next section)
+        {
+            //just insert the last section into the map
+            LogRel(("Add the last section %s to the map \n", strSectionName.c_str()));
+            mSections.insert(make_pair(strSectionName, sectionConfiguration));
+        }
+    }
+
+    return hrc;
+}
+
+HRESULT SimpleConfigFile::addSection(const Utf8Str &aSectionName, const std::map <Utf8Str, Utf8Str>& section)
+{
+    HRESULT hrc = S_OK;
+    if (aSectionName.isEmpty())
+        hrc = VERR_INVALID_PARAMETER;
+    else
+        mSections.insert(make_pair(aSectionName, section));
+
+    return hrc;
+}
+
+std::vector <Utf8Str> SimpleConfigFile::getSectionsNames() const
+{
+    std::vector <Utf8Str> res;
+    std::map < Utf8Str, std::map <Utf8Str, Utf8Str> >::const_iterator cit = mSections.begin();
+    while (cit!=mSections.end())
+    {
+        res.push_back(cit->first);
+        ++cit;
+    }
+    return res;
+}
+
+std::map <Utf8Str, Utf8Str> SimpleConfigFile::getSectionByName (const Utf8Str &strSectionName) const
+{
+    std::map <Utf8Str, Utf8Str> res;
+    std::map < Utf8Str, std::map <Utf8Str, Utf8Str> >::const_iterator cit;
+    if ( (cit=mSections.find(strSectionName)) != mSections.end() )
+    {
+        res=cit->second;
+    }
+    return res;
+}
+
+HRESULT SimpleConfigFile::updateSection (const Utf8Str &strSectionName,
+                                         const std::map <Utf8Str, Utf8Str> &newSection)
+{
+    HRESULT hrc = S_OK;
+    std::map <Utf8Str, Utf8Str> oldSection = getSectionByName(strSectionName);
+    if (oldSection.empty())
+    {
+        //add new section
+        hrc = addSection(strSectionName, newSection);
+    }
+    else
+    {
+        //update old section by new values or add new pair key/value if there isn't such key
+        std::map <Utf8Str, Utf8Str>::const_iterator cit = newSection.begin();
+        while (cit != newSection.end())
+        {
+            oldSection[cit->first] = cit->second;
+            ++cit;
+        }
+
+    }
+    return hrc;
+}
+
+bool SimpleConfigFile::isSectionExist(const Utf8Str &strSectionName) const
+{
+    return ((mSections.find(strSectionName) == mSections.end()) ? false : true);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// ICloudUserProfileList implementation
+//
+////////////////////////////////////////////////////////////////////////////////
+CloudUserProfileList::CloudUserProfileList()
+    : mParent(NULL)
+{
+}
+
+CloudUserProfileList::~CloudUserProfileList()
+{
+    LogRel(("CloudUserProfileListImpl::~CloudUserProfileListImpl()\n"));
+    unconst(mParent) = NULL;
+}
+
+HRESULT CloudUserProfileList::FinalConstruct()
+{
+    return BaseFinalConstruct();
+}
+
+void CloudUserProfileList::FinalRelease()
+{
+    uninit();
+
+    BaseFinalRelease();
+}
+
+void CloudUserProfileList::uninit()
+{
+
+}
+
+HRESULT CloudUserProfileList::init(VirtualBox *aParent)
+{
+    unconst(mParent) = aParent;
+
+    return S_OK;
+}
+
+
+HRESULT CloudUserProfileList::getSupportedPropertiesNames(std::vector<com::Utf8Str> &aPropertiesNames)
+{
+    LogRel(("CloudUserProfileList::getSupportedPropertiesNames:\n"));
+    aPropertiesNames.clear();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::readProfiles(const Utf8Str &strConfigPath)
+{
+    LogRel(("CloudUserProfileList::readProfiles: %s\n", strConfigPath.c_str()));
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::getProvider(CloudProviderId_T *aProvider)
+{
+    *aProvider = CloudProviderId_Unknown;
+    LogRel(("CloudUserProfileList::getProvider: %d\n", *aProvider));
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::createProfile(const com::Utf8Str &aProfileName,
+                                            const std::vector<com::Utf8Str> &aNames,
+                                            const std::vector<com::Utf8Str> &aValues)
+{
+    LogRel(("CloudUserProfileList::createProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size()));
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::updateProfile(const com::Utf8Str &aProfileName,
+                                            const std::vector<com::Utf8Str> &aNames,
+                                            const std::vector<com::Utf8Str> &aValues)
+{
+    LogRel(("CloudUserProfileList::updateProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size()));
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::getStoredProfilesNames(std::vector<com::Utf8Str> &aProfilesNames)
+{
+
+    LogRel(("CloudUserProfileList::getStoredProfilesNames:\n"));
+    aProfilesNames.clear();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::getProfileProperties(const com::Utf8Str &aProfileName,
+                                              std::vector<com::Utf8Str> &aReturnNames,
+                                              std::vector<com::Utf8Str> &aReturnValues)
+{
+    LogRel(("CloudUserProfileList::getProfileProperties: %s\n", aProfileName.c_str()));
+    aReturnNames.clear();
+    aReturnValues.clear();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::getPropertyDescription(const com::Utf8Str &aName,
+                                                     com::Utf8Str &aDescription)
+{
+    LogRel(("CloudUserProfileList::getPropertyDescription: %s, %s\n", aName.c_str(), aDescription.c_str()));
+    return VERR_NOT_IMPLEMENTED;
+}
+
+HRESULT CloudUserProfileList::createCloudClient(const com::Utf8Str &aProfileName,
+                                                ComPtr<ICloudClient> &aCloudClient)
+{
+    LogRel(("CloudUserProfileList::createCloudClient: %s\n", aProfileName.c_str()));
+
+    if (aCloudClient.isNull())
+    {
+        LogRel(("aCloudClient is NULL\n"));
+    }
+
+    return VERR_NOT_IMPLEMENTED;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// CloudConnectionOCI implementation
+//
+////////////////////////////////////////////////////////////////////////////////
+static struct
+{
+    const char *pszOCIConfigEntry, *pszDesciption;
+} const g_aOCIConfigEntryToDescription[] =
+{
+    { "user",               "OCID of the user calling the API." },
+    { "tenancy",            "OCID of your tenancy." },
+    { "compartment",        "OCID of your compartment." },
+    { "fingerprint",        "Fingerprint for the key pair being used." },
+    { "key_file",           "Full path and filename of the private key."
+                            "If you encrypted the key with a passphrase, you must also include "
+                            "the pass_phrase entry in the config file."},
+    { "pass_phrase",        "Passphrase used for the key, if it is encrypted." },
+    { "region",             "An Oracle Cloud Infrastructure region" },
+};
+
+
+OCIUserProfileList::OCIUserProfileList()
+{
+    LogRel(("OCIUserProfileList::OCIUserProfileList()\n"));
+    mpProfiles = new SimpleConfigFile(mParent);
+    LogRel(("Succeeded create SimpleConfigFile\n"));
+}
+
+OCIUserProfileList::~OCIUserProfileList()
+{
+    LogRel(("OCIUserProfileList::~OCIUserProfileList()\n"));
+    if (mpProfiles)
+        delete mpProfiles;
+}
+
+HRESULT OCIUserProfileList::createCloudClient(const com::Utf8Str &aProfileName,
+                                              ComPtr<ICloudClient> &aCloudClient)
+{
+    CloudProviderId_T providerId;
+    HRESULT hrc = getProvider(&providerId);
+
+    ComObjPtr<CloudClient> ptrCloudClient;
+    hrc = ptrCloudClient.createObject();
+    if (SUCCEEDED(hrc))
+    {
+        AutoReadLock wlock(this COMMA_LOCKVAL_SRC_POS);
+        hrc = ptrCloudClient->initCloudClient(this, mParent, providerId, aProfileName);
+        if (SUCCEEDED(hrc))
+        {
+            hrc = ptrCloudClient.queryInterfaceTo(aCloudClient.asOutParam());
+        }
+    }
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::readProfiles(const Utf8Str &strConfigPath)
+{
+    LogRel(("Reading profiles from %s\n", strConfigPath.c_str()));
+    HRESULT hrc = S_OK;
+    if ( !strConfigPath.isEmpty() )
+    {
+        mStrConfigPath = strConfigPath;
+        hrc = mpProfiles->read(mStrConfigPath);
+        if (SUCCEEDED(hrc))
+        {
+            LogRel(("Successfully read the profiles from the config %s\n", mStrConfigPath.c_str()));
+            hrc = mpProfiles->parse();
+            if (FAILED(hrc))
+            {
+                throw hrc;
+            }
+            LogRel(("Successfully parsed %d profiles\n", mpProfiles->getNumberOfSections()));
+        }
+    }
+    else
+    {
+        LogRel(("Empty path to config file\n"));
+        hrc = VERR_INVALID_PARAMETER;
+    }
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::createProfile(const com::Utf8Str &aProfileName,
+                                          const std::vector<com::Utf8Str> &aNames,
+                                          const std::vector<com::Utf8Str> &aValues)
+{
+    HRESULT hrc = S_OK;
+
+    if (!mpProfiles->isSectionExist(aProfileName))
+    {
+        std::map <Utf8Str, Utf8Str> newProfile;
+
+        for (size_t i=0;i<aNames.size();++i)
+        {
+            com::Utf8Str newValue = (i<aValues.size()) ? aValues.at(i) : "";
+            newProfile[aNames.at(i)] = newValue;
+        }
+
+        hrc = mpProfiles->addSection(aProfileName, newProfile);
+    }
+    else
+        hrc = VERR_ALREADY_EXISTS;
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::updateProfile(const com::Utf8Str &aProfileName, 
+                                          const std::vector<com::Utf8Str> &aNames,
+                                          const std::vector<com::Utf8Str> &aValues)
+{
+    HRESULT hrc = S_OK;
+    if (mpProfiles->isSectionExist(aProfileName))
+    {
+        std::map <Utf8Str, Utf8Str> newProfile;
+
+        for (size_t i=0;i<aNames.size();++i)
+        {
+            com::Utf8Str newValue = (i<aValues.size()) ? aValues.at(i) : "";
+            newProfile[aNames.at(i)] = newValue;
+        }
+
+        hrc = mpProfiles->updateSection(aProfileName, newProfile);
+    }
+    else
+        hrc = VERR_NOT_FOUND;
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::getStoredProfilesNames(std::vector<com::Utf8Str> &aProfilesNames)
+{
+    HRESULT hrc = S_OK;
+    aProfilesNames = mpProfiles->getSectionsNames();
+    if (aProfilesNames.empty())
+        hrc = VERR_NOT_FOUND;
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::getProfileProperties(const com::Utf8Str &aProfileName,
+                                                 std::vector<com::Utf8Str> &aReturnNames,
+                                                 std::vector<com::Utf8Str> &aReturnValues)
+{
+    HRESULT hrc = S_OK;
+
+    if (mpProfiles->isSectionExist(aProfileName))
+    {
+        std::map <Utf8Str, Utf8Str> profile;
+        hrc = getProfileProperties(aProfileName, profile);
+        if (SUCCEEDED(hrc))
+        {
+            aReturnNames.clear();
+            aReturnValues.clear();
+            std::map <Utf8Str, Utf8Str>::const_iterator cit = profile.begin();
+            while (cit!=profile.end())
+            {
+                aReturnNames.push_back(cit->first);
+                aReturnValues.push_back(cit->second);
+            }
+        }
+    }
+    else
+        hrc = VERR_NOT_FOUND;
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::getSupportedPropertiesNames(std::vector<com::Utf8Str> &aPropertiesNames)
+{
+    HRESULT hrc = S_OK;
+    for (size_t i = 0; i < RT_ELEMENTS(g_aOCIConfigEntryToDescription); ++i)
+        aPropertiesNames.push_back(g_aOCIConfigEntryToDescription[i].pszOCIConfigEntry);
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::getPropertyDescription(const com::Utf8Str &aName, com::Utf8Str &aDescription)
+{
+    HRESULT hrc = S_OK;
+    for (size_t i = 0; i < RT_ELEMENTS(g_aOCIConfigEntryToDescription); ++i)
+        if (aName.contains(g_aOCIConfigEntryToDescription[i].pszOCIConfigEntry, Utf8Str::CaseInsensitive))
+        {
+            aDescription = g_aOCIConfigEntryToDescription[i].pszDesciption;
+        }
+    return hrc;
+}
+
+
+HRESULT OCIUserProfileList::createProfile(const com::Utf8Str &aProfileName,
+                                          const std::map <Utf8Str, Utf8Str> &aProfile)
+{
+    HRESULT hrc = S_OK;
+
+    hrc = mpProfiles->addSection(aProfileName, aProfile);
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::updateProfile(const com::Utf8Str &aProfileName, 
+                                          const std::map <Utf8Str, Utf8Str> &aProfile)
+{
+    HRESULT hrc = S_OK;
+    if (mpProfiles->isSectionExist(aProfileName))
+        hrc = mpProfiles->updateSection(aProfileName, aProfile);
+    else
+        hrc = VERR_NOT_FOUND;
+
+    return hrc;
+}
+
+HRESULT OCIUserProfileList::getProfileProperties(const com::Utf8Str &aProfileName,
+                                                 std::map <Utf8Str, Utf8Str> &aProfile)
+{
+    HRESULT hrc = S_OK;
+    std::map <Utf8Str, Utf8Str> defProfile = mpProfiles->getSectionByName("DEFAULT");
+    std::map <Utf8Str, Utf8Str> reqProfile = mpProfiles->getSectionByName(aProfileName);
+
+    std::map <Utf8Str, Utf8Str>::iterator itDefProfile = defProfile.begin();
+    while (itDefProfile != defProfile.end())
+    {
+        std::map <Utf8Str, Utf8Str>::iterator itProfile = reqProfile.find(itDefProfile->first);
+        if (itProfile == reqProfile.end())
+        {
+            //Add a key=value pair from defProfile into the reqProfile if the key doesn't exist in the reqProfile.
+            reqProfile.insert(*itDefProfile);
+        }
+        ++itDefProfile;
+    }
+
+    if (!reqProfile.empty())
+        aProfile = reqProfile;
+    else
+        hrc = VERR_NOT_FOUND;
+
+    return hrc;
+}
+
Index: /trunk/src/VBox/Main/src-server/CloudUserProfileManagerImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/CloudUserProfileManagerImpl.cpp	(revision 73164)
+++ /trunk/src/VBox/Main/src-server/CloudUserProfileManagerImpl.cpp	(revision 73164)
@@ -0,0 +1,148 @@
+/* $Id$ */
+/** @file
+ * ICloudUserProfileManager  COM class implementations.
+ */
+
+/*
+ * Copyright (C) 2008-2018 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#include <iprt/path.h>
+#include <iprt/cpp/utils.h>
+#include <VBox/com/array.h>
+#include <map>
+
+#include "CloudUserProfileManagerImpl.h"
+#include "CloudUserProfileListImpl.h"
+#include "VirtualBoxImpl.h"
+#include "Global.h"
+#include "ProgressImpl.h"
+#include "MachineImpl.h"
+#include "AutoCaller.h"
+#include "Logging.h"
+
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// CloudUserProfileManager constructor / destructor
+//
+// ////////////////////////////////////////////////////////////////////////////////
+CloudUserProfileManager::CloudUserProfileManager()
+    : mParent(NULL)
+{
+}
+
+CloudUserProfileManager::~CloudUserProfileManager()
+{
+}
+
+
+HRESULT CloudUserProfileManager::FinalConstruct()
+{
+    return BaseFinalConstruct();
+}
+
+void CloudUserProfileManager::FinalRelease()
+{
+    uninit();
+
+    BaseFinalRelease();
+}
+
+HRESULT CloudUserProfileManager::init(VirtualBox *aParent)
+{
+    unconst(mParent) = aParent;
+    mSupportedProviders.clear();
+    mSupportedProviders.push_back(CloudProviderId_OCI);
+    return S_OK;
+}
+
+void CloudUserProfileManager::uninit()
+{
+    /* Enclose the state transition Ready->InUninit->NotReady */
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+
+    unconst(mParent) = NULL;
+}
+
+HRESULT CloudUserProfileManager::getSupportedProviders(std::vector<CloudProviderId_T> &aSupportedProviders)
+{
+    aSupportedProviders = mSupportedProviders;
+    return S_OK;
+}
+
+HRESULT CloudUserProfileManager::getAllProfiles(std::vector<ComPtr<ICloudUserProfileList> > &aProfilesList)
+{
+    HRESULT hrc = S_OK;
+    std::vector<ComPtr<ICloudUserProfileList> > lProfilesList;
+    for (size_t i=0;i<mSupportedProviders.size();++i)
+    {
+        ComPtr<ICloudUserProfileList> lProfiles;
+        hrc = getProfilesByProvider(mSupportedProviders.at(i), lProfiles);
+        if (FAILED(hrc))
+            break;
+
+        lProfilesList.push_back(lProfiles);
+    }
+
+    if (SUCCEEDED(hrc))
+        aProfilesList = lProfilesList;
+
+    return hrc;
+}
+
+HRESULT CloudUserProfileManager::getProfilesByProvider(CloudProviderId_T aProviderType, 
+                                                       ComPtr<ICloudUserProfileList> &aProfiles)
+{
+    ComObjPtr<CloudUserProfileList> ptrCloudUserProfileList;
+    HRESULT hrc = ptrCloudUserProfileList.createObject();
+    switch(aProviderType)
+    {
+        case CloudProviderId_OCI:
+        default:
+            ComObjPtr<OCIUserProfileList> ptrOCIUserProfileList;
+            hrc = ptrOCIUserProfileList.createObject();
+            if (SUCCEEDED(hrc))
+            {
+                AutoReadLock wlock(this COMMA_LOCKVAL_SRC_POS);
+
+                hrc = ptrOCIUserProfileList->init(mParent);
+                if (SUCCEEDED(hrc))
+                {
+                    Utf8Str strConfigPath = mParent->i_homeDir();
+                    strConfigPath.append(RTPATH_SLASH_STR)
+                                 .append(".oci")
+                                 .append(RTPATH_SLASH_STR)
+                                 .append("config");
+                    LogRel(("config = %s\n", strConfigPath.c_str()));
+                    hrc = ptrOCIUserProfileList->readProfiles(strConfigPath);
+                    if (SUCCEEDED(hrc))
+                    {
+                        LogRel(("Reading profiles from %s has been done\n", strConfigPath.c_str()));
+                    }
+                    else
+                    {
+                        LogRel(("Reading profiles from %s hasn't been done\n", strConfigPath.c_str()));
+                    }
+                    ptrCloudUserProfileList = ptrOCIUserProfileList;
+                    hrc = ptrCloudUserProfileList.queryInterfaceTo(aProfiles.asOutParam());
+                }
+            }
+            break;
+    }
+
+    return hrc;
+}
+
