VirtualBox

Ignore:
Timestamp:
Aug 6, 2018 10:10:52 PM (6 years ago)
Author:
vboxsync
Message:

bugref:9152. New classes CloudAPI, OCIIAM, OCIObjectStorage, OCICompute, CloudCommandCl, DataModel, DataParser and their descendants.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/CloudClientImpl.h

    r73337 r73535  
    2323
    2424#include "CloudClientWrap.h"
     25#include "ProgressImpl.h"
    2526
    2627/* VBox forward declarations */
    2728class CloudUserProfiles;
     29class CloudCommandCl;
     30class CloudAPI;
     31struct DataModel;
    2832
    29 class CloudClient :
     33////////////////////////////////////////////////////////////////////////////////
     34//
     35// CloudClient
     36//
     37// /////////////////////////////////////////////////////////////////////////////
     38class CloudClient:
    3039    public CloudClientWrap
    3140{
    3241public:
    3342    DECLARE_EMPTY_CTOR_DTOR(CloudClient)
    34 //  explicit CloudClient(CloudProviderId_T aCloudProvider);
    3543
    3644    HRESULT FinalConstruct();
     
    4755    ComPtr<VirtualBox> const mParent;       /**< Strong reference to the parent object (VirtualBox/IMachine). */
    4856    CloudProviderId_T mCloudProvider;
    49     std::map <Utf8Str, Utf8Str> userProfile;
     57    std::map <Utf8Str, Utf8Str> mCloudProfile;
     58    std::map <com::Guid, CloudCommandCl*> mCloudCommandMap;
     59    std::map <Utf8Str, CloudAPI*> mCloudAPIInstanceMap;
    5060
    5161private:
     62    HRESULT createCommand(CloudCommand_T aCloudCommand, com::Guid &aId);
     63    HRESULT runCommand(const com::Guid &aId, LONG64 aTimeout, CloudCommandResult_T *aResult);
     64//  HRESULT runCommand(const com::Guid &aId, LONG64 aTimeout, CloudCommandResult_T *aResult, ComPtr<IProgress> &aProgress);
     65    HRESULT validateCommand(const com::Guid &aId, BOOL *aValid);
     66    HRESULT checkCommandResult(const com::Guid &aId,
     67                               LONG64 *aStartTime,
     68                               LONG64 *aLastTime,
     69                               CloudCommandResult_T *aResult);
     70
     71    HRESULT getCommandParameterNames(CloudCommand_T aCloudCommand,
     72                                     std::vector<com::Utf8Str> &aParameterNames);
     73    HRESULT getCommandParameterProperties(const com::Utf8Str &aParameterName,
     74                                          com::Utf8Str &aParameterType,
     75                                          com::Utf8Str &aParameterDesc,
     76                                          std::vector<com::Utf8Str> &aParameterValues);
     77    HRESULT getCommandParameters(CloudCommand_T aCloudCommand, com::Utf8Str &aJsonString);
     78    HRESULT setCommandParameters(const com::Guid &aId,
     79                                 const std::vector<com::Utf8Str> &aNames,
     80                                 const std::vector<com::Utf8Str> &aValues);
     81    HRESULT getCommandsForOperation(CloudOperation_T aCloudOperation,
     82                                    BOOL aPrep,
     83                                    std::vector<CloudCommand_T> &aCloudCommands);
    5284    HRESULT getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString);
    5385
    54     HRESULT createOperation(const com::Utf8Str &aProfileName,
    55                             CloudOperation_T aCloudOperation,
    56                             com::Guid &aOpId);
    57     HRESULT runOperation(const com::Guid &aOpId,
    58                          LONG64 aTimeout);
    59     HRESULT checkOperationResult(const com::Guid &aOpId,
    60                                  LONG64 *aStartOpTime,
    61                                  LONG64 *aLastTime,
    62                                  CloudOperationResult_T *aResult);
    63     HRESULT getOperationParameterNames(CloudOperation_T aCloudOperation,
    64                                        std::vector<com::Utf8Str> &aParameterNames);
    65     HRESULT getOperationParameterProperties(const com::Utf8Str &aOpParameterName,
    66                                             com::Utf8Str &aOpParameterType,
    67                                             com::Utf8Str &aOpParameterDesc,
    68                                             std::vector<com::Utf8Str> &aOpParameterValues);
    69     HRESULT setParametersForOperation(const com::Guid &aOpId,
    70                                       const std::vector<com::Utf8Str> &aValues);
     86protected:
     87    //Next 4 functions are wrappers for the corresponding private functions without prefix "i_"
     88    int i_createCommand(CloudCommand_T aCloudCommand, com::Guid &aId);
     89    int i_runCommand(CloudCommandCl &aCC);
     90//  int i_runCommand(CloudCommandCl &aCC, ComObjPtr<Progress> *aProgress);
     91    int i_validateCommand(CloudCommandCl &aCC,
     92                          const std::map<Utf8Str, Utf8Str> &aParamNameValueMap,
     93                          bool fWeak);
     94    int i_checkCommandResult(CloudCommandCl &aCC, CloudCommandResult_T &aResult);
     95    //End 4 wrappers
     96
     97    int i_getCommandById(const com::Guid &aId, CloudCommandCl **aCC);
     98    int i_parseResponse(CloudCommandCl &aCC);
     99    virtual int i_getCommandParameterNames(const CloudCommandCl &aCC,
     100                                           std::vector<com::Utf8Str> &aParameterNames);
     101    virtual int i_isSimpleCommand(const CloudCommandCl &aCC, bool &fSimple);
     102//  virtual int i_findCommandById(const com::Guid &aId, CloudCommandCl &res);
     103    virtual int i_queryAPIForCommand(CloudCommand_T aCommand, CloudAPI **apiObj);
     104    virtual HRESULT i_getSupportedAPIs(std::list<Utf8Str> &apiNames);
     105    virtual HRESULT i_queryAPI(const Utf8Str &apiName, CloudAPI **apiObj);
     106    virtual int i_queryAPINameForCommand(CloudCommand_T aCommand, Utf8Str &apiName);
     107    HRESULT i_setUpProgress(ComObjPtr<Progress> &pProgress,
     108                            const Utf8Str &strDescription,
     109                            ULONG aOperations);
    71110};
    72111
    73 class CloudClientOCI :
    74     public CloudClient
     112////////////////////////////////////////////////////////////////////////////////
     113//
     114// CloudCLientOCI
     115//
     116// /////////////////////////////////////////////////////////////////////////////
     117class CloudClientOCI : public CloudClient
    75118{
    76119public:
    77     DECLARE_EMPTY_CTOR_DTOR(CloudClientOCI)
    78 
     120    CloudClientOCI();
     121    ~CloudClientOCI();
    79122    HRESULT initCloudClient(CloudUserProfiles *aProfiles,
    80123                            VirtualBox *aParent,
    81124                            CloudProviderId_T aCloudProvider,
    82125                            const com::Utf8Str &aProfileName);
     126private:
     127    HRESULT getCommandsForOperation(CloudOperation_T aCloudOperation,
     128                                    BOOL aPrep,
     129                                    std::vector<CloudCommand_T> &aCloudCommands);
     130    HRESULT getCommandParameters(CloudCommand_T aCommand, com::Utf8Str &aJsonString);
     131    HRESULT getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString);
     132    HRESULT getCommandParameterNames(CloudCommand_T aCloudCommand, std::vector<com::Utf8Str> &aParameterNames);
    83133
    84 private:
    85     HRESULT getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString);
     134protected:
    86135
    87     HRESULT createOperation(const com::Utf8Str &aProfileName,
    88                             CloudOperation_T aCloudOperation,
    89                             com::Guid &aOpId);
    90     HRESULT runOperation(const com::Guid &aOpId,
    91                          LONG64 aTimeout);
    92     HRESULT checkOperationResult(const com::Guid &aOpId,
    93                                  LONG64 *aStartOpTime,
    94                                  LONG64 *aLastTime,
    95                                  CloudOperationResult_T *aResult);
    96     HRESULT getOperationParameterNames(CloudOperation_T aCloudOperation,
    97                                        std::vector<com::Utf8Str> &aParameterNames);
    98     HRESULT getOperationParameterProperties(const com::Utf8Str &aOpParameterName,
    99                                             com::Utf8Str &aOpParameterType,
    100                                             com::Utf8Str &aOpParameterDesc,
    101                                             std::vector<com::Utf8Str> &aOpParameterValues);
    102     HRESULT setParametersForOperation(const com::Guid &aOpId,
    103                                       const std::vector<com::Utf8Str> &aValues);
     136    int i_isSimpleCommand(const CloudCommandCl &aCC, bool &fSimple);
     137    int i_queryAPIForCommand(CloudCommand_T aCommand, CloudAPI **apiObj);
     138    HRESULT i_getSupportedAPIs(std::list<Utf8Str> &apiNames);
     139    HRESULT i_queryAPI(const Utf8Str &apiName, CloudAPI **apiObj);
     140    int i_queryAPINameForCommand(CloudCommand_T aCommand, Utf8Str &apiName);
     141    int i_extractAskedParamsFromResponse(CloudCommandCl &aCC, std::map<Utf8Str, Utf8Str> &aParams);
    104142};
     143
     144////////////////////////////////////////////////////////////////////////////////
     145//
     146// CloudCLientGCP
     147//
     148// /////////////////////////////////////////////////////////////////////////////
     149//CloudCLientGCP : public CloudClient
     150//{
     151//    CloudCLientGCP();
     152//    ~CloudCLientGCP();
     153//};
    105154
    106155#endif // !____H_CLOUDCLIENTIMPL
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette