#include <dpl/wrt-dao-ro/common_dao_types.h>
#include <sys/stat.h>
#include <fstream>
-/* GCC versions 4.7 had changes to the C++ standard. It
+/* GCC versions 4.7 had changes to the C++ standard. It
* no longer includes <unistd.h> to remove namespace pollution.
*/
#include <unistd.h>
const int WEB_APPLICATION_UID = 5000;
const int WEB_APPLICATION_GUID = 5000;
-std::string createDatabasePath(const WrtDB::WidgetPkgName &pkgName)
+std::string createDatabasePath(const WrtDB::TizenPkgId &pkgName)
{
std::stringstream filename;
return filename.str();
}
-std::string createDatabasePath(int widgetHandle)
-{
- using namespace DPL::DB::ORM;
- using namespace WrtDB::WidgetConfig;
- using namespace WrtDB::GlobalConfig;
-
- WrtDB::TizenAppId appid;
-
- Try
- {
- appid = WrtDB::WidgetDAOReadOnly::getTzAppId(widgetHandle);
- }
- Catch(DPL::DB::SqlConnection::Exception::Base) {
- LogError("Failed to get database Path");
- }
- return createDatabasePath(appid);
-}
-
void checkDatabase(std::string databasePath)
{
SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
}
}
-CertificateDAO::CertificateDAO(const WrtDB::WidgetPkgName &pkgName) :
+CertificateDAO::CertificateDAO(const WrtDB::TizenPkgId &pkgName) :
m_certificateDBPath(createDatabasePath(pkgName)),
m_certificateDBInterface(m_certificateDBPath, CERTIFICATE_DB_TYPE)
{
DECLARE_EXCEPTION_TYPE(Base, DataNotExist)
};
- explicit CertificateDAO(const WrtDB::WidgetPkgName &pkgName);
+ explicit CertificateDAO(const WrtDB::TizenPkgId &pkgName);
virtual ~CertificateDAO();
CertificateDataList getCertificateDataList();
Result getResult(const CertificateData &certificateData);
WrtDB::DbWidgetHandle widgetHandle,
const DPL::String &url);
DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
- const WrtDB::WidgetPkgName &pkgname,
+ const WrtDB::TizenAppId &tzAppId,
const DPL::String &url);
DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
WrtDB::WidgetDAOReadOnlyPtr dao,
WrtDB::DbWidgetHandle widgetHandle,
const DPL::String& file);
DPL::Optional<DPL::String> getFilePathInWidgetPackage(
- const WrtDB::WidgetPkgName &pkgname,
+ const WrtDB::TizenAppId &tzAppId,
const DPL::String& file);
DPL::Optional<DPL::String> getFilePathInWidgetPackage(
WrtDB::WidgetDAOReadOnlyPtr dao,
const DPL::String& file);
DPL::OptionalString getStartFile(WrtDB::DbWidgetHandle handle);
-DPL::OptionalString getStartFile(const WrtDB::WidgetPkgName & pkgname);
+DPL::OptionalString getStartFile(const WrtDB::TizenAppId & tzAppId);
DPL::OptionalString getStartFile(WrtDB::WidgetDAOReadOnlyPtr dao);
OptionalWidgetIcon getIcon(WrtDB::DbWidgetHandle widgetHandle);
-OptionalWidgetIcon getIcon(const WrtDB::WidgetPkgName & pkgname);
+OptionalWidgetIcon getIcon(const WrtDB::TizenAppId & tzAppId);
OptionalWidgetIcon getIcon(WrtDB::WidgetDAOReadOnlyPtr dao);
WidgetIconList getValidIconsList(
WrtDB::DbWidgetHandle widgetHandle);
WidgetIconList getValidIconsList(
- const WrtDB::WidgetPkgName &pkgname);
+ const WrtDB::TizenAppId &tzAppId);
WidgetIconList getValidIconsList(
WrtDB::WidgetDAOReadOnlyPtr dao);
OptionalWidgetStartFileInfo getStartFileInfo(
WrtDB::DbWidgetHandle widgetHandle);
OptionalWidgetStartFileInfo getStartFileInfo(
- const WrtDB::WidgetPkgName &pkgname);
+ const WrtDB::TizenAppId &tzAppId);
OptionalWidgetStartFileInfo getStartFileInfo(
WrtDB::WidgetDAOReadOnlyPtr dao);
WrtDB::WidgetLocalizedInfo getLocalizedInfo(WrtDB::DbWidgetHandle widgetHandle);
WrtDB::WidgetLocalizedInfo getLocalizedInfo(
- const WrtDB::WidgetPkgName & pkgname);
+ const WrtDB::TizenAppId & tzAppId);
WrtDB::WidgetLocalizedInfo getLocalizedInfo(WrtDB::WidgetDAOReadOnlyPtr dao);
}
}
DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
- const WrtDB::WidgetPkgName &pkgname,
+ const WrtDB::TizenAppId &tzAppId,
const DPL::String &url)
{
return getFilePathInWidgetPackageFromUrl(
- WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(pkgname)),
+ WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(tzAppId)),
url);
}
}
DPL::Optional<DPL::String> getFilePathInWidgetPackage(
- const WrtDB::WidgetPkgName &pkgname,
+ const WrtDB::TizenAppId &tzAppId,
const DPL::String& file)
{
return getFilePathInWidgetPackage(
- WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(pkgname)),
+ WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(tzAppId)),
file);
}
return GetFilePathInWidgetPackageInternal(dao->getPath(), file);
}
-DPL::OptionalString getStartFile(const WrtDB::WidgetPkgName & pkgname)
+DPL::OptionalString getStartFile(const WrtDB::TizenAppId & tzAppId)
{
- return getStartFile(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(pkgname)));
+ return getStartFile(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(tzAppId)));
}
DPL::OptionalString getStartFile(const WrtDB::DbWidgetHandle handle)
return DPL::OptionalString::Null;
}
-OptionalWidgetIcon getIcon(const WrtDB::WidgetPkgName & pkgname)
+OptionalWidgetIcon getIcon(const WrtDB::TizenAppId & tzAppId)
{
- return getIcon(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(pkgname)));
+ return getIcon(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(tzAppId)));
}
OptionalWidgetIcon getIcon(WrtDB::DbWidgetHandle widgetHandle)
WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(widgetHandle)));
}
-WidgetIconList getValidIconsList(const WrtDB::WidgetPkgName &pkgname)
+WidgetIconList getValidIconsList(const WrtDB::TizenAppId &tzAppId)
{
return getValidIconsList(
- WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(pkgname)));
+ WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(tzAppId)));
}
WidgetIconList getValidIconsList(WrtDB::WidgetDAOReadOnlyPtr dao)
}
OptionalWidgetStartFileInfo getStartFileInfo(
- const WrtDB::WidgetPkgName &pkgname)
+ const WrtDB::TizenAppId &tzAppId)
{
return getStartFileInfo(
- WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(pkgname)));
+ WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(tzAppId)));
}
OptionalWidgetStartFileInfo getStartFileInfo(WrtDB::WidgetDAOReadOnlyPtr dao)
return getLocalizedInfo(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(handle)));
}
-WidgetLocalizedInfo getLocalizedInfo(const WrtDB::WidgetPkgName & pkgname)
+WidgetLocalizedInfo getLocalizedInfo(const WrtDB::TizenAppId & tzAppId)
{
- return getLocalizedInfo(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(pkgname)));
+ return getLocalizedInfo(WidgetDAOReadOnlyPtr(new WidgetDAOReadOnly(tzAppId)));
}
WidgetLocalizedInfo getLocalizedInfo(WidgetDAOReadOnlyPtr dao)
const int WEB_APPLICATION_UID = 5000;
const int WEB_APPLICATION_GUID = 5000;
-std::string createDatabasePath(const WrtDB::WidgetPkgName &pkgName)
+std::string createDatabasePath(const WrtDB::TizenPkgId &pkgName)
{
std::stringstream filename;
return filename.str();
}
-std::string createDatabasePath(int widgetHandle)
-{
- using namespace DPL::DB::ORM;
- using namespace WrtDB::WidgetConfig;
- using namespace WrtDB::GlobalConfig;
-
- WrtDB::TizenAppId appid;
-
- Try
- {
- appid = WrtDB::WidgetDAOReadOnly::getTzAppId(widgetHandle);
- }
- Catch(DPL::DB::SqlConnection::Exception::Base) {
- LogError("Failed to get database Path");
- }
- return createDatabasePath(appid);
-}
-
void checkDatabase(std::string databasePath)
{
SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
}
}
-SecurityOriginDAO::SecurityOriginDAO(int handle) :
- m_securityOriginDBPath(createDatabasePath(handle)),
- m_securityOriginDBInterface(m_securityOriginDBPath, SECURITY_ORIGIN_DB_TYPE)
-{
- checkDatabase(m_securityOriginDBPath);
- m_securityOriginDBInterface.AttachToThread(SECURITY_ORIGIN_DB_OPTION);
-}
-
-SecurityOriginDAO::SecurityOriginDAO(const WrtDB::WidgetPkgName &pkgName) :
+SecurityOriginDAO::SecurityOriginDAO(const WrtDB::TizenPkgId &pkgName) :
m_securityOriginDBPath(createDatabasePath(pkgName)),
m_securityOriginDBInterface(m_securityOriginDBPath, SECURITY_ORIGIN_DB_TYPE)
{
DECLARE_EXCEPTION_TYPE(Base, DataNotExist)
};
- explicit SecurityOriginDAO(int handle) __attribute__((deprecated));
- explicit SecurityOriginDAO(const WrtDB::WidgetPkgName &pkgName);
+ explicit SecurityOriginDAO(const WrtDB::TizenPkgId &pkgName);
virtual ~SecurityOriginDAO();
SecurityOriginDataList getSecurityOriginDataList();
Result getResult(const SecurityOriginData &securityOriginData);
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed in getHandle")
}
-WidgetPkgName getTizenPkgIdByHandle(const DbWidgetHandle handle)
+TizenPkgId getTizenPkgIdByHandle(const DbWidgetHandle handle)
{
LogDebug("Getting TizenPkgId by DbWidgetHandle: " << handle);
ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
"Failed to get widget by handle");
}
- WidgetPkgName tzPkgid = rowList.front().Get_tizen_pkgid();
+ TizenPkgId tzPkgid = rowList.front().Get_tizen_pkgid();
return tzPkgid;
}
m_widgetHandle(WidgetDAOReadOnly::getHandle(widgetGUID))
{}
-WidgetDAOReadOnly::WidgetDAOReadOnly(DPL::String tzAppid) :
+WidgetDAOReadOnly::WidgetDAOReadOnly(TizenAppId tzAppid) :
m_widgetHandle(WidgetDAOReadOnly::getHandle(tzAppid))
{}
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed in getHandle")
}
-WidgetPkgName WidgetDAOReadOnly::getPkgName() const
-{
- return getTizenPkgIdByHandle(m_widgetHandle);
-}
-
-WidgetPkgName WidgetDAOReadOnly::getPkgName(const WidgetGUID GUID)
-{
- return getTizenPkgIdByHandle(getHandle(GUID));
-}
-
-WidgetPkgName WidgetDAOReadOnly::getPkgName(const DbWidgetHandle handle)
-{
- return getTizenPkgIdByHandle(handle);
-}
-
TizenAppId WidgetDAOReadOnly::getTzAppId() const
{
return getTizenAppIdByHandle(m_widgetHandle);
return getTizenAppIdByPkgId(tzPkgid);
}
+TizenPkgId WidgetDAOReadOnly::getTzPkgId() const
+{
+ return getTizenPkgIdByHandle(m_widgetHandle);
+}
+
PropertyDAOReadOnly::WidgetPropertyKeyList
WidgetDAOReadOnly::getPropertyKeyList() const
{
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get handle list")
}
-WidgetPkgNameList WidgetDAOReadOnly::getPkgnameList()
-{
- LogDebug("Getting Pkgname List ");
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
- return select->GetValueList<WidgetInfo::tizen_appid>();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get Pkgname list")
-}
-
TizenAppIdList WidgetDAOReadOnly::getTizenAppidList()
{
LogDebug("Getting Pkgname List ");
typedef int DbWidgetHandle;
typedef DPL::String TizenPkgId;
typedef DPL::String TizenAppId;
-typedef DPL::String WidgetPkgName;
/**
* Value of invalid widget handle
* @brief Default container with DbWidgetHandle's
*/
typedef std::list<DbWidgetHandle> DbWidgetHandleList;
-
-typedef std::list<WidgetPkgName> WidgetPkgNameList; //TODO: this cannot be null
- // -> appropriate changes in
- // db schema needed
-typedef std::list<TizenAppId> TizenAppIdList; //TODO: this cannot be null ->
- // appropriate changes in db
- // schema needed
+typedef std::list<TizenAppId> TizenAppIdList;
class WidgetDAOReadOnly; //forward declaration
typedef std::shared_ptr<WidgetDAOReadOnly> WidgetDAOReadOnlyPtr;
*/
WidgetDAOReadOnly(DbWidgetHandle widgetHandle);
WidgetDAOReadOnly(DPL::OptionalString widgetGUID);
- WidgetDAOReadOnly(DPL::String tzAppid);
+ WidgetDAOReadOnly(WrtDB::TizenAppId tzAppid);
/**
* Destructor
static TizenAppId getTzAppId(const TizenPkgId tzPkgid);
/**
- * Returns WidgetPkgName for the specified widget
+ * Returns TizenPkgId for the specified widget
*
- * @return pkgName;
+ * @return TizenPkgId;
* @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
* @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in
* DB table.
*/
- WidgetPkgName getPkgName() const;
- static WidgetPkgName getPkgName(const WidgetGUID GUID);
- static WidgetPkgName getPkgName(const DbWidgetHandle handle);
+ TizenPkgId getTzPkgId() const;
/**
* This method returns the root directory of widget resource.
static DbWidgetHandleList getHandleList();
/**
- * This method returns list of pkgname of installed packages
- * @return list of pkgname of installed packages
+ * This method returns list of tizen application list of installed packages
+ * @return list of TizenAppIdList of installed packages
*/
static TizenAppIdList getTizenAppidList();
- static WidgetPkgNameList getPkgnameList();
/**
* This method returns a list of all the installed widgets.