- WidgetUpdateInfo update = detectWidgetUpdate(configData,
- m_installerContext.widgetConfig.webAppType,
- m_installerContext.widgetConfig.tzAppid);
- ConfigureResult result = checkWidgetUpdate(update);
-
- // Validate tizenId
- regex_t reg;
- if(regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED)!=0){
- LogDebug("Regcomp failed");
- }
-
- if ((regexec(®,
- DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).c_str(),
- static_cast<size_t>(0), NULL, 0) != REG_NOERROR) ||
- (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig.tzPkgid)) &&
- result != ConfigureResult::Updated))
- {
- //it is true when tizenId does not fit REG_TIZENID_PATTERN
- LogError("tizen_id provided but not proper or pkgId directory exists");
- //TODO(t.iwanek): appId is unique, what about installation of abcdefghij.test1 and abcdefghij.test2?
- regfree(®);
- return ConfigureResult::Failed;
+ ConfigureResult result = ConfigureResult::Failed;
+ WidgetUpdateInfo update;
+
+ // checking installed web application
+ Try {
+ // checking existing application is installed
+ WidgetDAOReadOnly dao(m_installerContext.widgetConfig.tzAppid);
+ // no excpetion means, it isn't update mode
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_START_KEY,
+ PKGMGR_START_UPDATE);
+
+ update = detectWidgetUpdate(configData,
+ m_installerContext.widgetConfig.tzAppid);
+ result = checkWidgetUpdate(update);
+ if (result != ConfigureResult::Updated) {
+ // Already installed TizenAppId. return failed
+ return ConfigureResult::Failed_AlreadyInstalled;
+ }
+ if (!checkSupportRDSUpdate(configData)) {
+ return ConfigureResult::Failed_NotSupportRDSUpdate;
+ }
+ m_installerContext.isUpdateMode = true;
+ }
+ Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ result = ConfigureResult::Ok;
+ m_installerContext.isUpdateMode = false;
+
+ if (!validateTizenApplicationID(
+ m_installerContext.widgetConfig.tzAppid))
+ {
+ LogError("tizen application ID is already used");
+ return ConfigureResult::Failed_InvalidConfig;
+ }
+ if (!validateTizenPackageID(m_installerContext.widgetConfig.tzPkgid)) {
+ LogError("tizen package ID is already used");
+ return ConfigureResult::Failed_AlreadyInstalled;
+ }