Add datacontrol.consumer privilege to DataControl
[platform/framework/native/appfw.git] / src / app / FApp_AppImpl.cpp
index a6179bf..e41f92a 100644 (file)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
@@ -25,6 +24,7 @@
 #include <notification/notification.h>
 #include <appsvc/appsvc.h>
 #include <vconf.h>
+#include <appinfo.h>
 
 #include <FBaseInteger.h>
 #include <FBaseColArrayList.h>
@@ -39,8 +39,9 @@
 #include <FAppIAppControlProviderEventListener.h>
 #include <FAppIAppLaunchConditionEventListener.h>
 #include <FIoFile.h>
-
 #include <FBaseSysLog.h>
+
+#include <FBase_StringConverter.h>
 #include <FIo_RegistryImpl.h>
 #include <FSys_EnvironmentImpl.h>
 #include <FSys_PowerManagerImpl.h>
@@ -55,6 +56,7 @@
 #include "FApp_AppArg.h"
 #include "FApp_IAppImpl.h"
 #include "FApp_AppResourceImpl.h"
+#include <FSys_SettingInfoImpl.h>
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -68,6 +70,7 @@ namespace
 const int HEARTBEAT_WAIT_COUNT = 3;
 const wchar_t SERVICE_APPID[] = L"aospd00043.osp-app-service";
 const char SELECTOR_RESPONSE_KEY[] = "__APP_SVC_START_INFO__";
+const wchar_t FILE_SCHEME_WITH_DELIMITER[] = L"file://";
 #ifndef VCONFKEY_APPSERVICE_STATUS
 #define VCONFKEY_APPSERVICE_STATUS  "memory/appservice/status"
 #endif
@@ -79,16 +82,22 @@ namespace Tizen { namespace App
 
 _AppImpl* _AppImpl::__pAppImpl = null;
 bool _AppImpl::__isTerminationRequested = false;
+
+static const char TIZEN_APPCONTROL_DATA_MULTI_WINDOW[] = "http://tizen.org/appcontrol/data/multiwindow";
+
+#if 0
 static const int _DATACONTROL_PACKET_INDEX_APPID = 0;
 static const int _DATACONTROL_PACKET_INDEX_REQUESTTYPE = 1;
 static const int _DATACONTROL_PACKET_INDEX_REQID = 2;
 static const int _DATACONTROL_PACKET_INDEX_PROVIDERID = 3;
-static const int _DATACONTROL_PACKET_INDEX_DATAID = 4;
-static const int _DATACONTROL_PACKET_INDEX_COLUMNCOUNT = 5;
-static const int _DATACONTROL_PACKET_INDEX_DELETEWHERE = 5;
-static const int _DATACONTROL_PACKET_INDEX_COLUMNLIST = 6;
-static const int _DATACONTROL_PACKET_INDEX_INSERTMAP = 6;
-static const int _DATACONTROL_PACKET_INDEX_UPDATEMAP = 6;
+#endif
+static const int _DATACONTROL_PACKET_INDEX_DATAID = 0;
+static const int _DATACONTROL_PACKET_INDEX_COLUMNCOUNT = 1;
+static const int _DATACONTROL_PACKET_INDEX_DELETEWHERE = 1;
+static const int _DATACONTROL_PACKET_INDEX_MAPKEY = 1;
+static const int _DATACONTROL_PACKET_INDEX_COLUMNLIST = 2;
+static const int _DATACONTROL_PACKET_INDEX_INSERTMAP = 2;
+static const int _DATACONTROL_PACKET_INDEX_UPDATEMAP = 2;
 
 struct charDeleter
 {
@@ -132,18 +141,20 @@ _AppImpl::Construct(const IList* pArgs)
 
        _AppInfo::SetAppState(INITIALIZING);
 
+       r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
+       SysTryLog(NID_APP, !IsFailed(r), "[%s] failed to add setting event listener.", GetErrorMessage(r));
+
        return E_SUCCESS;
 }
 
-
 result
 _AppImpl::Execute(_IAppImpl* pIAppImpl)
 {
        SysLogTag(NID_APP, "LAUNCH","[%ls:<Initialize Application>:start]", _AppInfo::GetAppExecutableName().GetPointer());
        result r = E_SUCCESS;
        int eflResult = APP_ERROR_NONE;
-       int argc = _AppInfo::GetArgc();
-       char** pArgv = _AppInfo::GetArgv();
+       int argc = 0;
+       char** pArgv = NULL;
        _IAppManager* pAppManager = null;
 
        _AppImpl* pAppImpl = _AppImpl::GetInstance();
@@ -156,10 +167,6 @@ _AppImpl::Execute(_IAppImpl* pIAppImpl)
                pAppImpl->SetLegacyRequestHandler();
        }
 
-       // clear previous notification
-       // [INFO] behavior change : platform does not clear previous notification
-       notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
-
        app_event_callback_s state_handler;
        memset(&state_handler, 0, sizeof(app_event_callback_s));
 
@@ -168,12 +175,12 @@ _AppImpl::Execute(_IAppImpl* pIAppImpl)
        state_handler.terminate = &OnTerminate;
        state_handler.pause = &OnPause;
        state_handler.resume = &OnResume;
-       state_handler.device_orientation = &OnDeviceOrientationChanged;
+       state_handler.device_orientation = NULL;
 
        state_handler.low_memory = &OnLowMemory;
-       state_handler.low_battery = &OnLowBattery;
-       state_handler.language_changed = &OnLanguageChanged;
-       state_handler.region_format_changed = &OnRegionFormatChanged;
+       state_handler.low_battery = NULL;
+       state_handler.language_changed = NULL;
+       state_handler.region_format_changed = NULL;
 
        _Aul::SetPowerOffNotiListener(OnPowerOffNotiReceived, this);
 //     if (pAppManager != null)
@@ -182,14 +189,10 @@ _AppImpl::Execute(_IAppImpl* pIAppImpl)
 //             SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Application registration failed.", GetErrorMessage(r));
 //     }
 
+       appinfo_get_argv(&argc, &pArgv);
        eflResult = app_efl_main(&argc, &pArgv, &state_handler, this);
-
        SysTryLog(NID_APP, eflResult == APP_ERROR_NONE, "app_efl_main failed with error (%d): Unknown", eflResult);
 
-       // clear outstanding ongoing notification
-       notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING);
-
-//CATCH:
        pAppManager = _AppManagerProxy::GetService();
 
        if (pAppManager != null)
@@ -197,6 +200,9 @@ _AppImpl::Execute(_IAppImpl* pIAppImpl)
                pAppManager->UnregisterApplication(_AppInfo::GetProcessId());
        }
 
+       // clear outstanding ongoing notification
+       notification_delete_all_by_type(appinfo_get_appid(), NOTIFICATION_TYPE_ONGOING);
+
        return r;
 }
 
@@ -237,7 +243,7 @@ _AppImpl::OnCreate(void* user_data)
 
        if (pAppManager != null)
        {
-               result r = pAppManager->RegisterApplication(_AppInfo::GetPackageId(), _AppInfo::GetAppExecutableName(), static_cast<_AppType>(_AppInfo::GetAppType()), _AppInfo::GetProcessId());
+               result r = pAppManager->RegisterApplication(_AppInfo::GetApplicationId(), static_cast<_AppType>(_AppInfo::GetAppType()), _AppInfo::GetProcessId());
                SysTryLog(NID_APP, !IsFailed(r), "[%s] Application registration failed.", GetErrorMessage(r));
        }
        SysLogTag(NID_APP, "LAUNCH","[%ls:<RegisterApplication>:done]", _AppInfo::GetAppExecutableName().GetPointer());
@@ -301,9 +307,22 @@ _AppImpl::OnService(service_s* service, void* user_data)
                service_get_window(service, &winId);
                if (winId > 0)
                {
-                       _AppInfo::GetAppInfo()->SetParentWindowHandle(winId);
+                       _AppInfo::SetParentWindowHandle(winId);
                        SysLog(NID_APP, "Saving window handle 0x%x.", winId);
                }
+
+               // set an appinfo value for multi-window mode
+               char* pBuf = null;
+               int errVal = service_get_extra_data(service, TIZEN_APPCONTROL_DATA_MULTI_WINDOW, &pBuf);
+               if (errVal == SERVICE_ERROR_NONE)
+               {
+                       if (!strcmp(pBuf, "on"))
+                       {
+                               _AppInfo::SetMultiWindow(true);
+                       }
+                       free(pBuf);
+               }
+
                // call for callbacks
                // ptr to member function
                SysLogTag(NID_APP, "LAUNCH","[%ls:<RequestHandler and OnAppInitialized>:start]", _AppInfo::GetAppExecutableName().GetPointer());
@@ -369,6 +388,9 @@ _AppImpl::OnTerminate(void* user_data)
        SysTryReturnVoidResult(NID_APP, pAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
        SysTryReturnVoidResult(NID_APP, pAppImpl->__pIAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
 
+       result r = _SettingInfoImpl::RemoveSettingEventListenerForInternal(*pAppImpl);
+       SysTryLog(NID_APP, !IsFailed(r), "[%s] failed to remove setting event listener.", GetErrorMessage(r));
+
        __isTerminationRequested = true;
        pAppImpl->__pIAppImpl->OnTerminate();
 }
@@ -403,20 +425,6 @@ _AppImpl::OnPause(void* user_data)
 }
 
 
-void
-_AppImpl::OnDeviceOrientationChanged(app_device_orientation_e orientation, void* user_data)
-{
-       _AppImpl* pAppImpl = _AppImpl::GetInstance();
-       SysTryReturnVoidResult(NID_APP, pAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
-       SysTryReturnVoidResult(NID_APP, pAppImpl->__pIAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
-
-       const AppState state = _AppInfo::GetAppState();
-       SysTryReturnVoidResult(NID_APP, state == INITIALIZING || state == RUNNING, E_INVALID_STATE, "[E_INVALID_STATE] Invalid application state : %d.", state);
-
-       pAppImpl->__pIAppImpl->OnDeviceOrientationChanged(orientation);
-}
-
-
 _AppImpl::~_AppImpl(void)
 {
        __pAppImpl = null;
@@ -454,7 +462,7 @@ _AppImpl::GetAppArgumentListN(void) const
                SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
                String* pData = new (std::nothrow) String(LEGACY_LAUNCH_REASON_NORMAL);
                SysTryReturn(NID_APP, pData != null, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
-               String* pData2 = new (std::nothrow) String(L"osp.operation.MAIN");
+               String* pData2 = new (std::nothrow) String(LEGACY_OPERATION_MAIN);
                SysTryReturn(NID_APP, pData2 != null, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
 
                pList->Construct();
@@ -471,6 +479,8 @@ _AppImpl::Terminate(void)
 {
        result r = E_SUCCESS;
 
+       SysLog(NID_APP, "Terminate() is called by application itself");
+
        __isTerminationRequested = true;
 
        app_efl_exit();
@@ -501,7 +511,11 @@ _AppImpl::RegisterAppRequest(service_s* service, int& req, _AppHandler& handler)
        SysTryReturnResult(NID_APP, pManager != null, E_SYSTEM, "Wrong system state.");
 
        result r = pManager->RegisterRequest(service, req, handler);
-       SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+       if (IsFailed(r))
+       {
+               SysPropagate(NID_APP, r);
+               return r;
+       }
 
        int providerType = _AppInfo::GetAppHandlerType();
        providerType |= (_APP_HANDLER_LAUNCH_NORMAL | _APP_HANDLER_LAUNCH_COND);
@@ -527,7 +541,7 @@ _AppImpl::HandleAppRequest(service_s* service, int req, _AppHandler handler)
 
                OnDataControlRequestReceived(*pArg, static_cast< RequestId >(req));
 
-               _AppControlManager::GetInstance()->RemoveResultRequest(req);
+               //_AppControlManager::GetInstance()->RemoveResultRequest(req);
                break;
 
        case _APP_HANDLER_LAUNCH_COND:
@@ -559,7 +573,7 @@ _AppImpl::HandleLegacyAppRequest(service_s* service, int req, _AppHandler handle
        {
        case _APP_HANDLER_LAUNCH_NORMAL:
                SysLog(NID_APP, "Handling normal launch request");
-               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req));
+               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req), true);
 
                // [TODO] request handle memory cleanup confirm
                _AppControlManager::GetInstance()->RemoveResultRequest(req);
@@ -568,7 +582,7 @@ _AppImpl::HandleLegacyAppRequest(service_s* service, int req, _AppHandler handle
        case _APP_HANDLER_LAUNCH_COND:
                SysLog(NID_APP, "Handling conditional launch request");
 
-               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req));
+               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req), true);
 
                // [TODO] request handle memory cleanup confirm
                _AppControlManager::GetInstance()->RemoveResultRequest(req);
@@ -619,12 +633,6 @@ _AppImpl::OnLowMemory(void* user_data)
 
 
 void
-_AppImpl::OnLowBattery(void* user_data)
-{
-       // Osp doesn't implement this callback.
-}
-
-void
 _AppImpl::OnBatteryLevelChanged(BatteryLevel batteryLevel)
 {
        SysTryReturnVoidResult(NID_APP, __pApp != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting internal instance failed.");
@@ -632,27 +640,10 @@ _AppImpl::OnBatteryLevelChanged(BatteryLevel batteryLevel)
        __pApp->OnBatteryLevelChanged(batteryLevel);
 }
 
-void
-_AppImpl::OnLanguageChanged(void* user_data)
-{
-       SysLog(NID_APP, "");
-       _AppInfo::UpdatePackageInfo(true);
-
-       _AppResourceImpl::Reinitialize();
-       SysLog(NID_APP, "Language change done.");
-}
-
-void
-_AppImpl::OnRegionFormatChanged(void* user_data)
-{
-       // Osp doesn't implement this callback.
-}
-
-
 result
-_AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs)
+_AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs, bool isPublic)
 {
-       _AppUserEventArg* pArg = new (std::nothrow) _AppUserEventArg(requestId, pArgs);
+       _AppUserEventArg* pArg = new (std::nothrow) _AppUserEventArg(requestId, pArgs, isPublic);
        SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "User event creation failure for %d.", requestId);
 
        result r = __appUserEvent.FireAsync(*pArg);
@@ -662,11 +653,31 @@ _AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs)
 
 
 void
-_AppImpl::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
+_AppImpl::OnUserEventReceivedN(RequestId requestId, IList* pArgs, bool isPublic)
 {
        SysTryReturnVoidResult(NID_APP, __pApp != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting internal instance failed.");
 
-       __pApp->OnUserEventReceivedN(requestId, pArgs);
+       if (isPublic)
+       {
+               __pApp->OnUserEventReceivedN(requestId, pArgs);
+       }
+       else
+       {
+               switch (requestId)
+               {
+               case _APP_EVENT_TERMINATE:
+                       SysLog(NID_APP, "App terminate is requested.");
+                       Terminate();
+                       break;
+               case _APP_EVENT_RAISE:
+                       SysLog(NID_APP, "App raise is requested.");
+                       RaiseWindow();
+                       break;
+               default:
+                       SysLog(NID_APP, "Unknown event : 0x%x.", requestId);
+                       break;
+               }
+       }
 }
 
 
@@ -692,7 +703,7 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId)
                return;
        }
 
-       const String& appId = _AppInfo::GetApplicationId();
+       const char* pAppId = appinfo_get_appid();
 
        const char* p = appsvc_get_operation(arg.GetBundle());
        String operationId = (p) ? String(p) : TIZEN_OPERATION_MAIN;
@@ -701,7 +712,7 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId)
                operationId = TIZEN_OPERATION_MAIN;
        }
 
-       SysLog(NID_APP, "AppControl (%ls, %ls).", appId.GetPointer(), operationId.GetPointer());
+       SysLog(NID_APP, "AppControl (%s, %ls).", pAppId, operationId.GetPointer());
 
        String uri;
        String mime;
@@ -711,6 +722,11 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId)
        if (p)
        {
                uri = p;
+               if (uri[0] == L'/')
+               {
+                       // SLP deals with the URI as plain /opt/.../a.jpg.
+                       uri.Insert(FILE_SCHEME_WITH_DELIMITER, 0);
+               }
                pUri = &uri;
 
                SysLog(NID_APP, "Delivered uri is [%ls].", pUri->GetPointer());
@@ -727,7 +743,7 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId)
 
        pAppControlProviderEventListener->OnAppControlRequestReceived(reqId, operationId, pUri, pMime, pMap.get());
 
-       SysLog(NID_APP, "AppControl (%ls, %ls) invocation finished.", appId.GetPointer(), operationId.GetPointer());
+       SysLog(NID_APP, "AppControl (%s, %ls) invocation finished.", pAppId, operationId.GetPointer());
 }
 
 
@@ -740,11 +756,12 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
        ArrayList* pColumnList = null;
        HashMap* pInsertMap = null;
        HashMap* pUpdateMap = null;
-       String* pAppId = null;
-       String* pRequestType = null;
-       String* pProviderId = null;
+       String appId;
+       String reqType;
+       String providerId;
+       String version;
        String* pDataId = null;
-       String* pReqId = null;
+       String callerReqId;
        String* pColumnCount = null;
        String* pColumn = null;
        String* pValue = null;
@@ -753,14 +770,8 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
        String* pErrorMsg = null;
        String* pNo = null;
        String* pCount = null;
+       String* pTmpPath = null;
        String empty(L"NULL");
-#if 0
-       _DataControlResultSetImpl* pResultSetImpl = null;
-       String* pResult = null;
-       String* pObject = null;
-       String* pTempObject = null;
-       String* pTempFilePath = null;
-#endif
        _AppArg resultArg;
        int type = 0;
        _DataControlRequestType requestType = _DATACONTROL_REQUEST_TYPE_UNDEFINED;
@@ -769,41 +780,32 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
        int countPerPage = 0;
        int i = 0;
        int index = 0;
-       //ArrayList* pResultArgList = null;
        result r = E_SUCCESS;
        result res = E_SUCCESS;
        ArrayList* pList = null;
        String* pKey = null;
        String* pNewValue = null;
        String* pOldValue = null;
-#if 0
-       String* pResultCount = null;
-       String* pResultValue = null;
-#endif
-
-       SysLog(NID_APP, "[DC_PROVIDER] Data control request is received.");
-       //arg.Print();
 
-       pList = arg.GetArgListN(0);
-       SysTryCatch(NID_APP, pList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+       SysLog(NID_APP, "[DC_PROV_RECV] Data control request is received.");
+       //arg.Print(); // request info
 
-       // key-based
-       pAppId = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_APPID)); // key(0)
-       SysTryCatch(NID_APP, pAppId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+       // key-based request
+       appId = arg.GetCallerAppId();
 
-       pRequestType = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_REQUESTTYPE)); // key(1)
-       SysTryCatch(NID_APP, pRequestType, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
-       Integer::Parse(*pRequestType, type);
+       reqType = arg.GetValue(OSP_K_DATACONTROL_REQUEST_TYPE);
+       Integer::Parse(reqType, type);
        requestType = static_cast< _DataControlRequestType >(type);
 
-       pReqId = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_REQID)); // key(2)
-       SysTryCatch(NID_APP, pReqId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+       version = arg.GetValue(OSP_K_DATACONTROL_PROTOCOL_VERSION);
+       callerReqId = arg.GetValue(OSP_K_REQUEST_ID);
+       providerId = arg.GetValue(OSP_K_DATACONTROL_PROVIDER);
 
-       pProviderId = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_PROVIDERID)); // key(3)
-       SysTryCatch(NID_APP, pProviderId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+       // list-based request
+       pList = _AppArg::GetListN(arg.GetBundle(), OSP_K_ARG);
+       SysTryCatch(NID_APP, pList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
 
-       // list-based
-       pDataId = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_DATAID));// list(0): data ID
+       pDataId = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_DATAID));// request list[0]: data ID
        SysTryCatch(NID_APP, pDataId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
        if (requestType >= _DATACONTROL_REQUEST_TYPE_SQL_QUERY && requestType <= _DATACONTROL_REQUEST_TYPE_SQL_DELETE)
@@ -813,7 +815,7 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
        }
        else if (requestType >= _DATACONTROL_REQUEST_TYPE_MAP_QUERY && requestType <= _DATACONTROL_REQUEST_TYPE_MAP_DELETE)
        {
-               pKey = dynamic_cast< String* >(pList->GetAt(5)); // list[1]
+               pKey = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_MAPKEY)); // request list[1]
                SysTryCatch(NID_APP, pKey, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
                pMapListener = __pMapDataControlProviderEventListener;
@@ -828,9 +830,9 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
        switch (requestType)
        {
        case _DATACONTROL_REQUEST_TYPE_SQL_QUERY:
-               SysLog(NID_APP, "[DC_PROVIDER] SqlDataControl SELECT");
+               SysLog(NID_APP, "[DC_PROV_RECV] SqlDataControl SELECT");
 
-               // list(1): selected column count
+               // request list[1]: selected column count
                pColumnCount = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_COLUMNCOUNT));
                SysTryCatch(NID_APP, pColumnCount, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
@@ -844,22 +846,22 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
                        pColumnList = new (std::nothrow) ArrayList();
                        SysTryReturnVoidResult(NID_APP, pColumnList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
                        pColumnList->Construct();
-                       SysLog(NID_APP, "[DC_PROVIDER] selected column count: %d", columnCount);
+                       SysLog(NID_APP, "[DC_PROV_RECV] selected column count: %d", columnCount);
 
                        i = 0;
-                       while (i < columnCount) // list(2): column list
+                       while (i < columnCount) // request list[2]: column list
                        {
                                pColumn = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_COLUMNLIST + i));
                                SysTryCatch(NID_APP, pColumn != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
                                pColumnList->Add(*(new String(*pColumn)));
-                               SysLog(NID_APP, "[DC_PROVIDER] column[%d]: %ls", i, pColumn->GetPointer());
+                               SysLog(NID_APP, "[DC_PROV_RECV] column[%d]: %ls", i, pColumn->GetPointer());
                                i++;
                        }
                }
 
                i += _DATACONTROL_PACKET_INDEX_COLUMNLIST;
-               pWhere = dynamic_cast< String* >(pList->GetAt(i)); // list(3): where clause
+               pWhere = dynamic_cast< String* >(pList->GetAt(i)); // request list: where clause
                SysTryCatch(NID_APP, pWhere, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
                if (pWhere->Equals(empty) == true)
@@ -868,11 +870,11 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
                }
                else
                {
-                       SysLog(NID_APP, "[DC_PROVIDER] pWhere: %ls", pWhere->GetPointer());
+                       SysLog(NID_APP, "[DC_PROV_RECV] pWhere: %ls", pWhere->GetPointer());
                }
 
                i++;
-               pOrder = dynamic_cast< String* >(pList->GetAt(i)); // list(4): order clause
+               pOrder = dynamic_cast< String* >(pList->GetAt(i)); // request list: order clause
                SysTryCatch(NID_APP, pOrder, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
                if (pOrder->Equals(empty) == true)
@@ -881,95 +883,203 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
                }
                else
                {
-                       SysLog(NID_APP, "[DC_PROVIDER] pOrder: %ls", pOrder->GetPointer());
+                       SysLog(NID_APP, "[DC_PROV_RECV] pOrder: %ls", pOrder->GetPointer());
                }
 
                i++;
-               pNo = dynamic_cast <String*>(pList->GetAt(i)); // list(5): page number
+               pNo = dynamic_cast <String*>(pList->GetAt(i)); // request list: page number
                SysTryCatch(NID_APP, pNo, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
                Integer::Parse(*pNo, pageNo);
 
                i++;
-               pCount = dynamic_cast <String*>(pList->GetAt(i)); // list(6): count per page
+               pCount = dynamic_cast <String*>(pList->GetAt(i)); // request list: count per page
                SysTryCatch(NID_APP, pCount, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
                Integer::Parse(*pCount, countPerPage);
 
-               pSqlListener->OnSqlDataControlSelectRequestReceived(reqId, *pProviderId, *pDataId, pColumnList,
+               pSqlListener->OnSqlDataControlSelectRequestReceived(reqId, providerId, *pDataId, pColumnList,
                                pWhere, pOrder);
 
-               SysLog(NID_APP, "[DC_PROVIDER] caller appId: %ls, requestType: %d, reqId: %ls, providerId: %ls, dataId: %ls, pColumnList: 0x%0x, pWhere: 0x%x, pOrder: 0x%x, pageNo: %d, countPerPage: %d",
-                               pAppId->GetPointer(), requestType, pReqId->GetPointer(), pProviderId->GetPointer(),
+               SysSecureLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, pColumnList: 0x%0x, pWhere: 0x%x, pOrder: 0x%x, pageNo: %d, countPerPage: %d",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
                                pDataId->GetPointer(), pColumnList, pWhere, pOrder, pageNo, countPerPage);
                break;
        case _DATACONTROL_REQUEST_TYPE_SQL_INSERT:
-               SysLog(NID_APP, "[DC_PROVIDER] SqlDataControl INSERT");
+               SysLog(NID_APP, "[DC_PROV_RECV] SqlDataControl INSERT");
 
-               // list(1): insert column count
+               // request list[1]: inserted column count
                pColumnCount = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_COLUMNCOUNT));
                SysTryCatch(NID_APP, pColumnCount, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
                Integer::Parse(*pColumnCount, columnCount);
-               SysLog(NID_APP, "[DC_PROVIDER] inserted column count: %d", columnCount);
+               SysLog(NID_APP, "[DC_PROV_RECV] inserted column count: %d", columnCount);
 
                pInsertMap = new (std::nothrow) HashMap();
                SysTryReturnVoidResult(NID_APP, pInsertMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
                pInsertMap->Construct();
 
-               i = 0;
-               index = 0;
-               while (i < columnCount * 2) // list(2): column-value pairs
+               SysLog(NID_APP, "[DC_PROV_RECV] version: %ls", version.GetPointer());
+               if (version == L"ver_2.1.0.2" || version == L"ver_2.1.0.3")
                {
-                       pColumn = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_INSERTMAP + i++));
-                       SysTryCatch(NID_APP, pColumn != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
-                       SysLog(NID_APP, "[DC_PROVIDER] column[%d]: %ls", index, pColumn->GetPointer());
+                       pTmpPath = dynamic_cast< String* >(pList->GetAt(2)); // request list[2]: path
+                       SysTryCatch(NID_APP, pTmpPath != null, , E_SYSTEM, "[E_SYSTEM] invalid request");
+                       SysLog(NID_APP, "[DC_PROV_RECV] request: %ls", pTmpPath->GetPointer());
 
-                       pValue = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_INSERTMAP + i++));
-                       SysTryCatch(NID_APP, pValue != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
-                       SysLog(NID_APP, "[DC_PROVIDER] value[%d]: %ls", index, pValue->GetPointer());
+                       File request;
+                       r = request.Construct(*pTmpPath, "r");
+                       SysTryCatch(NID_APP, !IsFailed(r), , E_SYSTEM, "[%s] Failed to open request (%ls).",
+                                       GetErrorMessage(r), pTmpPath->GetPointer());
 
-                       pInsertMap->Add(*(new String(*pColumn)), *(new String(*pValue)));
-                       index++;
+                       for (i = 0; i < columnCount; ++i) // column-value pairs
+                       {
+                               int length = -1;
+                               int ret = request.Read(&length, sizeof(int));
+                               SysTryCatch(NID_APP, ret > 0, , E_SYSTEM, "[%s] Failed to receive request.",
+                                               GetErrorMessage(GetLastResult()));
+
+                               char* pColumn = new (std::nothrow) char[length + 1];
+                               ret = request.Read(pColumn, length);
+                               SysTryCatch(NID_APP, ret > 0, delete pColumn, E_SYSTEM, "[%s] Failed to receive request.",
+                                               GetErrorMessage(GetLastResult()));
+                               pColumn[length] = '\0';
+                               SysLog(NID_APP, "[DC_PROV_RECV] column[%d]: %s", i, pColumn);
+
+                               ret = request.Read(&length, sizeof(int));
+                               SysTryCatch(NID_APP, ret > 0, delete pColumn, E_SYSTEM, "[%s] Failed to receive request.",
+                                               GetErrorMessage(GetLastResult()));
+
+                               char* pValue = new (std::nothrow) char[length + 1];
+                               ret = request.Read(pValue, length);
+                               if (ret == 0)
+                               {
+                                       SysLogException(NID_APP, E_SYSTEM, "[%s] Failed to receive request.", GetErrorMessage(GetLastResult()));
+                                       delete pColumn;
+                                       delete pValue;
+                               }
+                               pValue[length] = '\0';
+                               SysLog(NID_APP, "[DC_PROV_RECV] value[%d]: %s", i, pValue);
+
+                               pInsertMap->Add(new (std::nothrow) String(pColumn), new (std::nothrow) String(pValue));
+                               delete pColumn;
+                               delete pValue;
+                       }
+               }
+               else
+               {
+                       i = 0;
+                       index = 0;
+                       while (i < columnCount * 2) // request list: column-value pairs
+                       {
+                               pColumn = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_INSERTMAP + i++));
+                               SysTryCatch(NID_APP, pColumn != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+                               SysLog(NID_APP, "[DC_PROV_RECV] column[%d]: %ls", index, pColumn->GetPointer());
+
+                               pValue = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_INSERTMAP + i++));
+                               SysTryCatch(NID_APP, pValue != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+                               SysLog(NID_APP, "[DC_PROV_RECV] value[%d]: %ls", index, pValue->GetPointer());
+
+                               pInsertMap->Add(new (std::nothrow) String(*pColumn), new (std::nothrow) String(*pValue));
+                               index++;
+                       }
+               }
+
+               if (pTmpPath)
+               {
+                       r = File::Remove(*pTmpPath);
+                       SysTryLog(NID_APP, !IsFailed(r), "Failed to remove result: %ls", pTmpPath->GetPointer());
                }
 
-               pSqlListener->OnSqlDataControlInsertRequestReceived(reqId, *pProviderId, *pDataId, *pInsertMap);
+               pSqlListener->OnSqlDataControlInsertRequestReceived(reqId, providerId, *pDataId, *pInsertMap);
 
-               SysLog(NID_APP, "[DC_PROVIDER] caller appId: %ls, requestType: %d, reqId: %ls, providerId: %ls, dataId: %ls, pInsertMap: 0x%x",
-                               pAppId->GetPointer(), requestType, pReqId->GetPointer(), pProviderId->GetPointer(),
+               SysLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, pInsertMap: 0x%x",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
                                pDataId->GetPointer(), pInsertMap);
                break;
        case _DATACONTROL_REQUEST_TYPE_SQL_UPDATE:
-               SysLog(NID_APP, "[DC_PROVIDER] SqlDataControl UPDATE");
+               SysLog(NID_APP, "[DC_PROV_RECV] SqlDataControl UPDATE");
 
-               // list(1): updated column count
+               // request list[1]: updated column count
                pColumnCount = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_COLUMNCOUNT));
                SysTryCatch(NID_APP, pColumnCount, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
                Integer::Parse(*pColumnCount, columnCount);
-               SysLog(NID_APP, "[DC_PROVIDER] updated column count: %d", columnCount);
+               SysLog(NID_APP, "[DC_PROV_RECV] updated column count: %d", columnCount);
 
                pUpdateMap = new (std::nothrow) HashMap();
                SysTryReturnVoidResult(NID_APP, pUpdateMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
                pUpdateMap->Construct();
 
-               i = 0;
-               index = 0;
-               while (i < columnCount * 2) // list(2): column-value pairs
+               SysLog(NID_APP, "[DC_PROV_RECV] version: %ls", version.GetPointer());
+               if (version == L"ver_2.1.0.2" || version == L"ver_2.1.0.3")
                {
-                       pColumn = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_UPDATEMAP + i++));
-                       SysTryCatch(NID_APP, pColumn != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
-                       SysLog(NID_APP, "[DC_PROVIDER] column[%d]: %ls", index, pColumn->GetPointer());
+                       pTmpPath = dynamic_cast< String* >(pList->GetAt(2)); // request list[2]: path
+                       SysTryCatch(NID_APP, pTmpPath != null, , E_SYSTEM, "[E_SYSTEM] invalid request");
+                       SysLog(NID_APP, "[DC_PROV_RECV] request: %ls", pTmpPath->GetPointer());
 
-                       pValue = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_UPDATEMAP + i++));
-                       SysTryCatch(NID_APP, pValue != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
-                       SysLog(NID_APP, "[DC_PROVIDER] value[%d]: %ls", index, pValue->GetPointer());
+                       File request;
+                       r = request.Construct(*pTmpPath, "r");
+                       SysTryCatch(NID_APP, !IsFailed(r), , E_SYSTEM, "[%s] Failed to open request (%ls).",
+                                       GetErrorMessage(r), pTmpPath->GetPointer());
 
-                       pUpdateMap->Add(*(new String(*pColumn)), *(new String(*pValue)));
-                       index++;
+                       for (i = 0; i < columnCount; ++i) // column-value pairs
+                       {
+                               int length = -1;
+                               int ret = request.Read(&length, sizeof(int));
+                               SysTryCatch(NID_APP, ret > 0, , E_SYSTEM, "[%s] Failed to receive request.",
+                                               GetErrorMessage(GetLastResult()));
+
+                               char* pColumn = new (std::nothrow) char[length + 1];
+                               ret = request.Read(pColumn, length);
+                               SysTryCatch(NID_APP, ret > 0, delete pColumn, E_SYSTEM, "[%s] Failed to receive request.",
+                                               GetErrorMessage(GetLastResult()));
+                               pColumn[length] = '\0';
+                               SysLog(NID_APP, "[DC_PROV_RECV] column[%d]: %s", i, pColumn);
+
+                               ret = request.Read(&length, sizeof(int));
+                               SysTryCatch(NID_APP, ret > 0, delete pColumn, E_SYSTEM, "[%s] Failed to receive request.",
+                                               GetErrorMessage(GetLastResult()));
+
+                               char* pValue = new (std::nothrow) char[length + 1];
+                               ret = request.Read(pValue, length);
+                               if (ret == 0)
+                               {
+                                       SysLogException(NID_APP, E_SYSTEM, "[%s] Failed to receive request.", GetErrorMessage(GetLastResult()));
+                                       delete pColumn;
+                                       delete pValue;
+                               }
+                               pValue[length] = '\0';
+                               SysLog(NID_APP, "[DC_PROV_RECV] value[%d]: %s", i, pValue);
+
+                               pUpdateMap->Add(new (std::nothrow) String(pColumn), new (std::nothrow) String(pValue));
+                               delete pColumn;
+                               delete pValue;
+                       }
+
+                       // request list: where clause
+                       pWhere = dynamic_cast< String* >(pList->GetAt(3));
+                       SysTryCatch(NID_APP, pWhere != null, , E_SYSTEM, "[E_SYSTEM] invalid request");
                }
+               else
+               {
+                       i = 0;
+                       index = 0;
+                       while (i < columnCount * 2) // request list: column-value pairs
+                       {
+                               pColumn = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_UPDATEMAP + i++));
+                               SysTryCatch(NID_APP, pColumn != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+                               SysLog(NID_APP, "[DC_PROV_RECV] column[%d]: %ls", index, pColumn->GetPointer());
 
-               // list(3): where clause
-               pWhere = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_UPDATEMAP + i));
-               SysTryCatch(NID_APP, pWhere, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+                               pValue = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_UPDATEMAP + i++));
+                               SysTryCatch(NID_APP, pValue != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+                               SysLog(NID_APP, "[DC_PROV_RECV] value[%d]: %ls", index, pValue->GetPointer());
+
+                               pUpdateMap->Add(new (std::nothrow) String(*pColumn), new (std::nothrow) String(*pValue));
+                               index++;
+                       }
+
+                       // request list: where clause
+                       pWhere = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_UPDATEMAP + i));
+                       SysTryCatch(NID_APP, pWhere, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
+               }
 
                if (pWhere->Equals(empty) == true)
                {
@@ -977,19 +1087,25 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
                }
                else
                {
-                       SysLog(NID_APP, "[DC_PROVIDER] pWhere: %ls", pWhere->GetPointer());
+                       SysLog(NID_APP, "[DC_PROV_RECV] pWhere: %ls", pWhere->GetPointer());
+               }
+
+               if (pTmpPath)
+               {
+                       r = File::Remove(*pTmpPath);
+                       SysTryLog(NID_APP, !IsFailed(r), "Failed to remove result: %ls", pTmpPath->GetPointer());
                }
 
-               pSqlListener->OnSqlDataControlUpdateRequestReceived(reqId, *pProviderId, *pDataId, *pUpdateMap, pWhere);
+               pSqlListener->OnSqlDataControlUpdateRequestReceived(reqId, providerId, *pDataId, *pUpdateMap, pWhere);
 
-               SysLog(NID_APP, "[DC_PROVIDER] caller appId: %ls, requestType: %d, reqId: %ls, providerId: %ls, dataId: %ls, pUpdateMap: 0x%x, pWhere: 0x%x",
-                               pAppId->GetPointer(), requestType, pReqId->GetPointer(), pProviderId->GetPointer(),
+               SysLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, pUpdateMap: 0x%x, pWhere: 0x%x",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
                                pDataId->GetPointer(), pUpdateMap, pWhere);
                break;
        case _DATACONTROL_REQUEST_TYPE_SQL_DELETE:
-               SysLog(NID_APP, "[DC_PROVIDER] SqlDataControl DELETE");
+               SysLog(NID_APP, "[DC_PROV_RECV] SqlDataControl DELETE");
 
-               // list(1): where clause
+               // request list[1]: where clause
                pWhere = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_DELETEWHERE));
                SysTryCatch(NID_APP, pWhere, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
@@ -999,59 +1115,76 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
                }
                else
                {
-                       SysLog(NID_APP, "[DC_PROVIDER] pWhere: %ls", pWhere->GetPointer());
+                       SysLog(NID_APP, "[DC_PROV_RECV] pWhere: %ls", pWhere->GetPointer());
                }
 
-               pSqlListener->OnSqlDataControlDeleteRequestReceived(reqId, *pProviderId, *pDataId, pWhere);
+               pSqlListener->OnSqlDataControlDeleteRequestReceived(reqId, providerId, *pDataId, pWhere);
 
-               SysLog(NID_APP, "[DC_PROVIDER] caller appId: %ls, requestType: %d, reqId: %ls, providerId: %ls, dataId: %ls, pWhere: 0x%x",
-                               pAppId->GetPointer(), requestType, pReqId->GetPointer(), pProviderId->GetPointer(),
+               SysLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, pWhere: 0x%x",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
                                pDataId->GetPointer(), pWhere);
                break;
        case _DATACONTROL_REQUEST_TYPE_MAP_QUERY:
-               pNo = dynamic_cast <String*>(pList->GetAt(6)); // list[2]
+               SysLog(NID_APP, "[DC_PROV_RECV] MapDataControl GetValue");
+
+               pNo = dynamic_cast <String*>(pList->GetAt(2)); // request list[2]
                SysTryCatch(NID_APP, pNo, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
                Integer::Parse(*pNo, pageNo);
 
-               pCount = dynamic_cast <String*>(pList->GetAt(7)); //list[3]
+               pCount = dynamic_cast <String*>(pList->GetAt(3)); // request list[3]
                SysTryCatch(NID_APP, pCount, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
                Integer::Parse(*pCount, countPerPage);
 
-               pMapListener->OnMapDataControlGetValueRequestReceived(reqId, *pProviderId, *pDataId, *pKey);
+               pMapListener->OnMapDataControlGetValueRequestReceived(reqId, providerId, *pDataId, *pKey);
+
+               SysLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, key: %ls, pageNo: %d, countPerPage: %d",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
+                               pDataId->GetPointer(), pKey->GetPointer(), pageNo, countPerPage);
                break;
        case _DATACONTROL_REQUEST_TYPE_MAP_INSERT:
-               pValue = dynamic_cast <String*>(pList->GetAt(6)); // list[2]
+               SysLog(NID_APP, "[DC_PROV_RECV] MapDataControl AddValue");
+
+               pValue = dynamic_cast <String*>(pList->GetAt(2)); // request list[2]
                SysTryCatch(NID_APP, pValue, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
-               pMapListener->OnMapDataControlAddValueRequestReceived(reqId, *pProviderId, *pDataId, *pKey, *pValue);
+               pMapListener->OnMapDataControlAddValueRequestReceived(reqId, providerId, *pDataId, *pKey, *pValue);
+
+               SysLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, key: %ls, value: %ls",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
+                               pDataId->GetPointer(), pKey->GetPointer(), pValue->GetPointer());
                break;
        case _DATACONTROL_REQUEST_TYPE_MAP_UPDATE:
-               pOldValue = dynamic_cast <String*>(pList->GetAt(6)); // list[2]
+               SysLog(NID_APP, "[DC_PROV_RECV] MapDataControl SetValue");
+
+               pOldValue = dynamic_cast <String*>(pList->GetAt(2)); // request list[2]
                SysTryCatch(NID_APP, pOldValue, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
-               pNewValue = dynamic_cast <String*>(pList->GetAt(7)); // list[3]
+               pNewValue = dynamic_cast <String*>(pList->GetAt(3)); // request list[3]
                SysTryCatch(NID_APP, pNewValue, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
-               pMapListener->OnMapDataControlSetValueRequestReceived(reqId, *pProviderId, *pDataId, *pKey, *pOldValue, *pNewValue);
+               pMapListener->OnMapDataControlSetValueRequestReceived(reqId, providerId, *pDataId, *pKey, *pOldValue, *pNewValue);
+
+               SysLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, key: %ls, oldValue: %ls, newValue: %ls",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
+                               pDataId->GetPointer(), pKey->GetPointer(), pOldValue->GetPointer(), pNewValue->GetPointer());
                break;
        case _DATACONTROL_REQUEST_TYPE_MAP_DELETE:
-               pValue = dynamic_cast <String*>(pList->GetAt(6)); // list[2]
+               SysLog(NID_APP, "[DC_PROV_RECV] MapDataControl RemoveValue");
+
+               pValue = dynamic_cast <String*>(pList->GetAt(2)); // request list[2]
                SysTryCatch(NID_APP, pValue, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
 
-               pMapListener->OnMapDataControlRemoveValueRequestReceived(reqId, *pProviderId, *pDataId, *pKey, *pValue);
+               pMapListener->OnMapDataControlRemoveValueRequestReceived(reqId, providerId, *pDataId, *pKey, *pValue);
+
+               SysLog(NID_APP, "[DC_PROV_RECV] caller app: %ls, requestType: %d, caller req: %ls, provider: %ls, data: %ls, key: %ls, value: %ls",
+                               appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(),
+                               pDataId->GetPointer(), pKey->GetPointer(), pValue->GetPointer());
                break;
        default:
                SysTryCatch(NID_APP, false, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid request");
                break;
        }
 
-       if (requestType >= _DATACONTROL_REQUEST_TYPE_MAP_QUERY && requestType <= _DATACONTROL_REQUEST_TYPE_MAP_DELETE)
-       {
-               SysLog(NID_APP, "caller appId: %ls, requestType: %d, reqId: %ls, providerId: %ls, dataId: %ls, key: %ls",
-                               pAppId->GetPointer(), requestType, pReqId->GetPointer(), pProviderId->GetPointer(),
-                               pDataId->GetPointer(), pKey->GetPointer());
-       }
-
        if (pColumnList)
        {
                pColumnList->RemoveAll(true);
@@ -1073,18 +1206,6 @@ _AppImpl::OnDataControlRequestReceived(const _AppArg& arg, RequestId reqId)
        return;
 
 CATCH:
-       if (r == E_SYSTEM)
-       {
-               pErrorMsg = new (std::nothrow) String("[E_SYSTEM] A system error has occurred.");
-       }
-       else if (r == E_OUT_OF_MEMORY)
-       {
-               pErrorMsg = new (std::nothrow) String("[E_OUT_OF_MEMORY] The memory was insufficient.");
-       }
-       SysTryReturnVoidResult(NID_APP, pErrorMsg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory was insufficient.");
-
-       res = DataControlProviderManager::GetInstance()->SendDataControlError(reqId, *pErrorMsg);
-
        if (pColumnList)
        {
                pColumnList->RemoveAll(true);
@@ -1103,6 +1224,18 @@ CATCH:
                delete pUpdateMap;
        }
 
+       if (r == E_SYSTEM)
+       {
+               pErrorMsg = new (std::nothrow) String("[E_SYSTEM] A system error has occurred.");
+       }
+       else if (r == E_OUT_OF_MEMORY)
+       {
+               pErrorMsg = new (std::nothrow) String("[E_OUT_OF_MEMORY] The memory was insufficient.");
+       }
+       SysTryReturnVoidResult(NID_APP, pErrorMsg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory was insufficient.");
+
+       res = DataControlProviderManager::GetInstance()->SendDataControlError(reqId, *pErrorMsg);
+
        delete pErrorMsg;
 
        return;
@@ -1137,6 +1270,15 @@ _AppImpl::GetWindowHandle(void) const
 
 
 void
+_AppImpl::RaiseWindow(void)
+{
+       SysTryReturnVoidResult(NID_APP, __pIAppImpl != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting App instance failed.");
+
+       __pIAppImpl->OnFrameRaiseRequested();
+}
+
+
+void
 _AppImpl::OnAppCheckpoint(void)
 {
        if (__pCheckpointEventListener)
@@ -1185,11 +1327,11 @@ _AppImpl::SetListener(_AppEvent appEvent, IEventListener* pListener)
 {
        switch (appEvent)
        {
-       case AE_CHECKPOINT:
+       case _APP_EVENT_CHECKPOINT:
                SysTryReturnResult(NID_APP, __pCheckpointEventListener == null, E_OBJ_ALREADY_EXIST, "Checkpoint listener is already set.");
 
                // fall through
-       case AE_CLEAR_LISTENER:
+       case _APP_EVENT_CLEAR_LISTENER:
                __pCheckpointEventListener = dynamic_cast <IAppCheckpointEventListener*>(pListener);
                break;
 
@@ -1262,21 +1404,46 @@ _AppImpl::IsTerminationRequested(void)
        return __isTerminationRequested;
 }
 
+typedef void (*cbForVconf)(keynode_t* node, void *pData);
+
 void
-_AppImpl::OnPowerOffNotiReceived(void* user_data)
+_AppImpl::OnPowerOffNotiReceived(void* node, void* user_data)
 {
-       SysLog(NID_APP, "Application is being terminated by power off.");
+       int value = -1;
+       if (!vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &value))
+       {
+               if (value == VCONFKEY_SYSMAN_POWER_OFF_DIRECT || value == VCONFKEY_SYSMAN_POWER_OFF_RESTART)
+               {
+                       SysLog(NID_APP, "Application is being terminated by power off.");
 
-       _AppImpl* pAppImpl = _AppImpl::GetInstance();
-       if (pAppImpl != null)
+                       if (vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (cbForVconf)_AppImpl::OnPowerOffNotiReceived))
+                       {
+                               SysLog(NID_APP, "Fail to ignore vconf for key(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
+                       }
+
+                       _AppImpl* pAppImpl = _AppImpl::GetInstance();
+                       if (pAppImpl != null)
+                       {
+                               pAppImpl->__forcedTermination = true;
+                       }
+
+                       app_efl_exit();
+               }
+       }
+}
+
+void
+_AppImpl::OnSettingChanged(String& key)
+{
+       if (key == L"http://tizen.org/setting/locale.language")
        {
-               pAppImpl->__forcedTermination = true;
+               _AppInfo::UpdatePackageInfo(true);
+               _AppResourceImpl::Reinitialize();
+               SysLog(NID_APP, "Reinitialized resources due to locale change.");
        }
-       
-       app_efl_exit();
 }
 
-bool 
+bool
 _AppImpl::IsForcedTermination(void)
 {
        return __forcedTermination;