[Release] wrt-commons_0.2.112
authorJihoon Chung <jihoon.chung@samsung.com>
Mon, 22 Apr 2013 09:23:38 +0000 (18:23 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Mon, 22 Apr 2013 09:24:15 +0000 (18:24 +0900)
14 files changed:
etc/wrt_commons_reset_db.sh
modules/core/include/dpl/optional_typedefs.h
modules/log/include/dpl/log/old_style_log_provider.h
modules/log/src/old_style_log_provider.cpp
modules/widget_dao/dao/config_parser_data.cpp
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/dao/widget_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h
modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h
modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h
modules/widget_dao/orm/wrt_db
packaging/wrt-commons.spec

index 7236341..fb2d4bf 100755 (executable)
@@ -18,6 +18,7 @@ rm -rf /opt/share/widget/system/*
 
 #Removing of widget desktop icons
 WIDGET_EXEC_PATH=/opt/usr/apps/
+WIDGET_PRELOAD_EXEC_PATH=/usr/apps/
 WIDGET_DESKTOP_PATH=/opt/share/applications/
 WRT_DB=/opt/dbspace/.wrt.db
 PLUGINS_INSTALLATION_REQUIRED_PATH=/opt/share/widget/
@@ -30,6 +31,7 @@ then
     do
         pkgId=`echo "$appid" | cut -f1 -d"."`
         rm -rf ${WIDGET_EXEC_PATH}${pkgId}
+        rm -rf ${WIDGET_PRELOAD_EXEC_PATH}${pkgId}
         widget_desktop_file="${WIDGET_DESKTOP_PATH}${appid}.desktop";
         if [ -f ${widget_desktop_file} ]; then
             rm -f $widget_desktop_file;
index 356060a..2a3e716 100644 (file)
@@ -22,6 +22,7 @@
 namespace DPL {
 typedef Optional<String> OptionalString;
 typedef Optional<int> OptionalInt;
+typedef Optional<unsigned int> OptionalUInt;
 typedef Optional<bool> OptionalBool;
 typedef Optional<float> OptionalFloat;
 } //namespace DPL
index becdc93..70e308a 100644 (file)
@@ -36,6 +36,7 @@ class OldStyleLogProvider :
     bool m_showWarning;
     bool m_showError;
     bool m_showPedantic;
+    bool m_printStdErr;
 
     static std::string FormatMessage(const char *message,
                                      const char *filename,
@@ -48,6 +49,12 @@ class OldStyleLogProvider :
                         bool showWarning,
                         bool showError,
                         bool showPedantic);
+    OldStyleLogProvider(bool showDebug,
+                        bool showInfo,
+                        bool showWarning,
+                        bool showError,
+                        bool showPedantic,
+                        bool printStdErr);
     virtual ~OldStyleLogProvider() {}
 
     virtual void Debug(const char *message,
index 84433af..b8060dd 100644 (file)
@@ -89,7 +89,22 @@ OldStyleLogProvider::OldStyleLogProvider(bool showDebug,
     m_showInfo(showInfo),
     m_showWarning(showWarning),
     m_showError(showError),
-    m_showPedantic(showPedantic)
+    m_showPedantic(showPedantic),
+    m_printStdErr(false)
+{}
+
+OldStyleLogProvider::OldStyleLogProvider(bool showDebug,
+                                         bool showInfo,
+                                         bool showWarning,
+                                         bool showError,
+                                         bool showPedantic,
+                                         bool printStdErr) :
+    m_showDebug(showDebug),
+    m_showInfo(showInfo),
+    m_showWarning(showWarning),
+    m_showError(showError),
+    m_showPedantic(showPedantic),
+    m_printStdErr(printStdErr)
 {}
 
 void OldStyleLogProvider::Debug(const char *message,
@@ -98,9 +113,15 @@ void OldStyleLogProvider::Debug(const char *message,
                                 const char *function)
 {
     if (m_showDebug) {
-        fprintf(stdout, "%s%s%s\n", DEBUG_BEGIN,
-                FormatMessage(message, filename, line,
-                              function).c_str(), DEBUG_END);
+        if (m_printStdErr) {
+            fprintf(stderr, "%s%s%s\n", DEBUG_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), DEBUG_END);
+        } else {
+            fprintf(stdout, "%s%s%s\n", DEBUG_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), DEBUG_END);
+        }
     }
 }
 
@@ -110,9 +131,15 @@ void OldStyleLogProvider::Info(const char *message,
                                const char *function)
 {
     if (m_showInfo) {
-        fprintf(stdout, "%s%s%s\n", INFO_BEGIN,
-                FormatMessage(message, filename, line,
-                              function).c_str(), INFO_END);
+        if (m_printStdErr) {
+            fprintf(stderr, "%s%s%s\n", INFO_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), INFO_END);
+        } else {
+            fprintf(stdout, "%s%s%s\n", INFO_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), INFO_END);
+        }
     }
 }
 
@@ -122,9 +149,15 @@ void OldStyleLogProvider::Warning(const char *message,
                                   const char *function)
 {
     if (m_showWarning) {
-        fprintf(stdout, "%s%s%s\n", WARNING_BEGIN,
-                FormatMessage(message, filename, line,
-                              function).c_str(), WARNING_END);
+        if (m_printStdErr) {
+            fprintf(stderr, "%s%s%s\n", WARNING_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), WARNING_END);
+        } else {
+            fprintf(stdout, "%s%s%s\n", WARNING_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), WARNING_END);
+        }
     }
 }
 
@@ -134,9 +167,15 @@ void OldStyleLogProvider::Error(const char *message,
                                 const char *function)
 {
     if (m_showError) {
-        fprintf(stdout, "%s%s%s\n", ERROR_BEGIN,
-                FormatMessage(message, filename, line,
-                              function).c_str(), ERROR_END);
+        if (m_printStdErr) {
+            fprintf(stderr, "%s%s%s\n", ERROR_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), ERROR_END);
+        } else {
+            fprintf(stdout, "%s%s%s\n", ERROR_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), ERROR_END);
+        }
     }
 }
 
@@ -146,9 +185,15 @@ void OldStyleLogProvider::Pedantic(const char *message,
                                    const char *function)
 {
     if (m_showPedantic) {
-        fprintf(stdout, "%s%s%s\n", PEDANTIC_BEGIN,
-                FormatMessage(message, filename, line,
-                              function).c_str(), PEDANTIC_END);
+        if (m_printStdErr) {
+            fprintf(stderr, "%s%s%s\n", PEDANTIC_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), PEDANTIC_END);
+        } else {
+            fprintf(stdout, "%s%s%s\n", PEDANTIC_BEGIN,
+                    FormatMessage(message, filename, line,
+                        function).c_str(), PEDANTIC_END);
+        }
     }
 }
 }
index 969e20b..4477344 100644 (file)
@@ -376,24 +376,6 @@ bool ConfigParserData::Setting::operator<=(const Setting& other) const
     return m_name <= other.m_name;
 }
 
-bool ConfigParserData::ServiceInfo::operator== (const ServiceInfo& info) const
-{
-    return m_src == info.m_src &&
-           m_operation == info.m_operation &&
-           m_scheme == info.m_scheme &&
-           m_mime == info.m_mime &&
-           m_disposition == info.m_disposition;
-}
-
-bool ConfigParserData::ServiceInfo::operator!= (const ServiceInfo& info) const
-{
-    return m_src != info.m_src ||
-           m_operation != info.m_operation ||
-           m_scheme != info.m_scheme ||
-           m_mime != info.m_mime ||
-           m_disposition != info.m_disposition;
-}
-
 bool ConfigParserData::AppControlInfo::operator== (const AppControlInfo& info) const
 {
     return m_src == info.m_src &&
index e5ca1af..553028f 100644 (file)
@@ -308,7 +308,7 @@ void WidgetDAO::registerWidgetInternal(
 
     registerWidgetSettings(widgetHandle, widgetRegInfo);
 
-    registerAppService(widgetHandle, widgetRegInfo);
+    registerAppControl(widgetHandle, widgetRegInfo);
 
     registerEncryptedResouceInfo(widgetHandle, widgetRegInfo);
 
@@ -674,10 +674,10 @@ void WidgetDAO::registerWidgetSettings(DbWidgetHandle widgetHandle,
     }
 }
 
-void WidgetDAO::insertApplicationServiceInfo(DbWidgetHandle handle,
+void WidgetDAO::insertAppControlInfo(DbWidgetHandle handle,
                                              DPL::String src,
                                              DPL::String operation,
-                                             DPL::String scheme,
+                                             DPL::String uri,
                                              DPL::String mime,
                                              unsigned index,
                                              unsigned disposition)
@@ -685,41 +685,26 @@ void WidgetDAO::insertApplicationServiceInfo(DbWidgetHandle handle,
     using namespace DPL::DB::ORM;
     using namespace DPL::DB::ORM::wrt;
 
-    ApplicationServiceInfo::Row row;
+    AppControlInfo::Row row;
 
     row.Set_app_id(handle);
-    row.Set_service_index(index);
+    row.Set_execute_index(index);
     row.Set_src(src);
     row.Set_operation(operation);
-    row.Set_scheme(scheme);
+    row.Set_uri(uri);
     row.Set_mime(mime);
     row.Set_disposition(disposition);
 
-    DO_INSERT(row, ApplicationServiceInfo);
+    DO_INSERT(row, AppControlInfo);
 }
 
-void WidgetDAO::registerAppService(DbWidgetHandle widgetHandle,
+void WidgetDAO::registerAppControl(DbWidgetHandle widgetHandle,
                                    const WidgetRegisterInfo &regInfo)
 {
     using namespace DPL::DB::ORM;
     using namespace DPL::DB::ORM::wrt;
     const ConfigParserData& widgetConfigurationInfo = regInfo.configInfo;
 
-    // appServiceList
-    FOREACH(ASIt, widgetConfigurationInfo.appServiceList)
-    {
-        ApplicationServiceInfo::Row row;
-        row.Set_app_id(widgetHandle);
-        row.Set_service_index(ASIt->m_index);
-        row.Set_src(ASIt->m_src);
-        row.Set_operation(ASIt->m_operation);
-        row.Set_scheme(ASIt->m_scheme);
-        row.Set_mime(ASIt->m_mime);
-        row.Set_disposition(static_cast<int>(ASIt->m_disposition));
-
-        DO_INSERT(row, ApplicationServiceInfo)
-    }
-
     // appControlList
     FOREACH(appControl_it, widgetConfigurationInfo.appControlList)
     {
@@ -733,7 +718,7 @@ void WidgetDAO::registerAppService(DbWidgetHandle widgetHandle,
         {
             FOREACH(uri_it, appControl_it->m_uriList)
             {
-                DPL::String scheme = *uri_it;
+                DPL::String uri = *uri_it;
 
                 if (!appControl_it->m_mimeList.empty())
                 {
@@ -741,20 +726,20 @@ void WidgetDAO::registerAppService(DbWidgetHandle widgetHandle,
                     {
                         DPL::String mime = *mime_it;
 
-                        insertApplicationServiceInfo(widgetHandle, src, operation, scheme, mime, index, disposition);
+                        insertAppControlInfo(widgetHandle, src, operation, uri, mime, index, disposition);
                     }
                 }
                 else
                 {
                     DPL::String mime = L"";
 
-                    insertApplicationServiceInfo(widgetHandle, src, operation, scheme, mime, index, disposition);
+                    insertAppControlInfo(widgetHandle, src, operation, uri, mime, index, disposition);
                 }
             }
         }
         else
         {
-            DPL::String scheme = L"";
+            DPL::String uri = L"";
 
             if (!appControl_it->m_mimeList.empty())
             {
@@ -762,14 +747,14 @@ void WidgetDAO::registerAppService(DbWidgetHandle widgetHandle,
                 {
                     DPL::String mime = *mime_it;
 
-                    insertApplicationServiceInfo(widgetHandle, src, operation, scheme, mime, index, disposition);
+                    insertAppControlInfo(widgetHandle, src, operation, uri, mime, index, disposition);
                 }
             }
             else
             {
                 DPL::String mime = L"";
 
-                insertApplicationServiceInfo(widgetHandle, src, operation, scheme, mime, index, disposition);
+                insertAppControlInfo(widgetHandle, src, operation, uri, mime, index, disposition);
             }
         }
     }
index 877b2cd..ae57410 100644 (file)
@@ -1066,39 +1066,39 @@ void WidgetDAOReadOnly::getWidgetSettings(
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get settings list")
 }
 
-void WidgetDAOReadOnly::getAppServiceList(
-    WidgetApplicationServiceList& outAppServiceList) const
+void WidgetDAOReadOnly::getAppControlList(
+    WidgetAppControlList& outAppControlList) const
 {
-    LogDebug("Getting getAppServiceList. Handle: " << m_widgetHandle);
+    LogDebug("Getting getAppControlList. Handle: " << m_widgetHandle);
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
     {
         ScopedTransaction transaction(&WrtDatabase::interface());
         CHECK_WIDGET_EXISTENCE(transaction, m_widgetHandle)
 
-        WRT_DB_SELECT(select, ApplicationServiceInfo, &WrtDatabase::interface())
-        select->Where(Equals<ApplicationServiceInfo::app_id>(m_widgetHandle));
+        WRT_DB_SELECT(select, AppControlInfo, &WrtDatabase::interface())
+        select->Where(Equals<AppControlInfo::app_id>(m_widgetHandle));
 
-        ApplicationServiceInfo::Select::RowList rows = select->GetRowList();
+        AppControlInfo::Select::RowList rows = select->GetRowList();
 
         if (rows.empty()) {
-            LogDebug("Application Service list is empty. Handle: " <<
+            LogDebug("AppControl list is empty. Handle: " <<
                      m_widgetHandle);
         }
 
         FOREACH(it, rows) {
-            WidgetApplicationService ret;
+            WidgetAppControl ret;
             ret.src = it->Get_src();
             ret.operation = it->Get_operation();
-            ret.scheme = it->Get_scheme();
+            ret.uri = it->Get_uri();
             ret.mime = it->Get_mime();
-            ret.disposition = static_cast<WidgetApplicationService::Disposition>(it->Get_disposition());
-            ret.index = it->Get_service_index();
-            outAppServiceList.push_back(ret);
+            ret.disposition = static_cast<WidgetAppControl::Disposition>(it->Get_disposition());
+            ret.index = it->Get_execute_index();
+            outAppControlList.push_back(ret);
         }
 
         transaction.Commit();
     }
-    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get access host list")
+    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get AppControl list")
 }
 
 PackagingType WidgetDAOReadOnly::getPackagingType() const
index 0ee8e52..1529d03 100644 (file)
@@ -322,7 +322,6 @@ enum SettingsType
     SETTINGS_TYPE_ALWAYS_ASK,
     SETTINGS_TYPE_OFF
 };
-} // namespace WrtDB
 
 struct WidgetSetting
 {
@@ -344,12 +343,15 @@ struct WidgetSetting
 typedef std::list<WidgetSetting> WidgetSettings;
 
 /**
- * @brief Widget Application Service
+ * @brief Widget AppControl
  *
- * Application sercvice describes details of behaviour
+ * Application control describes details of behaviour
  * when widget receives aul bundle data.
  */
-struct WidgetApplicationService
+namespace AppControlPrefix {
+    const char* const PROCESS_PREFIX = "-__CONTROL_PROCESS__";
+}
+struct WidgetAppControl
 {
     enum class Disposition {
         WINDOW = 0,
@@ -358,21 +360,21 @@ struct WidgetApplicationService
 
     DPL::String src;       /* start uri */
     DPL::String operation; /* service name */
-    DPL::String scheme;    /* scheme type*/
+    DPL::String uri;    /* scheme type*/
     DPL::String mime;      /* mime type */
     Disposition disposition;
     unsigned index;
 
-    bool operator== (const WidgetApplicationService& other) const
+    bool operator== (const WidgetAppControl& other) const
     {
         return src == other.src &&
                operation == other.operation &&
-               scheme == other.scheme &&
+               uri == other.uri &&
                mime == other.mime &&
                disposition == other.disposition;
     }
 };
 
-typedef std::list<WidgetApplicationService> WidgetApplicationServiceList;
-
+typedef std::list<WidgetAppControl> WidgetAppControlList;
+} // namespace WrtDB
 #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */
index a37e252..aa0c6b9 100644 (file)
@@ -157,39 +157,6 @@ class ConfigParserData
 
     typedef std::set<Setting> SettingsList;
 
-    /* ServiceInfo will be removed.
-     * ServiceInfo will be changed AppControl
-     */
-    struct ServiceInfo
-    {
-        enum class Disposition {
-            WINDOW = 0,
-            INLINE
-        };
-        ServiceInfo(
-            const DPL::String& src,
-            const DPL::String& operation,
-            const DPL::String& scheme,
-            const DPL::String& mime,
-            const Disposition dispos) :
-            m_src(src),
-            m_operation(operation),
-            m_scheme(scheme),
-            m_mime(mime),
-            m_disposition(dispos),
-            m_index(0)
-        {}
-        DPL::String m_src;
-        DPL::String m_operation;
-        DPL::String m_scheme;
-        DPL::String m_mime;
-        Disposition m_disposition;
-        unsigned m_index;
-
-        bool operator==(const ServiceInfo&) const;
-        bool operator!=(const ServiceInfo&) const;
-    };
-
     struct AppControlInfo
     {
         enum class Disposition {
@@ -211,7 +178,6 @@ class ConfigParserData
         bool operator!=(const AppControlInfo&) const;
     };
 
-    typedef std::list<ServiceInfo> ServiceInfoList; // It will be removed.
     typedef std::list<AppControlInfo> AppControlInfoList;
 
     typedef std::list<std::pair<DPL::String, DPL::String> > BoxSizeList;
@@ -327,8 +293,7 @@ class ConfigParserData
     DPL::OptionalString cspPolicy;
     DPL::OptionalString cspPolicyReportOnly;
 
-    //Application service model list
-    ServiceInfoList appServiceList; //It will be removed.
+    //AppControl model list
     AppControlInfoList appControlList;
 
     // For link shared directory
index 13cec1d..a2fa66a 100644 (file)
@@ -65,10 +65,7 @@ inline const char* GetUserInstalledWidgetPath()
  */
 inline const char* GetUserPreloadedWidgetPath()
 {
-    // temp
-    // return "/usr/apps";
-
-    return "/opt/usr/apps";
+    return "/usr/apps";
 }
 
 /**
index a37da85..b92cb38 100755 (executable)
@@ -748,13 +748,13 @@ class WidgetDAOReadOnly
     void getWidgetSettings(WidgetSettings& outWidgetSettings) const;
 
     /**
-     * This method gets application service list that define AUL value
+     * This method gets application control list that define AUL value
      *
      * @return See above comment
      * @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
      */
-    void getAppServiceList(
-        WidgetApplicationServiceList& outAppServiceList) const;
+    void getAppControlList(
+        WidgetAppControlList& outAppControlList) const;
 
     /**
      * This method returns the type of the package.
index 73348e9..b3c276a 100644 (file)
@@ -196,7 +196,7 @@ class WidgetDAO : public WidgetDAOReadOnly
     static void registerWidgetSettings(
         DbWidgetHandle widgetHandle,
         const WidgetRegisterInfo &regInfo);
-    static void registerAppService(
+    static void registerAppControl(
         DbWidgetHandle widgetHandle,
         const WidgetRegisterInfo &regInfo);
     static void registerEncryptedResouceInfo(
@@ -222,10 +222,10 @@ class WidgetDAO : public WidgetDAOReadOnly
     static void unregisterWidgetInternal(
         const TizenAppId & tzAppId);
 
-    static void insertApplicationServiceInfo(DbWidgetHandle handle,
+    static void insertAppControlInfo(DbWidgetHandle handle,
                                              DPL::String src,
                                              DPL::String operation,
-                                             DPL::String scheme,
+                                             DPL::String uri,
                                              DPL::String mime,
                                              unsigned index,
                                              unsigned disposition);
index 0c40a33..3a16855 100755 (executable)
@@ -312,17 +312,17 @@ CREATE_TABLE(SettingsList)
     )
 CREATE_TABLE_END()
 
-CREATE_TABLE(ApplicationServiceInfo)
+CREATE_TABLE(AppControlInfo)
     COLUMN_NOT_NULL(app_id,         INT,)
-    COLUMN_NOT_NULL(service_index,  INT,)
+    COLUMN_NOT_NULL(execute_index,  INT,)
     COLUMN_NOT_NULL(src,            TEXT,)
     COLUMN_NOT_NULL(operation,      TEXT,)
-    COLUMN_NOT_NULL(scheme,         TEXT,)
+    COLUMN_NOT_NULL(uri,            TEXT,)
     COLUMN_NOT_NULL(mime,           TEXT,)
     COLUMN_NOT_NULL(disposition,    TINYINT, DEFAULT 0)
 
     TABLE_CONSTRAINTS(
-        PRIMARY KEY(app_id, operation, scheme, mime)
+        PRIMARY KEY(app_id, operation, uri, mime)
         FOREIGN KEY(app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE
     )
 CREATE_TABLE_END()
index d63942a..b755015 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt-commons wrt-commons 0.2.110
+#git:framework/web/wrt-commons wrt-commons 0.2.112
 Name:       wrt-commons
 Summary:    Wrt common library
-Version:    0.2.110
+Version:    0.2.112
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0