* @exception E_SUCCESS The method is successful.
* @exception E_APP_NOT_INSTALLED The expected shared directory cannot be found
* because the application specified with @c appId cannot be installed.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @remarks The returned path can be invalid when the application with specified with @c appId is uninstalled. @n
+ * The specific error code can be accessed using the GetLastResult() method.
*/
static Tizen::Base::String GetAppSharedPath(const AppId& appId);
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FAppPkgPackageLicenseManager.h
- * @brief This is the header file for the %PackageLicenseManager class.
- *
- * This header file contains the declarations of the %PackageLicenseManager class.
- */
-
-#ifndef _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
-#define _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
-
-#include <FBase.h>
-#include <FAppTypes.h>
-
-namespace Tizen { namespace App { namespace Package
-{
-
-/**
- * @class PackageLicenseManager
- * @brief This class gets the information of a package's license and manages its installation.
- *
- * @since 2.1
- *
- * @remarks Do not use this class without obtaining prior permissions from the %Tizen platform team.
- *
- * The %PackageLicenseManager class gets the information of a package's license and manages its installation.
- */
-class _OSP_EXPORT_ PackageLicenseManager
-{
-public:
-
- /**
- * Generates a license request and URL.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return An error code
- * @param[in] licenseRequestInfo The string buffer of license request information
- * @param[out] licenseRequest The string buffer of Package DRM license request
- * @param[out] licenseUrl The URL for Package DRM license
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid.
- * @exception E_INVALID_DATA A specified XML field of input string is invalid. @n
- * For example, the requested ID is invalid.
- * @exception E_PARSING_FAILED An error has occurred when parsing the input string.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static result GenerateDrmLicenseRequest(const Tizen::Base::String& licenseRequestInfo, Tizen::Base::String& licenseRequest, Tizen::Base::String& licenseUrl);
-
- /**
- * Saves a Package DRM license(right object) to a DRM repository. @n
- * It stores the DRM license (right object) when it does not exist in the DRM repository.
- * When the same @c packgeId of DRM license(right object) already exists in the DRM repository, it is overwritten.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return An error code
- * @param[in] rightObject The Package DRM license (right object)
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_DATABASE An error has occurred when handling the rights object repository.
- * @exception E_INVALID_BINDING The input right object is not binded to the device.
- * @exception E_INVALID_SIGNATURE The signature verification of the input string has failed.
- * @exception E_INVALID_CERTIFICATE The certificate chain verification of the input string has failed.
- * @exception E_INVALID_DATA A specified XML field of input string is invalid. @n
- * For example, the @c appId field is empty.
- * @exception E_PARSING_FAILED An error has occurred when parsing the input string.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static result SaveDrmLicense(const Tizen::Base::String& rightObject);
-
- /**
- * Gets the remaining time of the package until the DRM license expiration.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return The remaining time of the DRM license @n
- * If the remaining time is unlimited, the return value of Tizen::Base::TimeSpan's days will be set to @c 9999.
- * @param[in] pkgId The package ID with which to get the information of time-based constraint
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_DATABASE An error has occurred when handling the rights object repository.
- * @exception E_OBJ_NOT_FOUND The specified @c pkgId does not exist in the rights management repository.
- * @exception E_RIGHT_EXPIRED The DRM license has expired.
- * @exception E_RIGHT_UNLIMITED The DRM license is unlimited.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks The specific error code can be accessed using the GetLastResult() method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static Tizen::Base::TimeSpan GetRemainingTimeUntilDrmExpiration(const Tizen::App::PackageId& pkgId);
-
- /**
- * Saves a CEK (Contents Encryption Key) to a DRM repository. @n
- * It stores the CEK when it does not exist in the DRM repository.
- * When the same @c PackageId of CEK already exists in the DRM repository, it is overwritten.
- *
- * @since 2.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/packagelicensemanager
- *
- * @return An error code
- * @param[in] licenseInfo The CEK (Contents Encryption Key)
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_INVALID_DATA A specified XML field of input string is invalid. @n
- * For example, the @c appId field is empty.
- * @exception E_DATABASE An error has occurred when handling the rights object repository.
- * @exception E_PARSING_FAILED An error has occurred when parsing the input string.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @remarks Do not use this method without obtaining prior permissions from the %Tizen platform team.
- */
- static result SaveLicenseInfoForPackage(const Tizen::Base::String& licenseInfo);
-
-private:
- PackageLicenseManager(void);
- ~PackageLicenseManager(void);
-
- PackageLicenseManager(const PackageLicenseManager& rhs);
- PackageLicenseManager& operator = (const PackageLicenseManager);
-
-}; // PackageLicenseManager
-
-}}} // Tizen::App::Package
-
-#endif // _FAPP_PKG_PACKAGE_LICENSE_MANAGER_H_
*
* @since 2.0
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.read
+ * @privilege %http://tizen.org/privilege/settingmanager.write @n
+ * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
*
* @return An error code
* @exception E_SUCCESS Mount operation is successfully started.
*
* @since 2.0
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.read
+ * @privilege %http://tizen.org/privilege/settingmanager.write @n
+ * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
*
* @return An error code
* @exception E_SUCCESS Unmount operation is successfully started.
*
* @since 2.0
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.read
+ * @privilege %http://tizen.org/privilege/settingmanager.write @n
+ * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
*
* @return An error code
* @exception E_SUCCESS Format operation is successfully started.
*
* The %Locales namespace contains classes representing a specific cultural region (locale) and the classes for manipulating and formatting locale-sensitive information, such as dates, times, numbers, and time zones.
*
+ * Even if the list of all the available languages supported by the device is different, the localized information by the %Locales namespace should be represented properly.
+ *
* For more information on the %Locales namespace features, see <a href="../org.tizen.native.appprogramming/html/guide/locales/locales_namespace.htm">Locales Guide</a>.
*
* The following diagram illustrates the relationships between the classes belonging to the %Locales namespace.
* @privilege %http://tizen.org/privilege/alarm
*
* @return An error code
- * @param[in] duetime The time for the alarm to ring
+ * @param[in] duetime The time for the alarm to ring. @n Any value with a unit that is less than a second is ignored.
* @exception E_SUCCESS The method is successful.
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
* @exception E_INVALID_ARG The specified @c duetime is invalid.
* @exception E_SYSTEM A system error has occurred.
- * @remarks If this Alarm instance is already registered by this method, exist alarm is cancelled automatically.
+ * @remarks If this %Alarm instance is already registered by this method, existing alarm is cancelled automatically.
*/
result Set(const Tizen::Base::DateTime& duetime);
* @privilege %http://tizen.org/privilege/alarm
*
* @return An error code
- * @param[in] start The time for the alarm to ring first
- * @param[in] period The interval in minutes between consecutive alarm rings
- * @param[in] pEnd The time for the alarm ring to end
+ * @param[in] start The time for the alarm to ring first. @n Any value with a unit that is less than a second is ignored.
+ * @param[in] period The interval in minutes between consecutive alarm rings.
+ * @param[in] pEnd The time for the alarm ring to end. @n Any value with a unit that is less than a second is ignored.
* @exception E_SUCCESS The method is successful.
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
* @exception E_INVALID_ARG A specified input parameter is invalid.
* Implementation of this method in OSP compatible applications has the following issue: @n
* This AddDeviceEventListener() method does not return E_DEVICE_UNAVAILABLE anymore. The E_DEVICE_UNAVAILABLE exception is removed.
* @section DeviceManagerAddDeviceEventListenerPageIssueSection Resolutions
- * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE exception.
+ * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
* @endif
*/
* Implementation of this method in OSP compatible applications has the following issue: @n
* This RemoveDeviceEventListener() method does not return E_DEVICE_UNAVAILABLE anymore. The E_DEVICE_UNAVAILABLE exception is removed.
* @section DeviceManagerRemoveDeviceEventListenerPageIssueSection Resolutions
- * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE exception.
+ * The E_UNSUPPORTED_OPERATION exception is added since Tizen. So, use E_UNSUPPORTED_OPERATION instead of E_DEVICE_UNAVAILABLE.
* @endif
*/
*
* @since 2.0
*
- * The %IAlarmEventListener interface must be registered and implemented by an application to receive Alarm events from the system.
+ * The %IAlarmEventListener interface must be registered and implemented by an application to receive alarm events from the system.
*
*/
class _OSP_EXPORT_ IAlarmEventListener
virtual void OnAlarmExpired(Alarm& alarm) = 0;
protected:
- // The following methods are reserved, and the name of methods can be changed at any time without prior notice.
//
// This method is for internal use only.
// Using this method can cause behavioral, security-related, and consistency-related issues in the application.
//
+ // This method is reserved and may change its name at any time without prior notice.
+ //
// @since 2.0
//
virtual void OnIAlarmEventListener_Reserved1(void) {};
// This method is for internal use only.
// Using this method can cause behavioral, security-related, and consistency-related issues in the application.
//
+ // This method is reserved and may change its name at any time without prior notice.
+ //
// @since 2.0
virtual void OnIAlarmEventListener_Reserved2(void) {};
// This method is for internal use only.
// Using this method can cause behavioral, security-related, and consistency-related issues in the application.
//
+ // This method is reserved and may change its name at any time without prior notice.
+ //
// @since 2.0
virtual void OnIAlarmEventListener_Reserved3(void) {};
*
* @since 2.0
*
- * The %IBatteryEventListener interface must be registered and implemented by an application to receive Battery events from the system.
+ * The %IBatteryEventListener interface must be registered and implemented by an application to receive battery events from the system.
*/
class _OSP_EXPORT_ IBatteryEventListener
/**
* Called when the screen turns off. @n
* Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device to enter the sleep mode to save the battery.
- *Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a callback before the device enters the sleep mode.
- *Similarly, do not perform lengthy operations in this listener method. All operations must be quick ones.
+ * Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a callback before the device enters the sleep mode.
+ * Similarly, do not perform lengthy operations in this listener method. All operations must be quick ones.
*
*@since 2.0
*/
virtual ~ISettingInfoSetValueAsyncResultListener(void) {}
/**
- *Called when a result is received for an asynchronous setting change method call.
+ * Called when a result is received for an asynchronous setting change method call.
*
* @since 2.0
*
* @since 2.0
*
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.read
+ * @privilege %http://tizen.org/privilege/settingmanager.read
*
* @return An error code
* @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
* @since 2.0
*
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.write
+ * @privilege %http://tizen.org/privilege/settingmanager.write
*
* @return An error code
* @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
*
* @since 2.0
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.write
+ * @privilege %http://tizen.org/privilege/settingmanager.write
*
* @return An error code
* @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
* @exception E_INVALID_ARG The specified @c value is invalid value.
* @exception E_OBJ_NOT_FOUND The specified @c key is not found.
* @exception E_UNSUPPORTED_OPERATION The specified @c key is existed, However it is not supported by this device.
+ * @exception E_IN_PROGRESS The specified key is under processing or invalid state.
* @exception E_SYSTEM The method cannot proceed due to a severe system error.
*/
static result SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
/**
+ * Sets the specific @c bool type sett * @exception E_IN_PROGRESS The specified key is under processing or invalid state.ing information based on the specified designators (key) asynchronously.
+ *
+ * @since 2.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/setting
+ *
+ * @return An error code
+ * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
+ * @param[in] value The setting information of type bool
+ * @param[in] listener The result listener.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
+ * @exception E_INVALID_ARG The specified @c value is invalid value.
+ * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
+ * @exception E_UNSUPPORTED_OPERATION The specified @c key is existed, However it is not supported by this device.
+ * @exception E_IN_PROGRESS The specified key is under processing or invalid state.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ static result SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
+
+
+ /**
* Sets the specific Tizen::Base::String type setting information based on the specified designators (key).
*
* @since 2.0
*
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.write
+ * @privilege %http://tizen.org/privilege/settingmanager.write
*
* @return An error code
* @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
* @since 2.0
*
* @privlevel platform
- * @privilege %http://tizen.org/privilege/systemsetting.write
+ * @privilege %http://tizen.org/privilege/settingmanager.write
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* @since 2.0
*
* @privlevel public
- * @privilege %http://tizen.org/privilege/platforminfo
+ * @privilege %http://tizen.org/privilege/system
*
* @return An error code
* @param[out] platformVersion The platform version
* @since 2.0
*
* @privlevel public
- * @privilege %http://tizen.org/privilege/platforminfo
+ * @privilege %http://tizen.org/privilege/system
*
* @return An error code
* @param[out] nativeApiVersion The Native API version
* @since 2.0
*
* @privlevel public
- * @privilege %http://tizen.org/privilege/platforminfo
+ * @privilege %http://tizen.org/privilege/system
*
* @return An error code
* @param[out] webApiVersion The %Tizen API version
* @since 2.1
*
* @privlevel public
- * @privilege %http://tizen.org/privilege/platforminfo
+ * @privilege %http://tizen.org/privilege/system
*
* @return An error code
* @param[out] buildInfo The %Tizen build information
* @since 2.0
*
* @privlevel partner
- * @privilege %http://tizen.org/privilege/useridentity
+ * @privilege %http://tizen.org/privilege/systemmanager
*
* @return An error code
* @param[out] imei The IMEI of the device
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-system-power)
BuildRequires: pkgconfig(capi-system-runtime-info)
+BuildRequires: pkgconfig(capi-system-system-settings)
BuildRequires: pkgconfig(alarm-service)
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(zlib)
-BuildRequires: pkgconfig(drm-service-core-intel)
BuildRequires: pkgconfig(haptic)
BuildRequires: pkgconfig(x11)
BuildRequires: privacy-manager-client-devel
mkdir -p /tmp/osp
-if [ -f /usr/lib/rpm-plugins/msm.so ]
-then
- chsmack -a "osp::compat" /opt/usr/share/.osp-compat/share/AppControl
- chsmack -t /opt/usr/share/.osp-compat/share/AppControl
- chsmack -a "osp::root-certs" /opt/usr/share/certs/rootcert
- chsmack -t /opt/usr/share/certs/rootcert
- chsmack -a "osp::root-certs" /opt/usr/share/certs/rootcert
- chsmack -t /opt/usr/share/certs/rootcert
- chsmack -a "osp::user-certs" /opt/usr/share/certs/usercert
- chsmack -t /opt/usr/share/certs/usercert
- chsmack -a "osp::user-certs" /opt/usr/share/certs/usercert/key
- chsmack -t /opt/usr/share/certs/usercert/key
- chsmack -a "*" /opt/usr/media/*
- chsmack -t /opt/usr/media/*
- chsmack -a "*" /tmp/osp
- chsmack -t /tmp/osp
-fi
-
chmod -R 707 /opt/usr/share/.osp-compat/share/AppControl
chmod -R 705 /opt/usr/share/certs
chmod -R 700 /opt/usr/share/certs/usercert/key
<value>MIDI</value>\r
<value>PCM</value>\r
</AudioCodec>\r
- <CountMax>8</CountMax>\r
+ <CountMax>64</CountMax>\r
<Protocol>\r
<value>RTSP</value>\r
<value>HTTP</value>\r
<value>MIDI</value>\r
<value>PCM</value>\r
</AudioCodec>\r
- <CountMax>8</CountMax>\r
+ <CountMax>64</CountMax>\r
<Protocol>\r
<value>RTSP</value>\r
<value>HTTP</value>\r
dbus-glib-1
devman
dlog
- drm-service-core-intel
dukgenerator
ecore
glib-2.0
capi-system-runtime-info
capi-system-device
capi-system-power
+ capi-system-system-settings
)
FOREACH(flag ${pkgs_CFLAGS})
${CMAKE_SOURCE_DIR}/src/base/inc
${CMAKE_SOURCE_DIR}/src/io/inc
${CMAKE_SOURCE_DIR}/src/system/inc
- ${CMAKE_SOURCE_DIR}/src/security/inc
- inc
+ ${CMAKE_SOURCE_DIR}/src/security/inc
+ inc
)
SET (${this_target}_SOURCE_FILES
package/FAppPkg_PackageAppInfoImpl.cpp
package/FAppPkg_PackageInfoImpl.cpp
package/FAppPkg_PackageManagerImpl.cpp
- package/FAppPkgPackageLicenseManager.cpp
package/FAppPkg_PackageParser.cpp
FAppApp.cpp
FApp_AppImpl.cpp
FAppAppControlProviderManager.cpp
FApp_AppControlProviderManagerImpl.cpp
FApp_AppControlManager.cpp
+ FApp_DataControlManager.cpp
FApp_AppMessageImpl.cpp
FAppAppSetting.cpp
FApp_AppSettingImpl.cpp
std::unique_ptr<char[]> pId(_StringConverter::CopyToCharArrayN(appId));
SysTryReturnVoidResult(NID_APP, pId != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Converting %ls failed.", appId.GetPointer());
- bundle_add(b, OSP_K_APPID, pId.get());
+ int res = bundle_add(b, OSP_K_APPID, pId.get());
+ if (res < 0 && errno == EPERM) // key exists
+ {
+ bundle_del(b, OSP_K_APPID);
+ bundle_add(b, OSP_K_APPID, pId.get());
+ }
appsvc_set_appid(b, pId.get());
}
char buffer[32] = {0, };
snprintf(buffer, 32, "%d", reqId);
- bundle_add(pBundle, OSP_K_REQUEST_ID, buffer);
+ int res = bundle_add(pBundle, OSP_K_REQUEST_ID, buffer);
+ if (res < 0 && errno == EPERM) // key exists
+ {
+ bundle_del(pBundle, OSP_K_REQUEST_ID);
+ bundle_add(pBundle, OSP_K_REQUEST_ID, buffer);
+ }
}
+void
+_AppArg::UpdateKeyValue(bundle* pBundle, const char* pKey, const String& value)
+{
+ SysTryReturnVoidResult(NID_APP, pBundle != null, E_INVALID_STATE, "[E_INVALID_STATE] Improper bundle state.");
+
+ char pBuffer[128] = {0, };
+ snprintf(pBuffer, 128, "%ls", value.GetPointer());
+ int res = bundle_add(pBundle, pKey, pBuffer);
+ if (res < 0 && errno == EPERM) // key exists
+ {
+ bundle_del(pBundle, pKey);
+ bundle_add(pBundle, pKey, pBuffer);
+ }
+}
int
_AppArg::GetRequestIdFromBundle(bundle* pBundle)
if (prop & _APPCONTROL_PROPERTY_ALIAS)
{
- _AppControlRegistry::_AppControlAliasEntry* pEntry = null;
+ const _AppControlRegistry::_AppControlAliasEntry* pEntry = null;
pEntry = _AppControlRegistry::GetInstance()->GetReverseAppControlAliasEntry(provider, oId);
if (pEntry)
{
if (prop & _APPCONTROL_PROPERTY_ALIAS)
{
- _AppControlRegistry::_AppControlAliasEntry* pEntry = null;
+ const _AppControlRegistry::_AppControlAliasEntry* pEntry = null;
pEntry = _AppControlRegistry::GetInstance()->GetReverseAppControlAliasEntry(provider, oId);
if (pEntry)
{
if (pInfo->property & _APPCONTROL_PROPERTY_ALIAS)
{
- _AppControlRegistry::_AppControlAliasEntry* pEntry = null;
+ const _AppControlRegistry::_AppControlAliasEntry* pEntry = null;
pEntry = _AppControlRegistry::GetInstance()->GetReverseAppControlAliasEntry(aId, oId);
if (pEntry)
{
return r;
}
+
+
int
_AppControlManager::Launch(_AppMessageImpl& msg, const char* pkg_name, const char* op, const char* mime, const char* uri, AppSvcResFn pCb, void* data)
{
result
+_AppControlManager::LaunchPkg(_AppMessageImpl& msg, const String& package, const String& opId, const String* pUri, const String* pMime, AppSvcResFn pCb, void* data)
+{
+ std::unique_ptr<char[]> pPackage(_StringConverter::CopyToCharArrayN(package));
+ std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(opId));
+
+ const char* pUriData = null;
+ if (pUri)
+ {
+ pUriData = _StringConverter::CopyToCharArrayN(*pUri);
+ }
+
+ const char* pMimeData = null;
+ if (pMime)
+ {
+ pMimeData = _StringConverter::CopyToCharArrayN(*pMime);
+ }
+
+ result r = LaunchPkg(msg, pPackage.get(), pOperation.get(), pMimeData, pUriData, pCb, data);
+
+ delete [] pUriData;
+ delete [] pMimeData;
+
+ return r;
+}
+
+
+result
_AppControlManager::LaunchPkg(const char* pkg_name, const char* op, const char* mime, const char* uri, AppSvcResFn pCb, void* data)
{
_AppMessageImpl msg;
return false;
}
+
+AppId
+_AppControlManager::GetAliasAppId(const AppId& appId)
+{
+ return _AppControlRegistry::GetInstance()->GetAliasAppId(appId);
+}
+
}} // Tizen::App
{
__nativeList.Construct();
+ __tizenList.Construct();
+
__aliasList.Construct();
__aliasAppId.Construct();
__pSelf->LoadRegistry();
+ __pSelf->LoadTizenAppControlRegistry();
+
__pSelf->LoadLegacyList();
__pSelf->LoadAliasList();
}
result
+_AppControlRegistry::LoadTizenAppControlRegistry(void)
+{
+ _RegistryImpl reg;
+
+ const String regPath = ACTL_DEFAULT_FILE;
+
+ result r = reg.Construct(regPath, REG_OPEN_READ_ONLY, null);
+ SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ const int secCount = reg.GetAllSectionCount();
+ SysTryReturnResult(NID_APP, !(secCount <= 0), E_OBJ_NOT_FOUND, "Registry contains no data.");
+
+ SysLog(NID_APP, "Loading %d sections from %ls", secCount, regPath.GetPointer());
+
+ int index = 0;
+ int size = 0;
+ //int num = 0;
+ String path;
+
+ for (int i = 0; i < secCount; i++)
+ {
+ ///////////////////////////////////////////////////////////////////////
+ // appcontrol Id
+ String sec_name(reg.GetSectionName(i));
+ sec_name.Trim();
+
+ if (sec_name.IsEmpty())
+ {
+ continue;
+ }
+
+#if 0
+ int public_open = 0;
+
+ ///////////////////////////////////////////////////////////////////////
+ // Plubic
+ index = reg.GetEntryIndex(i, ACTL_REGISTRY_PUBLIC);
+ if (index >= 0)
+ {
+ size = sizeof(size);
+ num = 0;
+
+ reg.GetEntryValue(i, index, REG_VALUE_TYPE_INT, &num, &size);
+ if (num == 1)
+ {
+ // public
+ public_open = 1;
+ }
+ }
+#endif
+
+ ///////////////////////////////////////////////////////////////////////
+ // Path
+ index = reg.GetEntryIndex(i, ACTL_REGISTRY_PATH);
+ if (index >= 0)
+ {
+ size = REG_VALUE_BUFFER_LEN;
+ reg.GetEntryValue(i, index, REG_VALUE_TYPE_STRING, &path, &size);
+ }
+
+ __tizenList.Add(sec_name, path);
+ }
+
+ SysLog(NID_APP, "Finished loading %d tizen AppControl entries", __tizenList.GetCount());
+
+ return E_SUCCESS;
+}
+
+result
_AppControlRegistry::LoadLegacyList(void)
{
_RegistryImpl reg;
AppControl*
+_AppControlRegistry::GetTizenAppControlN(const String& aId, const String& oId) const
+{
+ const _AppControlAliasEntry* pEntry = null;
+ int count = 0;
+
+ do
+ {
+ const _AppControlAliasEntry* pTempEntry = GetAppControlAliasEntry(aId, oId);
+ // number does not matter
+ if (count >= 5 || pTempEntry == null)
+ {
+ break;
+ }
+
+ pEntry = pTempEntry;
+ count++;
+ }
+ while (true);
+
+
+ const String* pAppId = null;
+ const String* pOperation = null;
+
+ if (count == 0)
+ {
+ // if count is 0, then no alias is found
+ pAppId = &aId;
+ pOperation = &oId;
+ }
+ else if (pEntry == null)
+ {
+ // no "TIZEN" AppControl
+ return null;
+ }
+ else
+ {
+ pAppId = &pEntry->provider2;
+ pOperation = &pEntry->operation2;
+ }
+
+ SysAssert(pAppId != null);
+ SysAssert(pOperation != null);
+
+ SysLog(NID_APP, "Found matching AppControl (%ls, %ls)", pAppId->GetPointer(), pOperation->GetPointer());
+
+ const String& soName = GetTizenAppControlProvider(*pAppId, *pOperation);
+
+ if (soName.IsEmpty())
+ {
+ SysLog(NID_APP, "No AppControl stub found for (%ls, %ls)", pAppId->GetPointer(), pOperation->GetPointer());
+ return null;
+ }
+
+ return _AppControlImpl::CreateN(soName, *pAppId, *pOperation, L"", _APPCONTROL_PROPERTY_PUBLIC | _APPCONTROL_PROPERTY_SLP);
+}
+
+
+String
+_AppControlRegistry::GetTizenAppControlProvider(const String& appId, const String& oId) const
+{
+ String val;
+ result r = __tizenList.GetValue(appId, val);
+ if (r == E_SUCCESS)
+ {
+ SysLog(NID_APP, "Found TIZEN AppControl stub %ls for %ls.", val.GetPointer(), appId.GetPointer());
+ return val;
+ }
+
+ SysLog(NID_APP, "No platform AppControl and use custom AppControl instead.");
+ return L"";
+}
+
+
+AppControl*
_AppControlRegistry::GetNativeAppControlN(const String& aId, const String& oId) const
{
std::unique_ptr< IEnumeratorT<AppControl*> > pEnum(__nativeList.GetEnumeratorN());
return pList;
}
-_AppControlRegistry::_AppControlAliasEntry*
+const _AppControlRegistry::_AppControlAliasEntry*
_AppControlRegistry::GetAppControlAliasEntry(const String& aId, const String& oId) const
{
std::unique_ptr< IEnumeratorT<_AppControlAliasEntry*> > pEnum(__aliasList.GetValuesN(aId));
return null;
}
-_AppControlRegistry::_AppControlAliasEntry*
+const _AppControlRegistry::_AppControlAliasEntry*
_AppControlRegistry::GetReverseAppControlAliasEntry(const String& aId, const String& oId) const
{
std::unique_ptr< IMapEnumeratorT<String, _AppControlAliasEntry*> > pEnum(__aliasList.GetMapEnumeratorN());
AppControl*
_AppControlRegistry::GetAliasAppControlN(const String& aId, const String& oId) const
{
- _AppControlAliasEntry* pEntry = GetAppControlAliasEntry(aId, oId);
+ const _AppControlAliasEntry* pEntry = GetAppControlAliasEntry(aId, oId);
if (pEntry)
{
String actualAppId = appId;
if (appId.StartsWith(TIZEN_ALIAS_APPID_PREFIX, 0))
{
- String tmp;
- result r = __aliasAppId.GetValue(appId, tmp);
- if (r == E_SUCCESS)
+ const String& tmp = GetAliasAppId(appId);
+
+ if (tmp.IsEmpty())
{
actualAppId = tmp;
SysLog(NID_APP, "Found alias appId (%ls -> %ls).", appId.GetPointer(), tmp.GetPointer());
return _AppControlImpl::CreateN(actualAppId, operationId, changeAppId);
}
+
+AppId
+_AppControlRegistry::GetAliasAppId(const AppId& appId) const
+{
+ String tmp;
+ result r = __aliasAppId.GetValue(appId, tmp);
+ if (r != E_SUCCESS)
+ {
+ tmp.Clear();
+ }
+
+ return tmp;
+}
+
+
AppId
_AppControlRegistry::GetReverseAliasAppId(const AppId& appId) const
{
static _AppControlRegistry* GetInstance(void);
+ AppControl* GetTizenAppControlN(const Tizen::Base::String& aId, const Tizen::Base::String& oId) const;
+
AppControl* GetNativeAppControlN(const Tizen::Base::String& aId, const Tizen::Base::String& oId) const;
AppControl* GetSlpAppControlN(const Tizen::Base::String& packageName, const Tizen::Base::String& oId) const;
Tizen::Base::Collection::ArrayList* FindAppControlListN(const Tizen::Base::String* pOid, const Tizen::Base::String* pUri, const Tizen::Base::String* pMimeType, const Tizen::Base::String* pCategory) const;
- _AppControlAliasEntry* GetAppControlAliasEntry(const Tizen::Base::String& aId, const Tizen::Base::String& oId) const;
+ const _AppControlAliasEntry* GetAppControlAliasEntry(const Tizen::Base::String& aId, const Tizen::Base::String& oId) const;
+
+ const _AppControlAliasEntry* GetReverseAppControlAliasEntry(const Tizen::Base::String& aId, const Tizen::Base::String& oId) const;
- _AppControlAliasEntry* GetReverseAppControlAliasEntry(const Tizen::Base::String& aId, const Tizen::Base::String& oId) const;
+ AppId GetAliasAppId(const AppId& appId) const;
AppId GetReverseAliasAppId(const AppId& appId) const;
result LoadRegistry(void);
+ result LoadTizenAppControlRegistry(void);
+
result LoadLegacyList(void);
result LoadAliasList(void);
+ Tizen::Base::String GetTizenAppControlProvider(const Tizen::Base::String& appId, const Tizen::Base::String& opId) const;
+
private:
AppControlList __nativeList;
+ AliasMapType __tizenList;
+
AppControlAliasList __aliasList;
AliasMapType __aliasAppId;
_AppImpl* _AppImpl::__pAppImpl = null;
bool _AppImpl::__isTerminationRequested = false;
+#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
{
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* pDataId = null;
- String* pReqId = null;
+ String callerReqId;
String* pColumnCount = null;
String* pColumn = null;
String* pValue = null;
String* pNo = null;
String* pCount = 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;
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");
+ 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)
}
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;
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");
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)
}
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)
}
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(),
+ SysLog(NID_APP, "[DC_PROV_RECV] caller appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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]: insert 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.");
i = 0;
index = 0;
- while (i < columnCount * 2) // list(2): column-value pairs
+ while (i < columnCount * 2) // request list[2]: 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_PROVIDER] column[%d]: %ls", index, pColumn->GetPointer());
+ 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_PROVIDER] value[%d]: %ls", index, pValue->GetPointer());
+ SysLog(NID_APP, "[DC_PROV_RECV] value[%d]: %ls", index, pValue->GetPointer());
pInsertMap->Add(*(new String(*pColumn)), *(new String(*pValue)));
index++;
}
- 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 appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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.");
i = 0;
index = 0;
- while (i < columnCount * 2) // list(2): column-value pairs
+ while (i < columnCount * 2) // request list[2]: 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_PROVIDER] column[%d]: %ls", index, pColumn->GetPointer());
+ SysLog(NID_APP, "[DC_PROV_RECV] column[%d]: %ls", index, pColumn->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());
+ SysLog(NID_APP, "[DC_PROV_RECV] value[%d]: %ls", index, pValue->GetPointer());
pUpdateMap->Add(*(new String(*pColumn)), *(new String(*pValue)));
index++;
}
- // list(3): where clause
+ // 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");
}
else
{
- SysLog(NID_APP, "[DC_PROVIDER] pWhere: %ls", pWhere->GetPointer());
+ SysLog(NID_APP, "[DC_PROV_RECV] pWhere: %ls", pWhere->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 appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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");
}
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 appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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 appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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 appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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 appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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 appId: %ls, requestType: %d, caller reqId: %ls, providerId: %ls, dataId: %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);
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FApp_DataControlManager.cpp
+ * @brief This is the implementation for the _DataControlManager class.
+ */
+
+#include <new>
+#include <cstdlib>
+#include <pthread.h>
+#include <typeinfo>
+
+#include <FBaseInteger.h>
+#include <FBaseSysLog.h>
+
+#include "FApp_DataControlManager.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace App
+{
+
+_DataControlManager* _DataControlManager::__pDataControlManagerInstance = null;
+
+_DataControlManager::_DataControlManager(void)
+ : __pDataControlRequestList(null)
+{
+ __pDataControlRequestList = new (std::nothrow) HashMap(SingleObjectDeleter);
+ SysTryReturnVoidResult(NID_APP, __pDataControlRequestList != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ __pDataControlRequestList->Construct();
+}
+
+_DataControlManager::~_DataControlManager(void)
+{
+ delete __pDataControlRequestList;
+}
+
+void
+_DataControlManager::InitSingleton(void)
+{
+ _DataControlManager* pInst = new (std::nothrow) _DataControlManager();
+ SysTryReturnVoidResult(NID_APP, pInst != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ __pDataControlManagerInstance = pInst;
+
+ std::atexit(DestroySingleton);
+ return;
+}
+
+void
+_DataControlManager::DestroySingleton(void)
+{
+ delete __pDataControlManagerInstance;
+}
+
+_DataControlManager*
+_DataControlManager::GetInstance(void)
+{
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+
+ if (__pDataControlManagerInstance == null)
+ {
+ ClearLastResult();
+ pthread_once(&onceBlock, InitSingleton);
+ result r = GetLastResult();
+ if (IsFailed(r))
+ {
+ onceBlock = PTHREAD_ONCE_INIT;
+ SysPropagate(NID_APP, r);
+ }
+ }
+
+ return __pDataControlManagerInstance;
+}
+
+result
+_DataControlManager::AddRequestInfo(Integer* pReqId, _DataControlRequestInfo* pReqInfo)
+{
+ //SysLog(NID_APP, "DataControl request list count: %d", __pDataControlRequestList->GetCount());
+ return __pDataControlRequestList->Add(pReqId, pReqInfo);
+}
+
+_DataControlRequestInfo*
+_DataControlManager::GetRequestInfo(Integer& reqId)
+{
+ result r = E_SUCCESS;
+
+ Object* pObj = __pDataControlRequestList->GetValue(reqId);
+ SysTryReturn(NID_APP, pObj != null, null, GetLastResult(), "[%s] Propagating to caller...", GetErrorMessage(GetLastResult()));
+
+ _DataControlRequestInfo* pReqInfo = dynamic_cast< _DataControlRequestInfo* >(pObj);
+ SysTryReturn(NID_APP, pReqInfo != null, null, r, "[E_SYSTEM] invalid request info");
+
+ return pReqInfo;
+}
+
+void
+_DataControlManager::RemoveRequestInfo(Integer& reqId)
+{
+ __pDataControlRequestList->Remove(reqId);
+}
+
+}} // Tizen::App
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FApp_DataControlManager.h
+ * @brief This is the header file for the _DataControlManager class.
+ */
+
+#ifndef _FAPP_INTERNAL_DATA_CONTROL_MANAGER_H_
+#define _FAPP_INTERNAL_DATA_CONTROL_MANAGER_H_
+
+#include <FBaseObject.h>
+#include <FBaseColHashMap.h>
+#include <FBaseRtEvent.h>
+
+namespace Tizen { namespace App
+{
+
+class _DataControlRequestInfo
+ : public Tizen::Base::Object
+{
+public:
+ _DataControlRequestInfo(Tizen::Base::Runtime::Event* pEvent)
+ {
+ __pEvent = pEvent;
+ }
+
+ virtual ~_DataControlRequestInfo(void)
+ {
+ }
+
+ Tizen::Base::Runtime::Event* GetEvent(void)
+ {
+ return __pEvent;
+ }
+private:
+ _DataControlRequestInfo(void)
+ : __pEvent(null)
+ {
+ }
+private:
+ Tizen::Base::Runtime::Event* __pEvent;
+};
+
+class _DataControlManager
+ : public Tizen::Base::Object
+{
+public:
+ static _DataControlManager* GetInstance(void);
+
+ result AddRequestInfo(Tizen::Base::Integer* pReqId, _DataControlRequestInfo* pReqInfo);
+
+ _DataControlRequestInfo* GetRequestInfo(Tizen::Base::Integer& reqId);
+
+ void RemoveRequestInfo(Tizen::Base::Integer& reqId);
+
+private:
+ _DataControlManager(void);
+
+ virtual ~_DataControlManager(void);
+
+ static void InitSingleton(void);
+
+ static void DestroySingleton(void);
+
+private:
+ static _DataControlManager* __pDataControlManagerInstance;
+ Tizen::Base::Collection::HashMap* __pDataControlRequestList;
+
+}; // _DataControlManager
+
+}} // Tizen::App
+
+#endif // _FAPP_INTERNAL_DATA_CONTROL_MANAGER_H_
+
IDbEnumerator* pDbEnum, IList* pResultValueList, long long insertRowId, bool providerResult, const String* pErrorMsg)
{
ArrayList* pList = null;
- String* pAppId = null;
- String* pRequestType = null;
+ String appId;
+ String reqType;
int type = 0;
_DataControlRequestType requestType = _DATACONTROL_REQUEST_TYPE_UNDEFINED;
- String* pProviderId = null;
- String* pReqId = null;
+ String providerId;
+ String callerReqId;
ArrayList* pResultArgList = null;
String* pResult = null;
String* pErrorMessage = null;
String* pResultCount = null;
String* pResultValue = null;
_AppArg resultArg;
+ String* pDataId = null;
result r = E_SUCCESS;
_AppControlManager* pAppMgr = _AppControlManager::GetInstance();
SysTryReturnResult(NID_APP, pAppMgr, E_SYSTEM, "Failed to get instance.");
- _ResultInfo* pResultInfo = pAppMgr->__resultManager.FindItem(static_cast< int >(reqId));
+ _ResultInfo* pResultInfo = pAppMgr->__resultManager.FindItem(static_cast< int >(reqId)); // provider reqId
SysTryReturnResult(NID_APP, pResultInfo, E_OBJ_NOT_FOUND,
"The data control request specified with the reqId (%ld) did not exist.", reqId);
- const _AppArg& arg = pResultInfo->arg;
-
- pList = arg.GetArgListN(0);
- SysTryCatch(NID_APP, pList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
+ const _AppArg& arg = pResultInfo->arg; // request info
// key-based request
- pAppId = dynamic_cast< String* >(pList->GetAt(0)); // request key[0]
- SysTryCatch(NID_APP, pAppId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
-
- pRequestType = dynamic_cast< String* >(pList->GetAt(1)); // request key[1]
- SysTryCatch(NID_APP, pRequestType, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
- Integer::Parse(*pRequestType, type);
+ reqType = arg.GetValue(OSP_K_DATACONTROL_REQUEST_TYPE);
+ Integer::Parse(reqType, type);
requestType = static_cast< _DataControlRequestType >(type);
-
if (providerResult == true && apiType != requestType)
{
if ((apiType == _DATACONTROL_REQUEST_TYPE_SQL_UPDATE /*UpdateDelete*/ && requestType == _DATACONTROL_REQUEST_TYPE_SQL_DELETE) ||
}
}
- pReqId = dynamic_cast< String* >(pList->GetAt(2)); // request key[2]
- SysTryCatch(NID_APP, pReqId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
+ appId = arg.GetCallerAppId();
+ callerReqId = arg.GetValue(OSP_K_REQUEST_ID);
+ providerId = arg.GetValue(OSP_K_DATACONTROL_PROVIDER);
+
+ // 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");
+
+ pDataId = dynamic_cast< String* >(pList->GetAt(0)); // request list[0]
+ SysTryCatch(NID_APP, pDataId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
- pProviderId = dynamic_cast< String* >(pList->GetAt(3)); // request key[3]
- SysTryCatch(NID_APP, pProviderId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
+ SysLog(NID_APP, "[DC_PROV_SEND] > appId: %ls, requestType: %d, callerReqId: %ls, providerId: %ls, dataId: %ls",
+ appId.GetPointer(), requestType, callerReqId.GetPointer(), providerId.GetPointer(), pDataId->GetPointer());
- // Serializes the result
+ // Serializes result
pResultArgList = new (std::nothrow) ArrayList();
SysTryCatch(NID_APP, pResultArgList, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] The memory was insufficient.");
"[E_SYSTEM] The method cannot proceed due to a severe system error.");
String tempFilePath(_DATACONTROL_RESULTSET_DIR);
- tempFilePath.Append(*pAppId);
- tempFilePath.Append(*pReqId);
+ tempFilePath.Append(appId);
+ tempFilePath.Append(callerReqId);
pTempFilePath = new (std::nothrow) String(tempFilePath);
}
else
if (pResultValueList)
{
// list-based request
- pNo = dynamic_cast< String* >(pList->GetAt(6)); // request list[2]
+ pNo = dynamic_cast< String* >(pList->GetAt(2)); // request list[2]
SysTryCatch(NID_APP, pNo, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
Integer::Parse(*pNo, pageNo);
- pCount = dynamic_cast< String* >(pList->GetAt(7)); // request list[3]
+ pCount = dynamic_cast< String* >(pList->GetAt(3)); // request list[3]
SysTryCatch(NID_APP, pCount, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result object");
Integer::Parse(*pCount, countPerPage);
+ SysLog(NID_APP, "[DC_PROV_SEND] pageNo: %d, countPerPage: %d", pageNo, countPerPage);
String resultCount;
int num = pResultValueList->GetCount();
r = resultArg.ConstructResult(arg, pResultArgList);
SysTryCatch(NID_APP, !IsFailed(r), r = E_SYSTEM, r, "[%s] Propagating.", GetErrorMessage(r));
+ resultArg.UpdateKeyValue(OSP_K_REQUEST_ID, callerReqId);
+ resultArg.UpdateKeyValue(OSP_K_DATACONTROL_REQUEST_TYPE, reqType);
+ resultArg.UpdateKeyValue(OSP_K_DATACONTROL_PROVIDER, providerId);
+ resultArg.UpdateKeyValue(OSP_K_DATACONTROL_DATA, *pDataId);
//resultArg.Print();
r = _Aul::SendResult(resultArg.GetBundle(), static_cast< appsvc_result_val >(0));
#include "FApp_AppControlManager.h"
#include "FApp_MapDataControlImpl.h"
#include "FApp_AppArg.h"
+#include "FApp_DataControlManager.h"
using namespace std;
result
_MapDataControlImpl::StartMapDataControl(int type, const IList* pDataList, int* pReq)
{
+ Integer* pReqId = null;
+ _DataControlRequestInfo* pReqInfo = null;
result r = E_SUCCESS;
int req = -1;
if (__pMapDataControlEvent)
{
// reqId is system-wide id because the bundle is system-wide.
+#if 0
_AppControlManager::_RequestGuard reqObj = _AppControlManager::_RequestGuard(*pAppManagerImpl, pArg, MapDataControlCallback, __pMapDataControlEvent, -1);
req = reqObj.GetRequestNumber();
+#else
+ _DataControlManager* pDcMgr = _DataControlManager::GetInstance();
+ _AppControlManager::_RequestGuard reqObj = _AppControlManager::_RequestGuard(*pAppManagerImpl, pArg, MapDataControlCallback, pDcMgr, -1);
+ req = reqObj.GetRequestNumber();
+#endif
+ pReqId = new (std::nothrow) Integer(req);
+ SysTryCatch(NID_APP, pReqId != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient");
+
+ pReqInfo = new (std::nothrow) _DataControlRequestInfo(__pMapDataControlEvent);
+ SysTryCatch(NID_APP, pReqId != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient");
+
+ r = pDcMgr->AddRequestInfo(pReqId, pReqInfo);
+ SysTryCatch(NID_APP, !IsFailed(r), r = E_SYSTEM, E_SYSTEM, "[%s] Failed to add request info", GetErrorMessage(r));
r = pAppManagerImpl->LaunchApp(__appId, pArg, req);
- SysTryCatch(NID_APP, r == E_SUCCESS, reqObj.Invalidate(), r, "[%s] Propgated.", GetErrorMessage(r));
+ if (IsFailed(r))
+ {
+ SysPropagate(NID_APP, r);
+ reqObj.Invalidate();
+ pDcMgr->RemoveRequestInfo(*pReqId);
+ delete pArg;
+ return r;
+ }
if (pReq)
{
else
{
r = pAppManagerImpl->LaunchApp(__appId, pArg);
+ SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating to caller...", GetErrorMessage(r));
delete pArg;
}
+ return E_SUCCESS;
+
CATCH:
+ delete pArg;
+ delete pReqId;
+ delete pReqInfo;
return r;
}
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "dataId: %ls, key: %ls, reqId: %d, pageNo: %d, countPerPage: %d",
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, reqId: %d, pageNo: %d, countPerPage: %d",
dataId.GetPointer(), key.GetPointer(), reqId, pageNo, countPerPage);
// fall through
_MapDataControlImpl::MapDataControlCallback(void* data, _AppArg* pArg, _AppArg* pResArg, service_result_e res, int prop)
{
ArrayList* pResultList = null;
- ArrayList* pOrigList = null;
- String* pRequestType = null;
String* pResult = null;
- String* pReqId = null;
String* pProviderId = null;
String* pDataId = null;
String* pErrorMessage = null;
int resultCount = 0;
int requestType = 0;
int reqId = 0;
+ int launchReqId = 0;
int providerRes = 0;
bool providerResult = true;
- bundle* origBundle = null;
+ //bundle* origBundle = null;
bundle* resBundle = null;
_MapDataControlEventArg* pEventArg = null;
+ const char* p = null;
result r = E_SUCCESS;
SysTryReturnResult(NID_APP, pResArg != null, E_INVALID_ARG, "Empty result callback.");
resBundle = pResArg->GetBundle();
if (resBundle)
{
- _MapDataControlEvent* pMapDataControlEvent = static_cast< _MapDataControlEvent* >(data);
+ p = appsvc_get_data(resBundle, OSP_K_REQUEST_ID);
+ SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ reqId = atoi(p);
+ Integer key(reqId);
+
+ _DataControlManager* pDcMgr = static_cast< _DataControlManager* >(data);
+ _DataControlRequestInfo* pReqInfo = pDcMgr->GetRequestInfo(key);
+ SysTryCatch(NID_APP, pReqInfo != null, r = E_SYSTEM, E_SYSTEM,
+ "[E_SYSTEM] Failed to get request info");
+
+ _MapDataControlEvent* pMapDataControlEvent = dynamic_cast< _MapDataControlEvent* >(pReqInfo->GetEvent());
+ SysTryCatch(NID_APP, pMapDataControlEvent != null, r = E_SYSTEM, E_SYSTEM,
+ "[E_SYSTEM] invalid request info");
+
+ pDcMgr->RemoveRequestInfo(key);
if (pMapDataControlEvent != null && typeid(pMapDataControlEvent) == typeid(_MapDataControlEvent*))
{
- const char* p = null;
// result list
pResultList = _AppArg::GetListN(resBundle, OSP_K_ARG);
SysTryCatch(NID_APP, pResultList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
- pResult = dynamic_cast <String*>(pResultList->GetAt(0));
+ pResult = dynamic_cast <String*>(pResultList->GetAt(0)); // result list[0]
SysTryCatch(NID_APP, pResult, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
Integer::Parse(*pResult, providerRes);
providerResult = static_cast< bool >(providerRes);
- pErrorMessage = dynamic_cast< String* >(pResultList->GetAt(1));
+ pErrorMessage = dynamic_cast< String* >(pResultList->GetAt(1)); // result list[1]
SysTryCatch(NID_APP, pErrorMessage, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
pErrorMsg = new (std::nothrow) String(*pErrorMessage);
SysTryCatch(NID_APP, pErrorMsg, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] The memory is insufficient.");
// request info
- origBundle = pArg->GetBundle();
-
- p = appsvc_get_data(origBundle, OSP_K_DATACONTROL_REQUEST_TYPE);
- SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
- pRequestType = new (std::nothrow) String(p);
- SysTryCatch(NID_APP, pRequestType, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[E_OUT_OF_MEMORY] The memory is insufficient.");
- Integer::Parse(*pRequestType, requestType);
+ //origBundle = pArg->GetBundle();
- p = appsvc_get_data(origBundle, OSP_K_REQUEST_ID);
+ p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_REQUEST_TYPE);
SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
- pReqId = new (std::nothrow) String(p);
- SysTryCatch(NID_APP, pReqId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[E_OUT_OF_MEMORY] The memory is insufficient.");
- Integer::Parse(*pReqId, reqId);
+ requestType = atoi(p);
- p = appsvc_get_data(origBundle, OSP_K_DATACONTROL_PROVIDER);
+ p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_PROVIDER);
SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
pProviderId = new (std::nothrow) String(p);
SysTryCatch(NID_APP, pProviderId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] The memory is insufficient.");
- pOrigList = _AppArg::GetListN(origBundle, OSP_K_ARG);
- SysTryCatch(NID_APP, pOrigList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
- pDataId = dynamic_cast <String*>(pOrigList->GetAt(0));
- SysTryCatch(NID_APP, pDataId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_DATA);
+ SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ pDataId = new (std::nothrow) String(p);
+ SysTryCatch(NID_APP, pDataId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
- SysLog(NID_APP, "result: %ld, requestType: %d, reqId: %d, providerId: %ls, dataId: %ls, errorMsg: %ls ",
+ SysLog(NID_APP, "[DC_CALLER_RECV] provider result: %ld, requestType: %d, reqId: %d, providerId: %ls, dataId: %ls, errorMsg: %ls ",
providerRes, requestType, reqId, pProviderId->GetPointer(), pDataId->GetPointer(), pErrorMsg->GetPointer());
switch (static_cast< _DataControlRequestType >(requestType))
if (providerResult == true)
{
- pResultCount = dynamic_cast< String* >(pResultList->GetAt(2));
+ pResultCount = dynamic_cast< String* >(pResultList->GetAt(2)); // result list[2]
if (pResultCount == null)
{
SysLogException(NID_APP, E_SYSTEM, "[E_SYSTEM] invalid result");
pResultList->RemoveAll(true);
delete pResultList;
-
- pOrigList->RemoveAll(true);
- delete pOrigList;
-
- delete pRequestType;
- delete pReqId;
delete pProviderId;
}
}
+ p = appsvc_get_data(pArg->GetBundle(), OSP_K_REQUEST_ID);
+ SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ launchReqId = atoi(p);
+
// Remove the request count
- SysLog(NID_APP, "Remove a launch request: reqId: %d", reqId);
- _AppControlManager::GetInstance()->RemoveLaunchRequest(reqId);
+ SysLog(NID_APP, "Remove a launch request: reqId: %d", launchReqId);
+ _AppControlManager::GetInstance()->RemoveLaunchRequest(launchReqId);
return E_SUCCESS;
pResultList->RemoveAll(true);
delete pResultList;
}
-
- if (pOrigList)
- {
- pOrigList->RemoveAll(true);
- delete pOrigList;
- }
-
- delete pRequestType;
- delete pReqId;
delete pProviderId;
return r;
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "dataId: %ls, key: %ls, value: %ls, reqId: %d",
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, value: %ls, reqId: %d",
dataId.GetPointer(), key.GetPointer(), value.GetPointer(), reqId);
// fall through
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "dataId: %ls, key: %ls, oldValue: %ls, newValue: %ls, reqId: %d",
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, oldValue: %ls, newValue: %ls, reqId: %d",
dataId.GetPointer(), key.GetPointer(), oldValue.GetPointer(), newValue.GetPointer(), reqId);
// fall through
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "dataId: %ls, key: %ls, value: %ls, reqId: %d",
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, value: %ls, reqId: %d",
dataId.GetPointer(), key.GetPointer(), value.GetPointer(), reqId);
// fall through
#include "FApp_AppControlManager.h"
#include "FApp_SqlDataControlImpl.h"
#include "FApp_AppArg.h"
+#include "FApp_DataControlManager.h"
using namespace std;
result
_SqlDataControlImpl::StartSqlDataControl(int type, const IList* pDataList, int* pReq)
{
+ Integer* pReqId = null;
+ _DataControlRequestInfo* pReqInfo = null;
result r = E_SUCCESS;
int req = -1;
if (__pSqlDataControlEvent)
{
// reqId is system-wide id because the bundle is system-wide.
+#if 0
_AppControlManager::_RequestGuard reqObj = _AppControlManager::_RequestGuard(*pAppManagerImpl, pArg, SqlDataControlCallback, __pSqlDataControlEvent, -1);
req = reqObj.GetRequestNumber();
+#else
+ _DataControlManager* pDcMgr = _DataControlManager::GetInstance();
+ _AppControlManager::_RequestGuard reqObj = _AppControlManager::_RequestGuard(*pAppManagerImpl, pArg, SqlDataControlCallback, pDcMgr, -1);
+ req = reqObj.GetRequestNumber();
+#endif
+ pReqId = new (std::nothrow) Integer(req);
+ SysTryCatch(NID_APP, pReqId != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient");
+
+ pReqInfo = new (std::nothrow) _DataControlRequestInfo(__pSqlDataControlEvent);
+ SysTryCatch(NID_APP, pReqId != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient");
+
+ r = pDcMgr->AddRequestInfo(pReqId, pReqInfo);
+ SysTryCatch(NID_APP, !IsFailed(r), r = E_SYSTEM, E_SYSTEM, "[%s] Failed to add request info", GetErrorMessage(r));
r = pAppManagerImpl->LaunchApp(__appId, pArg, req);
- SysTryCatch(NID_APP, r == E_SUCCESS, reqObj.Invalidate(), r, "[%s] Propagating.", GetErrorMessage(r));
+ if (IsFailed(r))
+ {
+ SysPropagate(NID_APP, r);
+ reqObj.Invalidate();
+ pDcMgr->RemoveRequestInfo(*pReqId);
+ delete pArg;
+ return r;
+ }
if (pReq)
{
else
{
r = pAppManagerImpl->LaunchApp(__appId, pArg);
+ SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating to caller...", GetErrorMessage(r));
delete pArg;
}
+ return E_SUCCESS;
+
CATCH:
+ delete pArg;
+ delete pReqId;
+ delete pReqInfo;
return r;
}
const String* pColumn = null;
int id = 0;
result r = E_SUCCESS;
- SysLog(NID_APP, "[DC_CALLER] SqlDataControl SELECT");
+ SysLog(NID_APP, "[DC_CALLER_SEND] SqlDataControl SELECT");
ArrayList* pArgList = new ArrayList();
pArgList->Construct();
"[E_INVALID_ARG] The specified pColumnList parameter is empty.");
pArgList->Add(*(new String(Integer::ToString(columnCount)))); // list(1): selected column count
- SysLog(NID_APP, "[DC_CALLER] selected column count: %d", columnCount);
+ SysLog(NID_APP, "[DC_CALLER_SEND] selected column count: %d", columnCount);
int i = 0;
while (i < columnCount) // list(2): column list
pArgList->Add(*(new String(*pColumn)));
argSize += pColumn->GetLength() * sizeof(wchar_t);
- SysLog(NID_APP, "[DC_CALLER] column[%d]: %ls", i, pColumn->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] column[%d]: %ls", i, pColumn->GetPointer());
i++;
}
}
{
pArgList->Add(*(new String(*pWhere)));
argSize += pWhere->GetLength() * sizeof(wchar_t);
- SysLog(NID_APP, "[DC_CALLER] pWhere: %ls", pWhere->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pWhere: %ls", pWhere->GetPointer());
}
else
{
{
pArgList->Add(*(new String(*pOrder)));
argSize += pOrder->GetLength() * sizeof(wchar_t);
- SysLog(NID_APP, "[DC_CALLER] pOrder: %ls", pOrder->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pOrder: %ls", pOrder->GetPointer());
}
else
{
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "[DC_CALLER] dataId: %ls, pColumnList: 0x%x, pWhere: 0x%x, pOrder: 0x%x, reqId: %d, pageNo: %d, countPerPage: %d",
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, pColumnList: 0x%x, pWhere: 0x%x, pOrder: 0x%x, reqId: %d, pageNo: %d, countPerPage: %d",
dataId.GetPointer(), pColumnList, pWhere, pOrder, reqId, pageNo, countPerPage);
// fall through
_SqlDataControlImpl::SqlDataControlCallback(void* data, _AppArg* pArg, _AppArg* pResArg, service_result_e res, int prop)
{
ArrayList* pResultList = null;
- ArrayList* pOrigList = null;
String* pResult = null;
- String* pRequestType = null;
- String* pReqId = null;
String* pProviderId = null;
String* pDataId = null;
String* pErrorMessage = null;
_DataControlResultSetEnumerator* pResultSetEnum = null;
int requestType = 0;
int reqId = 0;
+ int launchReqId = 0;
int providerRes = 0;
bool providerResult = true;
- bundle* origBundle = null;
+ //bundle* origBundle = null;
bundle* resBundle = null;
_SqlDataControlEventArg* pEventArg = null;
+ const char* p = null;
result r = E_SUCCESS;
SysTryReturnResult(NID_APP, pResArg != null, E_INVALID_ARG, "Empty result callback.");
resBundle = pResArg->GetBundle();
if (resBundle)
{
- //ISqlDataControlResponseListener* pListener = static_cast< ISqlDataControlResponseListener* >(data);
- _SqlDataControlEvent* pSqlDataControlEvent = static_cast< _SqlDataControlEvent* >(data);
+ p = appsvc_get_data(resBundle, OSP_K_REQUEST_ID);
+ SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ reqId = atoi(p);
+ Integer key(reqId);
+
+ _DataControlManager* pDcMgr = static_cast< _DataControlManager* >(data);
+ _DataControlRequestInfo* pReqInfo = pDcMgr->GetRequestInfo(key);
+ SysTryCatch(NID_APP, pReqInfo != null, r = E_SYSTEM, E_SYSTEM,
+ "[E_SYSTEM] Failed to get request info");
+
+ _SqlDataControlEvent* pSqlDataControlEvent = dynamic_cast< _SqlDataControlEvent* >(pReqInfo->GetEvent());
+ SysTryCatch(NID_APP, pSqlDataControlEvent != null, r = E_SYSTEM, E_SYSTEM,
+ "[E_SYSTEM] invalid request info");
+
+ pDcMgr->RemoveRequestInfo(key);
if (pSqlDataControlEvent != null && typeid(pSqlDataControlEvent) == typeid(_SqlDataControlEvent*))
{
- const char* p = null;
-
// result list
pResultList = _AppArg::GetListN(resBundle, OSP_K_ARG);
SysTryCatch(NID_APP, pResultList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
- pResult = dynamic_cast <String*>(pResultList->GetAt(0));
+ pResult = dynamic_cast <String*>(pResultList->GetAt(0)); // result list[0]
SysTryCatch(NID_APP, pResult, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
Integer::Parse(*pResult, providerRes);
providerResult = static_cast< bool >(providerRes);
- pErrorMessage = dynamic_cast< String* >(pResultList->GetAt(1));
+ pErrorMessage = dynamic_cast< String* >(pResultList->GetAt(1)); // result list[1]
SysTryCatch(NID_APP, pErrorMessage, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
pErrorMsg = new (std::nothrow) String(*pErrorMessage);
SysTryCatch(NID_APP, pErrorMsg, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] The memory is insufficient.");
- origBundle = pArg->GetBundle();
-
// request info
- p = appsvc_get_data(origBundle, OSP_K_DATACONTROL_REQUEST_TYPE);
- SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
- pRequestType = new (std::nothrow) String(p);
- SysTryCatch(NID_APP, pRequestType, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[E_OUT_OF_MEMORY] The memory is insufficient.");
- Integer::Parse(*pRequestType, requestType);
+ //origBundle = pArg->GetBundle();
- p = appsvc_get_data(origBundle, OSP_K_REQUEST_ID);
+ p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_REQUEST_TYPE);
SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
- pReqId = new (std::nothrow) String(p);
- SysTryCatch(NID_APP, pReqId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[E_OUT_OF_MEMORY] The memory is insufficient.");
- Integer::Parse(*pReqId, reqId);
+ requestType = atoi(p);
- p = appsvc_get_data(origBundle, OSP_K_DATACONTROL_PROVIDER);
+ p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_PROVIDER);
SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
pProviderId = new (std::nothrow) String(p);
SysTryCatch(NID_APP, pProviderId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] The memory is insufficient.");
- pOrigList = _AppArg::GetListN(origBundle, OSP_K_ARG);
- SysTryCatch(NID_APP, pOrigList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
- pDataId = dynamic_cast <String*>(pOrigList->GetAt(0));
- SysTryCatch(NID_APP, pDataId, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_DATA);
+ SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ pDataId = new (std::nothrow) String(p);
+ SysTryCatch(NID_APP, pDataId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
- SysLog(NID_APP, "providerResult: %ld, requestType: %d, reqId: %d, providerId: %ls, dataId: %ls, errorMsg: %ls ",
+ SysLog(NID_APP, "[DC_CALLER_RECV] provider result: %ld, requestType: %d, reqId: %d, providerId: %ls, dataId: %ls, errorMsg: %ls ",
providerRes, requestType, reqId, pProviderId->GetPointer(), pDataId->GetPointer(), pErrorMsg->GetPointer());
switch (static_cast <_DataControlRequestType>(requestType))
goto CATCH;
}
- SysLog(NID_APP, "tempPath: %ls", pTmpPath->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_RECV] tempPath: %ls", pTmpPath->GetPointer());
if (pTmpPath->Equals(L"NoResultSet", true) == false) // Result set exists
{
pResultSetEnum->SetPath(*pTmpPath);
pResultList->RemoveAll(true);
delete pResultList;
-
- pOrigList->RemoveAll(true);
- delete pOrigList;
-
- delete pRequestType;
- delete pReqId;
delete pProviderId;
}
}
+ p = appsvc_get_data(pArg->GetBundle(), OSP_K_REQUEST_ID);
+ SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
+ launchReqId = atoi(p);
+
// Remove the request count
- SysLog(NID_APP, "Remove a launch request: reqId: %d", reqId);
- _AppControlManager::GetInstance()->RemoveLaunchRequest(reqId);
+ SysLog(NID_APP, "Remove a launch request: reqId: %d", launchReqId);
+ _AppControlManager::GetInstance()->RemoveLaunchRequest(launchReqId);
return E_SUCCESS;
pResultList->RemoveAll(true);
delete pResultList;
}
-
- if (pOrigList)
- {
- pOrigList->RemoveAll(true);
- delete pOrigList;
- }
-
- delete pRequestType;
- delete pReqId;
delete pProviderId;
return r;
int id = 0;
int i = 0;
result r = E_SUCCESS;
- SysLog(NID_APP, "[DC_CALLER] SqlDataControl INSERT");
+ SysLog(NID_APP, "[DC_CALLER_SEND] SqlDataControl INSERT");
columnCount = insertMap.GetCount();
SysTryReturnResult(NID_APP, columnCount > 0, E_INVALID_ARG, "The specified insertMap parameter is empty.");
long long argSize = dataId.GetLength() * sizeof(wchar_t);
pArgList->Add(*(new String(Integer::ToString(columnCount)))); // list(1): inserted column count
- SysLog(NID_APP, "[DC_CALLER] inserted column count: %d", columnCount);
+ SysLog(NID_APP, "[DC_CALLER_SEND] inserted column count: %d", columnCount);
IMapEnumerator* pMapEnum = const_cast< IMap* >(&insertMap)->GetMapEnumeratorN();
while (pMapEnum->MoveNext() == E_SUCCESS) // list(2): column-value pairs
"[E_INVALID_ARG] The object is not String class.");
pArgList->Add(*(new String(*pColumn)));
- SysLog(NID_APP, "[DC_CALLER] pColumn[%d]: %ls", i, pColumn->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pColumn[%d]: %ls", i, pColumn->GetPointer());
String* pValue = dynamic_cast< String* >(pMapEnum->GetValue());
SysTryCatch(NID_APP, pValue != null, r = E_INVALID_ARG, E_INVALID_ARG,
"[E_INVALID_ARG] The object is not String class.");
pArgList->Add(*(new String(*pValue)));
- SysLog(NID_APP, "[DC_CALLER] pValue[%d]: %ls", i, pValue->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pValue[%d]: %ls", i, pValue->GetPointer());
argSize += pColumn->GetLength() * sizeof(wchar_t);
argSize += pValue->GetLength() * sizeof(wchar_t);
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "[DC_CALLER] dataId: %ls, insertMap: 0x%x, reqId: %d", dataId.GetPointer(), &insertMap, reqId);
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, insertMap: 0x%x, reqId: %d", dataId.GetPointer(), &insertMap, reqId);
// fall through
CATCH:
pArgList->RemoveAll(true);
delete pArgList;
-
delete pMapEnum;
return r;
int id = 0;
int i = 0;
result r = E_SUCCESS;
- SysLog(NID_APP, "[DC_CALLER] SqlDataControl UPDATE");
+ SysLog(NID_APP, "[DC_CALLER_SEND] SqlDataControl UPDATE");
columnCount = updateMap.GetCount();
SysTryReturnResult(NID_APP, columnCount > 0, E_INVALID_ARG, "The specified insertMap parameter is empty.");
long long argSize = dataId.GetLength() * sizeof(wchar_t);
pArgList->Add(*(new String(Integer::ToString(columnCount)))); // list(1): updated column count
- SysLog(NID_APP, "[DC_CALLER] updated column count: %d", columnCount);
+ SysLog(NID_APP, "[DC_CALLER_SEND] updated column count: %d", columnCount);
IMapEnumerator* pMapEnum = const_cast< IMap* >(&updateMap)->GetMapEnumeratorN();
while (pMapEnum->MoveNext() == E_SUCCESS) // list(2): column-value pairs
"[E_INVALID_ARG] The object is not String class.");
pArgList->Add(*(new String(*pColumn)));
- SysLog(NID_APP, "[DC_CALLER] pColumn[%d]: %ls", i, pColumn->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pColumn[%d]: %ls", i, pColumn->GetPointer());
String* pValue = dynamic_cast< String* >(pMapEnum->GetValue());
SysTryCatch(NID_APP, pValue != null, r = E_INVALID_ARG, E_INVALID_ARG,
"[E_INVALID_ARG] The object is not String class.");
pArgList->Add(*(new String(*pValue)));
- SysLog(NID_APP, "[DC_CALLER] pValue[%d]: %ls", i, pValue->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pValue[%d]: %ls", i, pValue->GetPointer());
argSize += pColumn->GetLength() * sizeof(wchar_t);
argSize += pValue->GetLength() * sizeof(wchar_t);
{
pArgList->Add(*(new String(*pWhere)));
argSize += pWhere->GetLength() * sizeof(wchar_t);
- SysLog(NID_APP, "[DC_CALLER] pWhere: %ls", pWhere->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pWhere: %ls", pWhere->GetPointer());
}
else
{
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "[DC_CALLER] dataId: %ls, updateMap: 0x%x, pWhere: 0x%x, reqId: %d",
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, updateMap: 0x%x, pWhere: 0x%x, reqId: %d",
dataId.GetPointer(), &updateMap, pWhere, reqId);
// fall through
CATCH:
pArgList->RemoveAll(true);
delete pArgList;
-
delete pMapEnum;
return r;
int id = 0;
result r = E_SUCCESS;
- SysLog(NID_APP, "[DC_CALLER] SqlDataControl DELETE");
+ SysLog(NID_APP, "[DC_CALLER_SEND] SqlDataControl DELETE");
ArrayList* pArgList = new ArrayList();
pArgList->Construct();
{
pArgList->Add(*(new String(*pWhere)));
argSize += pWhere->GetLength() * sizeof(wchar_t);
- SysLog(NID_APP, "[DC_CALLER] pWhere: %ls", pWhere->GetPointer());
+ SysLog(NID_APP, "[DC_CALLER_SEND] pWhere: %ls", pWhere->GetPointer());
}
else
{
reqId = static_cast< RequestId >(id);
- SysLog(NID_APP, "[DC_CALLER] dataId: %ls, pWhere: 0x%x, reqId: %d", dataId.GetPointer(), pWhere, reqId);
+ SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, pWhere: 0x%x, reqId: %d", dataId.GetPointer(), pWhere, reqId);
// fall through
CATCH:
#define OSP_K_APPID "__OSP_APPID__"
#define OSP_K_REQUEST_ID "__OSP_REQUEST_ID__"
#define OSP_K_APPCONTROL_INTERNAL_OPERATION "__OSP_APPCONTROL_INTERNAL_INTERNAL_OPERATION__"
-#define OSP_K_DATACONTROL_PROVIDER "__OSP_DATACONTROL_PROVIDER__"
+#define OSP_K_DATACONTROL_PROVIDER "__OSP_DATACONTROL_PROVIDER__"
+#define OSP_K_DATACONTROL_DATA "__OSP_DATACONTROL_DATA__"
#define OSP_K_DATACONTROL_REQUEST_TYPE "__OSP_DATACONTROL_REQUEST_TYPE__"
/**
UpdateRequestId(__pBundle, reqId);
}
+ void UpdateKeyValue(const char* pKey, const Tizen::Base::String& value)
+ {
+ UpdateKeyValue(__pBundle, pKey, value);
+ }
+
result UpdateWindowHandle(long handle)
{
return UpdateWindowHandle(__pBundle, handle);
static void UpdateRequestId(bundle* b, int reqId);
+ static void UpdateKeyValue(bundle* b, const char* pKey, const Tizen::Base::String& value);
+
static result UpdateWindowHandle(bundle* b, long handle);
static Tizen::Base::Collection::ArrayList* GetListN(bundle* b, const char* key);
result LaunchPkg(_AppMessageImpl& msg, const char* pkg_name, const char* op, const char* mime, const char* uri, AppSvcResFn pCb, void* data);
+ result LaunchPkg(_AppMessageImpl& msg, const Tizen::Base::String& package, const Tizen::Base::String& opId, const Tizen::Base::String* pUri, const Tizen::Base::String* pMime, AppSvcResFn pCb, void* data);
+
int Launch(_AppMessageImpl& msg, const char* pkg_name, const char* op, const char* mime, const char* uri, AppSvcResFn pCb, void* data);
result LaunchAppWithCondition(const AppId& appId, const Tizen::Base::String& condition, Tizen::Base::Collection::IList* pArgs);
static bool IsAllowedAppControl(const wchar_t aTable[][2][64], int count, const Tizen::Base::String& aId, const Tizen::Base::String& oId);
+ static AppId GetAliasAppId(const AppId& appId);
+
static result GetMimeFromExt(const Tizen::Base::String& ext, Tizen::Base::String& out);
void RemoveLaunchRequest(int req);
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FAppPkgPackageLicenseManager.cpp
- * @brief This is the implementation for the PackageLicenseManager class.
- */
-#include <FBaseErrorDefine.h>
-#include <FBase_StringConverter.h>
-#include <string.h>
-#include <FSec_AccessController.h>
-#include <FAppPkgPackageLicenseManager.h>
-#include <FBaseSysLog.h>
-
-#include <drm-oem-intel.h>
-
-using namespace Tizen::Base;
-using namespace Tizen::Security;
-
-namespace Tizen { namespace App { namespace Package
-{
-
-PackageLicenseManager::PackageLicenseManager(void)
-{
-}
-
-PackageLicenseManager::~PackageLicenseManager(void)
-{
-}
-
-result
-PackageLicenseManager::GenerateDrmLicenseRequest(const Tizen::Base::String& licenseRequestInfo, Tizen::Base::String& licenseRequest, Tizen::Base::String& licenseUrl)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- return r;
-}
-
-result
-PackageLicenseManager::SaveDrmLicense(const Tizen::Base::String& rightObject)
-{
- result r = E_SUCCESS;
- char* pRo = null;
- int ret = 0;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- pRo = _StringConverter::CopyToCharArrayN(rightObject);
- SysAssertf(pRo != null, "[PackageLicenseManager] pRo is null");
-
- ret = drm_oem_intel_install_license(pRo, strlen(pRo));
-
- if(ret == 1)
- {
- SysLog(NID_APP, "SaveDrmLicense() called, ro successfully saved.");
- }
- else
- {
- SysLog(NID_APP, "SaveDrmLicense() called, failed.");
- r = E_INVALID_DATA;
- }
-
-CATCH:
- delete [] pRo;
- return r;
-}
-
-Tizen::Base::TimeSpan
-PackageLicenseManager::GetRemainingTimeUntilDrmExpiration(const Tizen::App::PackageId& pkgId)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- TimeSpan temp(9999,9999,9999);
-
- return temp;
-}
-
-result
-PackageLicenseManager::SaveLicenseInfoForPackage(const Tizen::Base::String& licenseInfo)
-{
- result r = E_SUCCESS;
- char* pCek = null;
- int ret = 0;
-
- r = _AccessController::CheckUserPrivilege(_PRV_PACKAGELICENSEMANAGER);
- SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
- pCek = _StringConverter::CopyToCharArrayN(licenseInfo);
- SysAssertf(pCek !=null, "[PackageLicenseManager] pCek is null");
-
- ret = drm_oem_intel_install_cek(pCek, strlen(pCek));
-
- if(ret == 1)
- {
- SysLog(NID_APP, "SaveLicenseInfoForApp() called, ro successfully saved.");
- }
- else
- {
- SysLog(NID_APP, "SaveLicenseInfoForApp() called, failed.");
- r = E_INVALID_DATA;
- }
-
-CATCH:
- delete [] pCek;
- return r;
-}
-
-}}} // Tizen::App::Package
long value = 0;
int radix = 0;
+ int startIndex = 0;
+ int minLength = 2;
wchar_t* pEnd = null;
String str(s);
+ if (s[0] == L'-')
+ {
+ startIndex = 1;
+ minLength = 3;
+ }
+
// Find radix
- if (s[0] == L'#')
+ if (s[startIndex] == L'#')
{
radix = Character::RADIX_HEXADECIMAL;
// Remove '#'
- str.Remove(0, 1);
+ str.Remove(startIndex, 1);
}
- else if (s[0] == L'0' && (s.GetLength() >= 2))
+ else if (s[startIndex] == L'0' && (s.GetLength() >= minLength))
{
- if (s[1] == L'x' || s[1] == L'X')
+ if (s[startIndex + 1] == L'x' || s[startIndex + 1] == L'X')
{
radix = Character::RADIX_HEXADECIMAL;
}
namespace Tizen { namespace Io
{
+static const int _DATACONTROL_PACKET_INDEX_COLUMNCOUNT = 1;
+
_DataControlResultSetImpl::_DataControlResultSetImpl(RequestId reqId)
: __constructed(true)
, __pageNo(1)
{
String tempFilePath(_DATACONTROL_RESULTSET_DIR);
String columnName;
- String* pAppId = null;
- String* pRequestType = null;
- String* pReqId = null;
+ String appId;
+ String reqType;
+ String callerReqId;
String* pNo = null;
String* pCount = null;
String* pColumnCount = null;
SysAssertf(__constructed == true, "Not yet constructed. Construct() should be called before use.\n\n");
_AppControlManager* pAppMgr = _AppControlManager::GetInstance();
- SysTryReturnResult(NID_APP, pAppMgr, E_SYSTEM, "Failed to get instance.");
+ SysTryReturnResult(NID_IO, pAppMgr, E_SYSTEM, "Failed to get instance.");
- _ResultInfo* pResultInfo = pAppMgr->__resultManager.FindItem(static_cast< int >(__reqId));
- SysTryReturnResult(NID_APP, pResultInfo, E_OBJ_NOT_FOUND,
+ _ResultInfo* pResultInfo = pAppMgr->__resultManager.FindItem(static_cast< int >(__reqId)); // provider reqId
+ SysTryReturnResult(NID_IO, pResultInfo, E_OBJ_NOT_FOUND,
"The data control request specified with the reqId (%ld) did not exist.", __reqId);
const _AppArg& arg = pResultInfo->arg;
- std::unique_ptr<ArrayList, AllElementsDeleter> pList(arg.GetArgListN(0));
- SysTryReturnResult(NID_APP, pList, E_SYSTEM, "Invalid result object.");
-
// key-based request
- pAppId = dynamic_cast< String* >(pList->GetAt(0)); // key[0]
- SysTryReturnResult(NID_APP, pAppId, E_SYSTEM, "Invalid request.");
-
- pRequestType = dynamic_cast< String* >(pList->GetAt(1)); // key[1]
- SysTryReturnResult(NID_APP, pRequestType, 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);
- SysTryReturnResult(NID_APP, requestType == _DATACONTROL_REQUEST_TYPE_SQL_QUERY, E_INVALID_ARG,
+ SysTryReturnResult(NID_IO, requestType == _DATACONTROL_REQUEST_TYPE_SQL_QUERY, E_INVALID_ARG,
"The reqId should be for the data control query request.");
- pReqId = dynamic_cast< String* >(pList->GetAt(2)); // key[2]
- SysTryReturnResult(NID_APP, pReqId, E_SYSTEM, "Invalid request.");
+ appId = arg.GetCallerAppId();
+ callerReqId = arg.GetValue(OSP_K_REQUEST_ID);
// list-based request
- pColumnCount = dynamic_cast< String* >(pList->GetAt(5));
- SysTryReturnResult(NID_APP, pColumnCount, E_SYSTEM, "Invalid result object.");
+ std::unique_ptr< ArrayList, AllElementsDeleter > pList(_AppArg::GetListN(arg.GetBundle(), OSP_K_ARG));
+ SysTryReturnResult(NID_IO, pList, E_SYSTEM, "Invalid result object.");
+
+ pColumnCount = dynamic_cast< String* >(pList->GetAt(_DATACONTROL_PACKET_INDEX_COLUMNCOUNT));
+ SysTryReturnResult(NID_IO, pColumnCount, E_SYSTEM, "Invalid result object.");
Integer::Parse(*pColumnCount, columnCount);
- pageNoIndex = 5 + columnCount + 2 + 1;
+ pageNoIndex = _DATACONTROL_PACKET_INDEX_COLUMNCOUNT + columnCount + 2 + 1;
pNo = dynamic_cast< String* >(pList->GetAt(pageNoIndex));
- SysTryReturnResult(NID_APP, pNo, E_SYSTEM, "Invalid result object.");
+ SysTryReturnResult(NID_IO, pNo, E_SYSTEM, "Invalid result object.");
Integer::Parse(*pNo, pageNo);
pCount = dynamic_cast< String* >(pList->GetAt(pageNoIndex + 1));
- SysTryReturnResult(NID_APP, pCount, E_SYSTEM, "Invalid result object.");
+ SysTryReturnResult(NID_IO, pCount, E_SYSTEM, "Invalid result object.");
Integer::Parse(*pCount, countPerPage);
this->SetCapacity(pageNo, countPerPage);
- tempFilePath.Append(*pAppId);
- tempFilePath.Append(*pReqId);
+ tempFilePath.Append(appId);
+ tempFilePath.Append(callerReqId);
__tmpPath = tempFilePath;
+ SysLog(NID_IO, "[DC_PROV_SEND] temp file path: %ls", tempFilePath.GetPointer());
// initialize
r = pDbEnum->Reset();
if (r == E_OUT_OF_RANGE) // the previous pages do not exist
{
__result = E_OUT_OF_RANGE;
- SysTryReturnResult(NID_APP, false, E_SUCCESS, "Out of range error.");
+ SysTryReturnResult(NID_IO, false, E_SUCCESS, "Out of range error.");
}
SysTryReturnResult(NID_IO, !IsFailed(r), E_DATABASE,
"The database engine has failed to enumerator result set.");
if (r == E_OUT_OF_RANGE) // the specific page is empty
{
__result = E_OUT_OF_RANGE;
- SysTryReturnResult(NID_APP, false, E_SUCCESS, "Out of range error.");
+ SysTryReturnResult(NID_IO, false, E_SUCCESS, "Out of range error.");
}
SysTryReturnResult(NID_IO, !IsFailed(r), E_DATABASE,
"The database engine has failed to enumerate the result set.");
__pCurrentRow(null),
__columnCount(0),
__rowCount(0),
- __currentRowIndex(-1)
+ __currentRowIndex(-1),
+ __dataSetDeleted(0)
{
}
_DataSetEnumeratorImpl::~_DataSetEnumeratorImpl(void)
{
-
+ if (__dataSetDeleted == 0)
+ {
+ __pEnumImplList->Remove(*this);
+ }
}
result
_DataSetEnumeratorImpl::MoveNext(void)
{
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
if (__currentRowIndex +1 == __rowCount)
return E_OUT_OF_RANGE;
_DataSetEnumeratorImpl::MovePrevious(void)
{
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
if (__currentRowIndex == 0)
return E_OUT_OF_RANGE;
_DataSetEnumeratorImpl::MoveFirst(void)
{
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
__currentRowIndex = 0;
__pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
_DataSetEnumeratorImpl::MoveLast(void)
{
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
__currentRowIndex = __rowCount -1;
__pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
_DataSetEnumeratorImpl::Reset(void)
{
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
__currentRowIndex = -1;
__pCurrentRow = null;
result r = E_SUCCESS;
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
"Given column index is out of range.");
SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
result r = E_SUCCESS;
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
"Given column index is out of range.");
SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
result r = E_SUCCESS;
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
"Given column index is out of range.");
SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
result r = E_SUCCESS;
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
"Given column index is out of range.");
SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
ByteBuffer* pBuffer = null;
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
"Given column index is out of range.");
SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
ByteBuffer* pBuffer = null;
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
"Given column index is out of range.");
SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
String* pStr = null;
SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The instance is not constructed or the dataset is already been deleted.");
+ "The Object is not constructed.");
+ SysTryReturnResult(NID_IO, __dataSetDeleted != 1, E_INVALID_STATE,
+ "The dataset is already been deleted.");
SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
"Given column index is out of range.");
SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
int
_DataSetEnumeratorImpl::GetColumnCount(void) const
{
- SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
- "The Object is not constructed or the dataset is already been deleted.");
+ SysTryReturn(NID_IO, __pDataSet != null, -1, E_INVALID_STATE,
+ "[E_INVALID_STATE] The Object is not constructed.");
+ SysTryReturn(NID_IO, __dataSetDeleted != 1, -1, E_INVALID_STATE,
+ "[E_INVALID_STATE] The dataset is already been deleted.");
return __columnCount;
}
DbColumnType type = DB_COLUMNTYPE_UNDEFINED;
SysTryReturn(NID_IO, __pDataSet != null, DB_COLUMNTYPE_UNDEFINED, E_INVALID_STATE,
- "[E_INVALID_STATE] The instance is not constructed or the dataset is already been deleted.");
-
+ "[E_INVALID_STATE] The instance is not constructed.");
+ SysTryReturn(NID_IO, __dataSetDeleted != 1, DB_COLUMNTYPE_UNDEFINED, E_INVALID_STATE,
+ "[E_INVALID_STATE] The dataset is already been deleted.");
SysTryReturn(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, DB_COLUMNTYPE_UNDEFINED, E_INVALID_ARG,
"[E_INVALID_ARG] Given column index is out of range.");
_DataSetEnumeratorImpl::GetColumnName(int columnIndex) const
{
SysTryReturn(NID_IO, __pDataSet != null, null, E_INVALID_STATE,
- "[E_INVALID_STATE] The instance is not constructed or the dataset is already been deleted.");
-
+ "[E_INVALID_STATE] The instance is not constructed.");
+ SysTryReturn(NID_IO, __dataSetDeleted != 1, null, E_INVALID_STATE,
+ "[E_INVALID_STATE] The dataset is already been deleted.");
SysTryReturn(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, null, E_INVALID_ARG,
"[E_INVALID_ARG] Given column index is out of range.");
int bytes = 0;
SysTryReturn(NID_IO, __pDataSet != null, -1, E_INVALID_STATE,
- "[E_INVALID_STATE] The instance is not constructed or the dataset is already been deleted.");
-
+ "[E_INVALID_STATE] The instance is not constructed.");
+ SysTryReturn(NID_IO, __dataSetDeleted != 1, -1, E_INVALID_STATE,
+ "[E_INVALID_STATE] The dataset is already been deleted.");
SysTryReturn(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, -1, E_INVALID_ARG,
"[E_INVALID_ARG] Given column index is out of range.");
-
SysTryReturn(NID_IO, __pCurrentRow != null, -1, E_INVALID_STATE,
"[E_INVALID_STATE] The method has tried to fetch the column data of a result set that is not activated.");
_DataSetImpl::~_DataSetImpl(void)
{
+ for (int i = 0; i< __enumImplList.GetCount() ; i++)
+ (static_cast<_DataSetEnumeratorImpl*>(__enumImplList.GetAt(i)))->__dataSetDeleted = 1;
+
delete __pDataSet;
delete __pColumnList;
delete __pColumnTypeList;
DataSetEnumerator*
_DataSetImpl::GetDataSetEnumeratorN(void)
{
+ result r;
+
unique_ptr<DataSetEnumerator> pDataSetEnum(_DataSetEnumeratorImpl::CreateDataSetEnumeratorInstanceN());
_DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pDataSet = __pDataSet;
//SysLog(NID_IO, "row count is %d, column count is %d", __rowCount, __columnCount);
+ r = __enumImplList.Add(_DataSetEnumeratorImpl::GetInstance(*pDataSetEnum));
+ SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Add to LinkedList Falied");
+
+ _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pEnumImplList = &__enumImplList;
+
return pDataSetEnum.release();
}
{
_RegistrySection* pRegSection = null;
_RegistryEntry* pRegEntry = null;
- IEnumerator* pEntryEnum = null;
result r = E_SUCCESS;
int listSize = 0;
int tmpEntryIndex = -1;
SysTryReturnVoidResult(NID_IO, entryIndex < entryListSize, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND]Entry not found.");
// read the entries for this section
- pEntryEnum = pRegSection->__entryList.GetEnumeratorN();
+ unique_ptr< IEnumerator > pEntryEnum(pRegSection->__entryList.GetEnumeratorN());
SysTryReturnVoidResult(NID_IO, pEntryEnum != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]Entry list is empty.");
tmpEntryIndex = entryIndex;
Tizen::Base::Collection::ArrayList* __pCurrentRow;
int __columnCount;
-
int __rowCount;
-
int __currentRowIndex;
+ int __dataSetDeleted;
+ Tizen::Base::Collection::LinkedList* __pEnumImplList;
friend class _DataSetImpl;
}; // _DataSetEnumeratorImpl
int __columnCount;
int __rowCount;
+
+ Tizen::Base::Collection::LinkedList __enumImplList;
}; // _DataSetImpl
}} // Tizen::Io
{
U_ICU_NAMESPACE::UnicodeString icuScriptStr;
String languageScriptName = _LocaleData::GetOspString(__icuLocale.getDisplayScript(icuScriptStr));
- languageName.Append(L" (");
- languageName.Append(languageScriptName);
- languageName.Append(L")");
+ languageName.Insert(L" (", languageName.GetLength());
+ languageName.Insert(languageScriptName, languageName.GetLength());
+ languageName.Insert(L")", languageName.GetLength());
}
return E_SUCCESS;
}
{
U_ICU_NAMESPACE::UnicodeString icuScriptStr;
String languageScriptName = _LocaleData::GetOspString(__icuLocale.getDisplayScript(otherLocale.__icuLocale, icuScriptStr));
- languageName.Append(L" (");
- languageName.Append(languageScriptName);
- languageName.Append(L")");
+ languageName.Insert(L" (", languageName.GetLength());
+ languageName.Insert(languageScriptName, languageName.GetLength());
+ languageName.Insert(L")", languageName.GetLength());
}
return E_SUCCESS;
}
String
_PrivacyInfoImpl::GetDisplayName(void) const
{
- return __privacyId;
+ String privacyURI = L"http://tizen.org/privacy/";
+ String displayName;
+
+ __privacyId.SubString(privacyURI.GetLength(), displayName);
+
+ return displayName;
}
String
bool GetPrivacyAppPackageListNCallback(const char *package_id, void* user_data)
{
- result r = E_SUCCESS;
ArrayList* pList = static_cast < ArrayList* >(user_data);
pList->Add(new String(package_id));
SettingInfo::SetWallpaper(const String& filePath)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetWallpaper(filePath);
}
result
SettingInfo::SetRingtone(const String& filePath)
{
- result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
+ result r = E_SUCCESS;
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetRingtone(filePath);
}
result
SettingInfo::SetVolume(const String& soundCategory, int level)
{
- result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
+ result r = E_SUCCESS;
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetVolume(soundCategory, level);
}
SettingInfo::GetValueForPrivilegedKey(const String& key, bool& value)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMSETTING_READ);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTINGMANAGER_READ);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::GetValueForPrivilegedKey(key, value);
}
SettingInfo::SetValue(const String& key, bool value)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetValue(key, value);
}
SettingInfo::SetValue(const String& key, int value)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetValue(key, value);
}
SettingInfo::SetValue(const String& key, String value)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
-
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetValue(key, value);
}
SettingInfo::SetValueForPrivilegedKey(const String& key, bool value)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMSETTING_WRITE);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTINGMANAGER_WRITE);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
}
SettingInfo::SetValueForPrivilegedKey(const String& key, String value)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMSETTING_WRITE);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTINGMANAGER_WRITE);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
}
SettingInfo::ResetToFactoryDefault(void)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMSETTING_WRITE);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTINGMANAGER_WRITE);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::ResetToFactoryDefault();
}
result
+SettingInfo::SetValueAsync(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
+{
+ result r = E_SUCCESS;
+ r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
+ return _SettingInfoImpl::SetValueAsync(key, value, listener);
+}
+
+result
SettingInfo::SetValueAsyncForPrivilegedKey(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
{
result r = E_SUCCESS;
- r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMSETTING_WRITE);
- SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SettingInfoImpl::SetValueAsyncForPrivilegedKey(key, value, listener);
}
result
SystemInfo::GetPlatformVersion(String& platformVersion)
{
- result r = _AccessController::CheckUserPrivilege(_PRV_PLATFORMINFO);
+ result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEM);
SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SystemInfoImpl::GetPlatformVersion(platformVersion);
}
result
SystemInfo::GetBuildInfo(String& buildInfo)
{
- result r = _AccessController::CheckUserPrivilege(_PRV_PLATFORMINFO);
+ result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEM);
SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SystemInfoImpl::GetBuildInfo(buildInfo);
}
result
SystemInfo::GetNativeApiVersion(String& nativeApiVersion)
{
- result r = _AccessController::CheckUserPrivilege(_PRV_PLATFORMINFO);
+ result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEM);
SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SystemInfoImpl::GetNativeApiVersion(nativeApiVersion);
}
result
SystemInfo::GetWebApiVersion(String& webApiVersion)
{
- result r = _AccessController::CheckUserPrivilege(_PRV_PLATFORMINFO);
+ result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEM);
SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
return _SystemInfoImpl::GetWebApiVersion(webApiVersion);
}
{
Cancel();
}
+
+ if(__pEvent != null)
+ {
+ delete __pEvent;
+ __pEvent = null;
+ }
}
result
if(period > 0)
{
+ SysLog(NID_SYS, "It is repeated alarm and period time is %d minutes", period);
ret = alarmmgr_set_repeat_mode(pAlarmInfo, ALARM_REPEAT_MODE_REPEAT, period * _SECOND_OF_MINUTE);
SysTryCatch(NID_SYS, ret == ALARMMGR_RESULT_SUCCESS, r = E_SYSTEM, r, "It is failed to set repeat mode");
}
- ret = alarmmgr_set_type(pAlarmInfo, 0x04/*ALARM_TYPE_NOLAUNCH*/);
+ ret = alarmmgr_set_type(pAlarmInfo, ALARM_TYPE_NOLAUNCH);
SysTryCatch(NID_SYS, ret == ALARMMGR_RESULT_SUCCESS, r = E_SYSTEM, r, "It is failed to set repeat mode");
ret = alarmmgr_add_alarm_appsvc_with_localtime(pAlarmInfo,(void *)pBundle, &reservedAlarmId);
#include <runtime_info.h>
#include <vconf.h>
+#include <FAppApp.h>
#include <FBaseRtEvent.h>
#include <FBaseRtIEventArg.h>
#include <FBaseRtIEventListener.h>
}
char command[512] = {0,};
+ char fileName[512] = {0,};
long long size = 0;
int ret = 0;
- sprintf(command, "du -sk -P %s >> /tmp/size_of_directory.tmp", path);
+ Tizen::App::App* pApp = Tizen::App::App::GetInstance();
+ if(pApp == null)
+ {
+ return 0;
+ }
+
+ String appId(pApp->GetAppId());
+ unique_ptr <char> appIdPath(_StringConverter::CopyToCharArrayN(appId));
+
+ ret = sprintf(fileName, "/tmp/size_of_directory_%s.tmp", appIdPath.get());
+ if(ret < 1)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to write file path.");
+ return 0;
+ }
+
+ ret = sprintf(command, "rm -rf %s", fileName);
+ if(ret < 1)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
+ return 0;
+ }
+
+ ret = system(command);
- system("rm -rf /tmp/size_of_directory.tmp");
- system(command);
+ if(ret == -1)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
+ }
+
+ ret = sprintf(command, "du -skb -P %s >> %s", path, fileName);
+ if(ret < 1)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to write du command.");
+ return 0;
+ }
+
+ ret = system(command);
+ if(ret == -1)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
+ return 0;
+ }
FILE* pFile = null;
- pFile = fopen("/tmp/size_of_directory.tmp", "r");
+ pFile = fopen(fileName, "r");
if(pFile == null)
{
return 0;
}
- ret = fscanf(pFile, "%lld", &size);
+ ret = fscanf(pFile, "%lld", &size);
if(ret < 1)
{
if(pFile != null)
{
fclose(pFile);
}
- system("rm -rf /tmp/size_of_directory.tmp");
+
+ ret = sprintf(command, "rm -rf %s", fileName);
+ if(ret < 1)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to write remove command.");
+ return 0;
+ }
+
+ ret = system(command);
+ if(ret == -1)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to execute command[%s].", command);
+ }
+
+
return size;
}
{
if(listener != null)
{
- SysLog(NID_SYS, "%x", listener);
- runtimeInfoEvent.AddListener(*listener, false);
+ runtimeInfoEvent.AddListener(*listener);
}
int thr_id = 0;
{
if(listener != null)
{
- SysLog(NID_SYS, "test %x", listener);
+ SysLog(NID_SYS, "listener instance is %x.", listener);
runtimeInfoEvent.AddListener(*listener);
}
pEventArg->DirectoryPath = directoryPath;
thr_id = pthread_create(&p_thread, null, GetDirectorySizeAsync, pEventArg);
- SysLog(NID_SYS, "%d", thr_id);
+ SysLog(NID_SYS, "Thread id is %d.", thr_id);
pthread_detach(p_thread);
}
return SetOnService(_SETTING_COMMAND_SET_STRING_PRIV, key, requestValue);
}
+
+result
+_SettingClient::SetValueAsync(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
+{
+ result r = E_SUCCESS;
+ String requestValue;
+
+ SysTryReturnResult(NID_SYS, __asyncEventList.ContainsKey(key) == false, E_IN_PROGRESS, "Required key[%ls] is already in progress.", key.GetPointer());
+
+ if(value == true)
+ {
+ requestValue.Append("true");
+ }
+ else
+ {
+ requestValue.Append("false");
+ }
+
+ r = SetOnService(_SETTING_COMMAND_SET_BOOL_ASYNC, key, requestValue);
+
+ if(r == E_SUCCESS)
+ {
+ if(listener != null)
+ {
+ _SettingAsyncEvent* pEvent = new (std::nothrow) _SettingAsyncEvent();
+ pEvent->AddListener(*listener);
+
+ __asyncEventList.Add(new String(key), pEvent);
+ }
+ }
+
+ return r;
+}
+
result
_SettingClient::SetValueAsyncForPrivilegedKey(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
{
if(r == E_SUCCESS)
{
- _SettingAsyncEvent* pEvent = new (std::nothrow) _SettingAsyncEvent();
- pEvent->AddListener(*listener);
+ if(listener != null)
+ {
+ _SettingAsyncEvent* pEvent = new (std::nothrow) _SettingAsyncEvent();
+ pEvent->AddListener(*listener);
- __asyncEventList.Add(new String(key), pEvent);
+ __asyncEventList.Add(new String(key), pEvent);
+ }
}
return r;
String response;
result r = GetOnService(_SETTING_COMMAND_SUPPORTED, key, response);
+ SysLog(NID_SYS, "HasKey result key:%ls, %ls", key.GetPointer(), response.GetPointer());
if(response == L"1" && r == E_SUCCESS)
{
return true;
result SetValue(const Tizen::Base::String& key, const bool& value);
result SetValueForPrivilegedKey(const Tizen::Base::String& key, bool value);
+ result SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
result SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
result SetValue(const Tizen::Base::String& key, const int& value);
result SetValue(const Tizen::Base::String& key, const Tizen::Base::String& value);
* @file FSys_SettingInfoImpl.cpp
* @brief This is the implementation file for _SysSettingInfoImpl class.
*/
-
+#include <system/system_settings.h>
+#include <FBase.h>
#include <FBaseColArrayList.h>
#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
#include <FBase_NativeError.h>
#include <FSys_SettingInfoImpl.h>
#include "FSys_SettingClient.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
using namespace Tizen::Io;
+using namespace Tizen::Base::Utility;
namespace Tizen { namespace System
{
static const wchar_t* _SETTING_NOTIFICATION_SOUND_VOLUME = L"NotificationSoundVolume";
static const wchar_t* _SETTING_SOUND_NOTIFICATION_VOLUME = L"http://tizen.org/setting/sound.notification.volume";
+//Font
+static const wchar_t* _FONT_SIZE = L"http://tizen.org/setting/font.size";
+static const wchar_t* _FONT_TYPE = L"http://tizen.org/setting/font.type";
+
+static const wchar_t* _FONT_SIZE_GIANT = L"giant";
+static const wchar_t* _FONT_SIZE_HUGE = L"huge";
+static const wchar_t* _FONT_SIZE_LARGE = L"large";
+static const wchar_t* _FONT_SIZE_MEDIUM = L"medium";
+static const wchar_t* _FONT_SIZE_SMALL = L"small";
+
+static const int _FONT_SIZE_GIANT_VCONF = 4;
+static const int _FONT_SIZE_HUGE_VCONF = 3;
+static const int _FONT_SIZE_LARGE_VCONF = 2;
+static const int _FONT_SIZE_MEDIUM_VCONF = 1;
+static const int _FONT_SIZE_SMALL_VCONF = 0;
+
+
static _SettingClient* pSettingClient = null;
void
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, Tizen::Base::String& value)
{
- InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ result r = E_SUCCESS;
+
+ if (key == _FONT_SIZE || key == _FONT_TYPE)
+ {
+ r = GetValueForFont(key, value);
+ }
+ else
+ {
+ InitSettingClient();
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->GetValue(key, value);
+ }
+ return r;
}
result
result
_SettingInfoImpl::SetValue(const String& key, String value)
{
- InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValue(key, value);
+ result r = E_SUCCESS;
+ if (key == _FONT_SIZE || key == _FONT_TYPE)
+ {
+ r = SetValueForFont(key, value);
+ }
+ else
+ {
+ InitSettingClient();
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->SetValue(key, value);
+ }
+ return r;
}
result
}
result
+_SettingInfoImpl::SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
+{
+ InitSettingClient();
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueAsync(key, value, listener);
+}
+
+result
_SettingInfoImpl::SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
{
InitSettingClient();
return settinginfo.__pSettingInfoImpl;
}
+result
+_SettingInfoImpl::GetValueForFont(const Tizen::Base::String& key, Tizen::Base::String& value)
+{
+ result r = E_OBJ_NOT_FOUND;
+
+ if (key == _FONT_SIZE)
+ {
+ int fontSize = 0;
+ int res = 0;
+ res = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &fontSize);
+
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "It is failed to get font size.");
+
+ r = E_SUCCESS;
+ switch (fontSize)
+ {
+ case _FONT_SIZE_GIANT_VCONF:
+ value.Append(_FONT_SIZE_GIANT);
+ break;
+ case _FONT_SIZE_HUGE_VCONF:
+ value.Append(_FONT_SIZE_HUGE);
+ break;
+ case _FONT_SIZE_LARGE_VCONF:
+ value.Append(_FONT_SIZE_LARGE);
+ break;
+ case _FONT_SIZE_MEDIUM_VCONF:
+ value.Append(_FONT_SIZE_MEDIUM);
+ break;
+ case _FONT_SIZE_SMALL_VCONF:
+ value.Append(_FONT_SIZE_SMALL);
+ break;
+ default:
+ r = E_SYSTEM;
+ break;
+ }
+
+ }
+ else if (key == _FONT_TYPE)
+ {
+ r = E_SUCCESS;
+ char* pFontType = null;
+ int res = 0;
+ res = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &pFontType);
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "Failed to get font type");
+ r = StringUtil::Utf8ToString(pFontType, value);
+ SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
+ free(pFontType);
+ }
+ return r;
+}
+
+
+result
+_SettingInfoImpl::SetValueForFont(const Tizen::Base::String& key, Tizen::Base::String value)
+{
+ result r = E_OBJ_NOT_FOUND;
+
+ if(key == _FONT_SIZE)
+ {
+ int fontSize = 0;
+ int res = 0;
+ String lowerValue = value;
+ lowerValue.ToLowerCase();
+ r = E_SUCCESS;
+
+ if (lowerValue == _FONT_SIZE_GIANT)
+ {
+ fontSize = _FONT_SIZE_GIANT_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_HUGE)
+ {
+ fontSize = _FONT_SIZE_HUGE_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_LARGE)
+ {
+ fontSize = _FONT_SIZE_LARGE_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_MEDIUM)
+ {
+ fontSize = _FONT_SIZE_MEDIUM_VCONF;
+ }
+ else if (lowerValue == _FONT_SIZE_SMALL)
+ {
+ fontSize = _FONT_SIZE_SMALL_VCONF;
+ }
+ else
+ {
+ return E_INVALID_ARG;
+ }
+ res = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, fontSize);
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "It is failed to set font size.");
+ }
+ else if(key == _FONT_TYPE)
+ {
+ char* pFontType = null;
+ int res = 0;
+ r = E_SUCCESS;
+
+ pFontType = _StringConverter::CopyToCharArrayN(value);
+ SysTryReturnResult(NID_SYS, pFontType != null, E_SYSTEM, "It is failed to convert String to string.");
+ SysLog(NID_SYS, "Requested font type is %s.", pFontType);
+ res = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, pFontType);
+ delete [] pFontType;
+ SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "It is failed to set font type.");
+ }
+ return r;
+}
+
+
} } // Tizen::System
static result SetValue(const Tizen::Base::String& key, int value);
static result SetValue(const Tizen::Base::String& key, Tizen::Base::String value);
static result SetValueForPrivilegedKey(const Tizen::Base::String& key, bool value);
+ static result SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
static result SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
static result SetValueForPrivilegedKey(const Tizen::Base::String& key, Tizen::Base::String value);
private:
static void InitSettingClient(void);
+ static result GetValueForFont(const Tizen::Base::String& key, Tizen::Base::String& value);
+ static result SetValueForFont(const Tizen::Base::String& key, Tizen::Base::String value);
};
} } // Tizen::Sys