Changeset 73571 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Aug 8, 2018 4:10:30 PM (7 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/CloudUserProfileManagerImpl.cpp
r73554 r73571 1 1 /* $Id$ */ 2 2 /** @file 3 * ICloud UserProfileManager COM class implementations.3 * ICloudProviderManager COM class implementations. 4 4 */ 5 5 … … 36 36 //////////////////////////////////////////////////////////////////////////////// 37 37 // 38 // Cloud UserProfileManager constructor / destructor38 // CloudProviderManager constructor / destructor 39 39 // 40 40 // //////////////////////////////////////////////////////////////////////////////// 41 Cloud UserProfileManager::CloudUserProfileManager()41 CloudProviderManager::CloudProviderManager() 42 42 : mParent(NULL) 43 43 { 44 44 } 45 45 46 Cloud UserProfileManager::~CloudUserProfileManager()47 { 48 } 49 50 51 HRESULT Cloud UserProfileManager::FinalConstruct()46 CloudProviderManager::~CloudProviderManager() 47 { 48 } 49 50 51 HRESULT CloudProviderManager::FinalConstruct() 52 52 { 53 53 return BaseFinalConstruct(); 54 54 } 55 55 56 void Cloud UserProfileManager::FinalRelease()56 void CloudProviderManager::FinalRelease() 57 57 { 58 58 uninit(); … … 61 61 } 62 62 63 HRESULT Cloud UserProfileManager::init(VirtualBox *aParent)63 HRESULT CloudProviderManager::init(VirtualBox *aParent) 64 64 { 65 65 /* Enclose the state transition NotReady->InInit->Ready */ … … 75 75 ExtPackManager *pExtPackMgr = aParent->i_getExtPackManager(); 76 76 std::vector<ComPtr<IUnknown> > Objects; 77 com::Guid idObj(COM_IIDOF(ICloud UserProfileManager));77 com::Guid idObj(COM_IIDOF(ICloudProviderManager)); 78 78 pExtPackMgr->i_queryObjects(idObj.toString(), Objects); 79 79 for (unsigned i = 0; i < Objects.size(); i++) 80 80 { 81 ComPtr<ICloud UserProfileManager> ptrTmp;81 ComPtr<ICloudProviderManager> ptrTmp; 82 82 HRESULT hrc = Objects[i].queryInterfaceTo(ptrTmp.asOutParam()); 83 83 if (SUCCEEDED(hrc)) … … 87 87 88 88 mSupportedProviders.clear(); 89 mSupportedProviders.push_back(CloudProviderId_OCI); 89 mSupportedProviders.push_back("OCI"); 90 90 91 #endif 91 92 … … 94 95 } 95 96 96 void Cloud UserProfileManager::uninit()97 void CloudProviderManager::uninit() 97 98 { 98 99 /* Enclose the state transition Ready->InUninit->NotReady */ … … 104 105 } 105 106 106 HRESULT Cloud UserProfileManager::getSupportedProviders(std::vector<CloudProviderId_T> &aSupportedProviders)107 HRESULT CloudProviderManager::getSupportedProviders(std::vector<Utf8Str> &aSupportedProviders) 107 108 { 108 109 #ifdef VBOX_WITH_CLOUD_PROVIDERS_IN_EXTPACK … … 113 114 for (unsigned i = 0; i < mUserProfileManagers.size(); i++) 114 115 { 115 SafeArray< CloudProviderId_T> FromCurrent;116 SafeArray<Utf8Str> FromCurrent; 116 117 HRESULT hrc2 = mUserProfileManagers[i]->COMGETTER(SupportedProviders)(ComSafeArrayAsOutParam(FromCurrent)); 117 118 if (SUCCEEDED(hrc2)) … … 130 131 } 131 132 132 HRESULT Cloud UserProfileManager::getAllProfiles(std::vector<ComPtr<ICloudUserProfiles> > &aProfilesList)133 HRESULT CloudProviderManager::getAllProfiles(std::vector<ComPtr<ICloudProvider> > &aProfilesList) 133 134 { 134 135 #ifdef VBOX_WITH_CLOUD_PROVIDERS_IN_EXTPACK … … 139 140 for (unsigned i = 0; i < mUserProfileManagers.size(); i++) 140 141 { 141 SafeIfaceArray<ICloud UserProfiles> FromCurrent;142 SafeIfaceArray<ICloudProvider> FromCurrent; 142 143 HRESULT hrc2 = mUserProfileManagers[i]->GetAllProfiles(ComSafeArrayAsOutParam(FromCurrent)); 143 144 if (SUCCEEDED(hrc2)) … … 153 154 #else 154 155 HRESULT hrc = S_OK; 155 std::vector<ComPtr<ICloud UserProfiles> > lProfilesList;156 std::vector<ComPtr<ICloudProvider> > lProfilesList; 156 157 for (size_t i=0;i<mSupportedProviders.size();++i) 157 158 { 158 ComPtr<ICloud UserProfiles> lProfiles;159 ComPtr<ICloudProvider> lProfiles; 159 160 hrc = getProfilesByProvider(mSupportedProviders.at(i), lProfiles); 160 161 if (FAILED(hrc)) … … 171 172 } 172 173 173 HRESULT Cloud UserProfileManager::getProfilesByProvider(CloudProviderId_T aProviderType,174 ComPtr<ICloudUserProfiles> &aProfiles)174 HRESULT CloudProviderManager::getProfilesByProvider(const com::Utf8Str &aProviderName, 175 ComPtr<ICloudProvider> &aProfiles) 175 176 { 176 177 #ifdef VBOX_WITH_CLOUD_PROVIDERS_IN_EXTPACK … … 189 190 #else 190 191 191 ComObjPtr<CloudUserProfiles> ptrCloudUserProfiles; 192 HRESULT hrc = ptrCloudUserProfiles.createObject(); 193 switch(aProviderType) 194 { 195 case CloudProviderId_OCI: 196 default: 197 ComObjPtr<OCIUserProfiles> ptrOCIUserProfiles; 198 hrc = ptrOCIUserProfiles.createObject(); 192 ComObjPtr<CloudProvider> ptrCloudProvider; 193 HRESULT hrc = ptrCloudProvider.createObject(); 194 if (aProviderName.equals("OCI")) 195 { 196 ComObjPtr<OCIUserProfiles> ptrOCIUserProfiles; 197 hrc = ptrOCIUserProfiles.createObject(); 198 if (SUCCEEDED(hrc)) 199 { 200 AutoReadLock wlock(this COMMA_LOCKVAL_SRC_POS); 201 202 hrc = ptrOCIUserProfiles->init(mParent); 199 203 if (SUCCEEDED(hrc)) 200 204 { 201 AutoReadLock wlock(this COMMA_LOCKVAL_SRC_POS); 202 203 hrc = ptrOCIUserProfiles->init(mParent); 204 if (SUCCEEDED(hrc)) 205 char szOciConfigPath[RTPATH_MAX]; 206 int vrc = RTPathUserHome(szOciConfigPath, sizeof(szOciConfigPath)); 207 if (RT_SUCCESS(vrc)) 208 vrc = RTPathAppend(szOciConfigPath, sizeof(szOciConfigPath), ".oci" RTPATH_SLASH_STR "config"); 209 if (RT_SUCCESS(vrc)) 205 210 { 206 char szOciConfigPath[RTPATH_MAX]; 207 int vrc = RTPathUserHome(szOciConfigPath, sizeof(szOciConfigPath)); 208 if (RT_SUCCESS(vrc)) 209 vrc = RTPathAppend(szOciConfigPath, sizeof(szOciConfigPath), ".oci" RTPATH_SLASH_STR "config"); 210 if (RT_SUCCESS(vrc)) 211 LogRel(("config = %s\n", szOciConfigPath)); 212 if (RTFileExists(szOciConfigPath)) 211 213 { 212 LogRel(("config = %s\n", szOciConfigPath)); 213 if (RTFileExists(szOciConfigPath)) 214 { 215 hrc = ptrOCIUserProfiles->readProfiles(szOciConfigPath); 216 if (SUCCEEDED(hrc)) 217 LogRel(("Reading profiles from %s has been done\n", szOciConfigPath)); 218 else 219 LogRel(("Reading profiles from %s hasn't been done\n", szOciConfigPath)); 220 221 ptrCloudUserProfiles = ptrOCIUserProfiles; 222 hrc = ptrCloudUserProfiles.queryInterfaceTo(aProfiles.asOutParam()); 223 } 214 hrc = ptrOCIUserProfiles->readProfiles(szOciConfigPath); 215 if (SUCCEEDED(hrc)) 216 LogRel(("Reading profiles from %s has been done\n", szOciConfigPath)); 224 217 else 225 hrc = setErrorBoth(E_FAIL, VERR_FILE_NOT_FOUND, tr("Could not locate the config file '%s'"), 226 szOciConfigPath); 218 LogRel(("Reading profiles from %s hasn't been done\n", szOciConfigPath)); 219 220 ptrCloudProvider = ptrOCIUserProfiles; 221 hrc = ptrCloudProvider.queryInterfaceTo(aProfiles.asOutParam()); 227 222 } 228 223 else 229 hrc = setErrorVrc(vrc); 224 hrc = setErrorBoth(E_FAIL, VERR_FILE_NOT_FOUND, tr("Could not locate the config file '%s'"), 225 szOciConfigPath); 230 226 } 227 else 228 hrc = setErrorVrc(vrc); 231 229 } 232 break;233 } 234 235 return hrc; 236 #endif 237 } 238 230 } 231 } 232 233 return hrc; 234 #endif 235 } 236 -
trunk/src/VBox/Main/src-server/CloudUserProfilesImpl.cpp
r73337 r73571 1 1 /* $Id$ */ 2 2 /** @file 3 * ICloud UserProfilesCOM class implementations.3 * ICloudProvider COM class implementations. 4 4 */ 5 5 … … 210 210 //////////////////////////////////////////////////////////////////////////////// 211 211 // 212 // ICloud UserProfilesimplementation212 // ICloudProvider implementation 213 213 // 214 214 //////////////////////////////////////////////////////////////////////////////// 215 Cloud UserProfiles::CloudUserProfiles()215 CloudProvider::CloudProvider() 216 216 : mParent(NULL) 217 217 { 218 218 } 219 219 220 Cloud UserProfiles::~CloudUserProfiles()221 { 222 LogRel(("Cloud UserProfilesImpl::~CloudUserProfilesImpl()\n"));220 CloudProvider::~CloudProvider() 221 { 222 LogRel(("CloudProvider::~CloudProvider()\n")); 223 223 unconst(mParent) = NULL; 224 224 } 225 225 226 HRESULT Cloud UserProfiles::FinalConstruct()226 HRESULT CloudProvider::FinalConstruct() 227 227 { 228 228 return BaseFinalConstruct(); 229 229 } 230 230 231 void Cloud UserProfiles::FinalRelease()231 void CloudProvider::FinalRelease() 232 232 { 233 233 uninit(); … … 236 236 } 237 237 238 void Cloud UserProfiles::uninit()238 void CloudProvider::uninit() 239 239 { 240 240 /* Enclose the state transition Ready->InUninit->NotReady */ … … 246 246 } 247 247 248 HRESULT Cloud UserProfiles::init(VirtualBox *aParent)248 HRESULT CloudProvider::init(VirtualBox *aParent) 249 249 { 250 250 /* Enclose the state transition NotReady->InInit->Ready */ … … 259 259 260 260 261 HRESULT Cloud UserProfiles::getSupportedPropertiesNames(std::vector<com::Utf8Str> &aPropertiesNames)262 { 263 LogRel(("Cloud UserProfiles::getSupportedPropertiesNames:\n"));261 HRESULT CloudProvider::getSupportedPropertiesNames(std::vector<com::Utf8Str> &aPropertiesNames) 262 { 263 LogRel(("CloudProvider::getSupportedPropertiesNames:\n")); 264 264 aPropertiesNames.clear(); 265 265 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 266 266 } 267 267 268 HRESULT Cloud UserProfiles::readProfiles(const Utf8Str &strConfigPath)269 { 270 LogRel(("Cloud UserProfiles::readProfiles: %s\n", strConfigPath.c_str()));271 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 272 } 273 274 HRESULT Cloud UserProfiles::getProvider(CloudProviderId_T *aProvider)268 HRESULT CloudProvider::readProfiles(const Utf8Str &strConfigPath) 269 { 270 LogRel(("CloudProvider::readProfiles: %s\n", strConfigPath.c_str())); 271 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 272 } 273 274 HRESULT CloudProvider::getProvider(CloudProviderId_T *aProvider) 275 275 { 276 276 *aProvider = CloudProviderId_Unknown; 277 LogRel(("Cloud UserProfiles::getProvider: %d\n", *aProvider));278 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 279 } 280 281 HRESULT Cloud UserProfiles::createProfile(const com::Utf8Str &aProfileName,277 LogRel(("CloudProvider::getProvider: %d\n", *aProvider)); 278 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 279 } 280 281 HRESULT CloudProvider::createProfile(const com::Utf8Str &aProfileName, 282 282 const std::vector<com::Utf8Str> &aNames, 283 283 const std::vector<com::Utf8Str> &aValues) 284 284 { 285 LogRel(("Cloud UserProfiles::createProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size()));286 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 287 } 288 289 HRESULT Cloud UserProfiles::updateProfile(const com::Utf8Str &aProfileName,285 LogRel(("CloudProvider::createProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size())); 286 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 287 } 288 289 HRESULT CloudProvider::updateProfile(const com::Utf8Str &aProfileName, 290 290 const std::vector<com::Utf8Str> &aNames, 291 291 const std::vector<com::Utf8Str> &aValues) 292 292 { 293 LogRel(("Cloud UserProfiles::updateProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size()));294 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 295 } 296 297 HRESULT Cloud UserProfiles::getStoredProfilesNames(std::vector<com::Utf8Str> &aProfilesNames)298 { 299 300 LogRel(("Cloud UserProfiles::getStoredProfilesNames:\n"));293 LogRel(("CloudProvider::updateProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size())); 294 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 295 } 296 297 HRESULT CloudProvider::getStoredProfilesNames(std::vector<com::Utf8Str> &aProfilesNames) 298 { 299 300 LogRel(("CloudProvider::getStoredProfilesNames:\n")); 301 301 aProfilesNames.clear(); 302 302 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 303 303 } 304 304 305 HRESULT Cloud UserProfiles::getProfileProperties(const com::Utf8Str &aProfileName,305 HRESULT CloudProvider::getProfileProperties(const com::Utf8Str &aProfileName, 306 306 std::vector<com::Utf8Str> &aReturnNames, 307 307 std::vector<com::Utf8Str> &aReturnValues) 308 308 { 309 LogRel(("Cloud UserProfiles::getProfileProperties: %s\n", aProfileName.c_str()));309 LogRel(("CloudProvider::getProfileProperties: %s\n", aProfileName.c_str())); 310 310 aReturnNames.clear(); 311 311 aReturnValues.clear(); … … 313 313 } 314 314 315 HRESULT Cloud UserProfiles::getPropertyDescription(const com::Utf8Str &aName,315 HRESULT CloudProvider::getPropertyDescription(const com::Utf8Str &aName, 316 316 com::Utf8Str &aDescription) 317 317 { 318 LogRel(("Cloud UserProfiles::getPropertyDescription: %s, %s\n", aName.c_str(), aDescription.c_str()));319 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 320 } 321 322 HRESULT Cloud UserProfiles::createCloudClient(const com::Utf8Str &aProfileName,318 LogRel(("CloudProvider::getPropertyDescription: %s, %s\n", aName.c_str(), aDescription.c_str())); 319 return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented")); 320 } 321 322 HRESULT CloudProvider::createCloudClient(const com::Utf8Str &aProfileName, 323 323 ComPtr<ICloudClient> &aCloudClient) 324 324 { 325 LogRel(("Cloud UserProfiles::createCloudClient: %s\n", aProfileName.c_str()));325 LogRel(("CloudProvider::createCloudClient: %s\n", aProfileName.c_str())); 326 326 327 327 if (aCloudClient.isNull()) -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r73155 r73571 1820 1820 } 1821 1821 1822 HRESULT VirtualBox::createCloud UserProfileManager(ComPtr<ICloudUserProfileManager> &aManager)1823 { 1824 ComObjPtr<Cloud UserProfileManager> ptrCloudUserProfileManager;1825 HRESULT hrc = ptrCloud UserProfileManager.createObject();1822 HRESULT VirtualBox::createCloudProviderManager(ComPtr<ICloudProviderManager> &aManager) 1823 { 1824 ComObjPtr<CloudProviderManager> ptrCloudProviderManager; 1825 HRESULT hrc = ptrCloudProviderManager.createObject(); 1826 1826 if (SUCCEEDED(hrc)) 1827 1827 { 1828 1828 AutoReadLock wlock(this COMMA_LOCKVAL_SRC_POS); 1829 hrc = ptrCloud UserProfileManager->init(this);1829 hrc = ptrCloudProviderManager->init(this); 1830 1830 if (SUCCEEDED(hrc)) 1831 hrc = ptrCloud UserProfileManager.queryInterfaceTo(aManager.asOutParam());1831 hrc = ptrCloudProviderManager.queryInterfaceTo(aManager.asOutParam()); 1832 1832 } 1833 1833 return hrc;
Note:
See TracChangeset
for help on using the changeset viewer.