// limitations under the License.
//
-
-#include <dpl/log/log.h>
-
#include <string>
-
#include <CommonsJavaScript/PrivateObject.h>
#include <CommonsJavaScript/Converter.h>
#include <CommonsJavaScript/JSUtils.h>
#include "OnDataSyncStateChanged.h"
#include "DataSyncManager.h"
-
#include "JSDataSyncManager.h"
#include "DataSyncConverter.h"
#include "JSSyncInfo.h"
#include "DataSyncResponseDispatcher.h"
#include "DataSyncMultiCallback.h"
#include "DataSyncListenerManager.h"
+#include <Logger.h>
using namespace WrtDeviceApis::Commons;
using namespace WrtDeviceApis::CommonsJavaScript;
void JSDataSyncManager::initialize(JSContextRef context, JSObjectRef object)
{
if (!JSObjectGetPrivate(object)) {
- LogInfo("Create datasync manager private object.");
+ LoggerI("Create datasync manager private object.");
IDataSyncManagerPtr datasync(new DataSyncManager());
DataSyncManagerPrivObject *priv = new DataSyncManagerPrivObject(context, datasync);
if (!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
delete priv;
}
} else {
- LogInfo("Private object already set.");
+ LoggerI("Private object already set.");
}
}
{
DataSyncManagerPrivObject *priv = static_cast<DataSyncManagerPrivObject*>(JSObjectGetPrivate(object));
if (priv) {
- LogInfo("Deleting datasync manager private object.");
+ LoggerI("Deleting datasync manager private object.");
delete priv;
JSObjectSetPrivate(object, NULL);
}
ThrowMsg(ConversionException, "Parameter conversion failed.");
}
- LogDebug("profileName: "<<profile->getProfileName());
+ LoggerD("profileName: "<<profile->getProfileName());
IEventAddProfilePtr dplEvent(new IEventAddProfile());
datasyncManager->addProfile(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Add succeeded with id: "<<dplEvent->getProfile()->getProfileId());
+ LoggerD("Add succeeded with id: "<<dplEvent->getProfile()->getProfileId());
return JSValueMakeUndefined(context);
} else {
if (ExceptionCodes::OutOfRangeException==dplEvent->getExceptionCode()) {
}
Catch(OutOfRangeException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, "QuotaExceededError", _rethrown_exception.GetMessage());
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}
ThrowMsg(ConversionException, "Parameter conversion failed.");
}
- LogDebug("profileName: "<<profile->getProfileName());
+ LoggerD("profileName: "<<profile->getProfileName());
IEventUpdateProfilePtr dplEvent(new IEventUpdateProfile());
datasyncManager->updateProfile(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Update succeeded with id: "<<dplEvent->getProfile()->getProfileId());
+ LoggerD("Update succeeded with id: "<<dplEvent->getProfile()->getProfileId());
return JSValueMakeUndefined(context);
} else {
ThrowMsg(UnknownException, "Update failed by unknown reason.");
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}
profileId = converter.toString(arguments[0]);
}
- LogDebug("profileId: "<<profileId);
+ LoggerD("profileId: "<<profileId);
IEventRemoveProfilePtr dplEvent(new IEventRemoveProfile());
datasyncManager->removeProfile(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Remove succeeded with id: "<<dplEvent->getProfileId());
+ LoggerD("Remove succeeded with id: "<<dplEvent->getProfileId());
return JSValueMakeUndefined(context);
} else {
if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) {
}
Catch (NotFoundException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}
datasyncManager->getMaxProfilesNum(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Max number of profiles: "<<dplEvent->getNumMaxProfiles());
+ LoggerD("Max number of profiles: "<<dplEvent->getNumMaxProfiles());
return converter.toJSValueRef(dplEvent->getNumMaxProfiles());
} else {
ThrowMsg(UnknownException, "Get the max number of profiles failed by unknown reason.");
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}
datasyncManager->getProfilesNum(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Number of profiles: "<<dplEvent->getNumProfiles());
+ LoggerD("Number of profiles: "<<dplEvent->getNumProfiles());
return converter.toJSValueRef(dplEvent->getNumProfiles());
} else {
ThrowMsg(UnknownException, "Get the number of profiles failed by unknown reason.");
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}
profileId = converter.toString(arguments[0]);
}
- LogDebug("profileId: "<<profileId);
+ LoggerD("profileId: "<<profileId);
IEventGetProfilePtr dplEvent(new IEventGetProfile());
datasyncManager->getProfile(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Get succeeded with id: "<<dplEvent->getProfileId());
+ LoggerD("Get succeeded with id: "<<dplEvent->getProfileId());
return JSSyncProfileInfo::createJSSyncProfileInfo(context, dplEvent->getProfile());
} else {
if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) {
}
Catch (NotFoundException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}
datasyncManager->getAllProfiles(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Getting all profiles succeeded with length: "<<dplEvent->getProfiles()->size());
+ LoggerD("Getting all profiles succeeded with length: "<<dplEvent->getProfiles()->size());
return converter.toJSValueRefProfileInfoList(dplEvent->getProfiles());
} else {
ThrowMsg(UnknownException, "Getting all profiles failed by unknown reason.");
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}
if (argumentCount>=1) {
profileId = converter.toString(arguments[0]);
}
- LogDebug("profileId: "<<profileId);
+ LoggerD("profileId: "<<profileId);
IEventStartSyncPtr dplEvent(new IEventStartSync());
if (argumentCount>=2) {
- LogDebug("Process the listener callback.");
+ LoggerD("Process the listener callback.");
if (JSValueIsObject(context, arguments[1])) {
- LogDebug("Non-null callbacks.");
+ LoggerD("Non-null callbacks.");
JSObjectRef objectCallbacks = converter.toJSObjectRef(arguments[1]);
JSCallbackManagerPtr onProgressCbm(NULL), onCompletedCbm(NULL), onStoppedCbm(NULL), onFailedCbm(NULL);
emitter->setListener(&DataSyncResponseDispatcher::getInstance());
emitter->setEventPrivateData(DPL::StaticPointerCast<IEventPrivateData>(privData));
- LogDebug("Set the emitter.");
+ LoggerD("Set the emitter.");
dplEvent->setEmitter(emitter);
} else if (JSValueIsNull(context, arguments[1]) || JSValueIsUndefined(context, arguments[1]) ) {
- LogDebug("Null or undefined listener.");
+ LoggerD("Null or undefined listener.");
} else {
ThrowMsg(ConversionException, "Wrong second parameter type.");
}
}
- LogDebug("Proceed the start sync event to the platform.");
+ LoggerD("Proceed the start sync event to the platform.");
dplEvent->setProfileId(profileId);
dplEvent->setForSynchronousCall();
if (dplEvent->getResult()) {
if(dplEvent->getEmitter()) {
- LogDebug("watcherId: "<<profileId.at(4));
+ LoggerD("watcherId: "<<profileId.at(4));
DataSyncListenerCancellerPtr canceller = DataSyncListenerCancellerPtr(new DataSyncListenerCanceller(globalContext, thisObject, profileId.at(4)));
IListenerItemPtr listenerItem = DPL::StaticPointerCast<IListenerItem>(canceller);
DataSyncListenerManagerSingleton::Instance().registerListener(listenerItem, globalContext);
}
- LogDebug("Starting the sync succeeded.");
+ LoggerD("Starting the sync succeeded.");
} else {
switch (dplEvent->getExceptionCode()) {
case ExceptionCodes::NotFoundException:
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch (NotFoundException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
if (argumentCount>=1) {
profileId = converter.toString(arguments[0]);
}
- LogDebug("profileId: "<<profileId);
+ LoggerD("profileId: "<<profileId);
IEventStopSyncPtr dplEvent(new IEventStopSync());
datasyncManager->stopSync(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Stop sync succeeded.");
+ LoggerD("Stop sync succeeded.");
} else {
if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) {
ThrowMsg(NotFoundException, "Id not found.");
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch (NotFoundException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
profileId = converter.toString(arguments[0]);
}
- LogDebug("profileId: "<<profileId);
+ LoggerD("profileId: "<<profileId);
IEventGetLastSyncStatisticsPtr dplEvent(new IEventGetLastSyncStatistics());
datasyncManager->getLastSyncStatistics(dplEvent);
if (dplEvent->getResult()) {
- LogDebug("Get sync statistics succeeded with length: "<<dplEvent->getSyncStatistics()->size());
+ LoggerD("Get sync statistics succeeded with length: "<<dplEvent->getSyncStatistics()->size());
return converter.toJSValueRefSyncStatisticsList(dplEvent->getSyncStatistics());
} else {
if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) {
}
Catch (NotFoundException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage());
}
Catch(UnsupportedException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
}
Catch(InvalidArgumentException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
}
Catch(ConversionException)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
}
Catch(Exception)
{
- LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+ LoggerW("Exception: "<<_rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
}
}