Changeset 73535 in vbox for trunk/src/VBox/Main/include/CloudClientImpl.h
- Timestamp:
- Aug 6, 2018 10:10:52 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/CloudClientImpl.h
r73337 r73535 23 23 24 24 #include "CloudClientWrap.h" 25 #include "ProgressImpl.h" 25 26 26 27 /* VBox forward declarations */ 27 28 class CloudUserProfiles; 29 class CloudCommandCl; 30 class CloudAPI; 31 struct DataModel; 28 32 29 class CloudClient : 33 //////////////////////////////////////////////////////////////////////////////// 34 // 35 // CloudClient 36 // 37 // ///////////////////////////////////////////////////////////////////////////// 38 class CloudClient: 30 39 public CloudClientWrap 31 40 { 32 41 public: 33 42 DECLARE_EMPTY_CTOR_DTOR(CloudClient) 34 // explicit CloudClient(CloudProviderId_T aCloudProvider);35 43 36 44 HRESULT FinalConstruct(); … … 47 55 ComPtr<VirtualBox> const mParent; /**< Strong reference to the parent object (VirtualBox/IMachine). */ 48 56 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; 50 60 51 61 private: 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); 52 84 HRESULT getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString); 53 85 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); 86 protected: 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); 71 110 }; 72 111 73 class CloudClientOCI : 74 public CloudClient 112 //////////////////////////////////////////////////////////////////////////////// 113 // 114 // CloudCLientOCI 115 // 116 // ///////////////////////////////////////////////////////////////////////////// 117 class CloudClientOCI : public CloudClient 75 118 { 76 119 public: 77 DECLARE_EMPTY_CTOR_DTOR(CloudClientOCI)78 120 CloudClientOCI(); 121 ~CloudClientOCI(); 79 122 HRESULT initCloudClient(CloudUserProfiles *aProfiles, 80 123 VirtualBox *aParent, 81 124 CloudProviderId_T aCloudProvider, 82 125 const com::Utf8Str &aProfileName); 126 private: 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); 83 133 84 private: 85 HRESULT getOperationParameters(CloudOperation_T aCloudOperation, com::Utf8Str &aJsonString); 134 protected: 86 135 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); 104 142 }; 143 144 //////////////////////////////////////////////////////////////////////////////// 145 // 146 // CloudCLientGCP 147 // 148 // ///////////////////////////////////////////////////////////////////////////// 149 //CloudCLientGCP : public CloudClient 150 //{ 151 // CloudCLientGCP(); 152 // ~CloudCLientGCP(); 153 //}; 105 154 106 155 #endif // !____H_CLOUDCLIENTIMPL
Note:
See TracChangeset
for help on using the changeset viewer.