+ OIC_LOG(INFO, ES_REMOTE_ENROLLEE_TAG, "provisionCloudProperties IN");
+
+ if(!callback)
+ {
+ throw ESInvalidParameterException("Callback is empty");
+ }
+
+ m_cloudPropProvStatusCb = callback;
+
+ if((cloudProp.getAuthCode().empty() && cloudProp.getAccessToken().empty()) ||
+ cloudProp.getAuthProvider().empty() ||
+ cloudProp.getCiServer().empty())
+ {
+ throw ESBadRequestException ("Invalid Cloud Provisiong Info.");
+ }
+
+ if(resource)
+ {
+ if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_EASYSETUP ||
+ resource->connectivityType() & CT_ADAPTER_TCP)
+ {
+ OIC_LOG(ERROR, ES_REMOTE_ENROLLEE_TAG, "Given resource is not valid due to wrong rt or conntype");
+ throw ESInvalidParameterException("A given OCResource is wrong");
+ }
+
+ auto interfaces = resource->getResourceInterfaces();
+ bool isFound = false;
+ for(auto interface : interfaces)
+ {
+ if(interface.compare(BATCH_INTERFACE) == 0)
+ {
+ OIC_LOG(INFO, ES_REMOTE_ENROLLEE_TAG, "RemoteEnrollee object is succeessfully created");
+ OIC_LOG_V(INFO_PRIVATE, ES_REMOTE_ENROLLEE_TAG, "HOST: %s", resource->host().c_str());
+ OIC_LOG_V(INFO_PRIVATE, ES_REMOTE_ENROLLEE_TAG, "URI: %s", resource->uri().c_str());
+ OIC_LOG_V(INFO_PRIVATE, ES_REMOTE_ENROLLEE_TAG, "SID: %s", resource->sid().c_str());
+ OIC_LOG_V(INFO_PRIVATE, ES_REMOTE_ENROLLEE_TAG, "CONNECTIVITY: %d", resource->connectivityType());
+ isFound = true;
+ }
+ }
+
+ if(!isFound)
+ {
+ throw ESInvalidParameterException("A given OCResource has no batch interface");
+ }
+ }
+
+ try