usr
opt
*.o
-*.os
-*.exe
-packages
-binaries
-*.ipk
-*~
-/cmake-build
-/bin
-/build-stamp
-/configure-stamp
-tests/db/orm/dpl_orm_test.db-journal
-.cproject
-.project
-debian/files
-debian/wrt-commons-dbg.substvars
-debian/wrt-commons-dbg/*
-debian/wrt-commons-dev.substvars
-debian/wrt-commons-dev/*
-debian/wrt-commons.postinst.debhelper
-debian/wrt-commons.postrm.debhelper
-debian/wrt-commons.substvars
-debian/wrt-commons/*
+*.so
+*.so.*
+*.sql
+*.db
+*.db-journal
+*.pc
+
+CMakeCache.txt
+CMakeFiles
+install_manifest.txt
+cmake_install.cmake
+Makefile
+
+documentation.list
+modules/auto_save_dao/database_checksum_autosave.h
+modules/widget_dao/database_checksum.h
+modules/security_origin_dao/database_checksum_security_origin.h
+
SET(TARGET_AUTO_SAVE_DAO_LIB "wrt-commons-auto-save-dao")
SET(TARGET_AUTO_SAVE_DAO_RW_LIB "wrt-commons-auto-save-dao-rw")
SET(TARGET_AUTO_SAVE_DAO_RO_LIB "wrt-commons-auto-save-dao-ro")
+SET(TARGET_SECURITY_ORIGIN_DAO_LIB "wrt-commons-security-origin-dao")
SET(TARGET_DPL_UTILS_EFL "lib${PROJECT_NAME}-utils-efl")
SET(TARGET_DPL_ENCRYPTION "lib${PROJECT_NAME}-encryption")
#ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(widget_dao)
ADD_SUBDIRECTORY(auto_save_dao)
+ADD_SUBDIRECTORY(security_origin_dao)
ADD_SUBDIRECTORY(popup)
ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(support)
--- /dev/null
+# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# 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 CMakeLists.txt
+# @author Jihoon Chung (jihoon.chung@samsung.com)
+# @brief
+#
+
+configure_and_install_pkg(wrt-commons-security-origin-dao.pc)
+
--- /dev/null
+prefix=/usr
+exec_prefix=${prefix}
+
+libdir=${prefix}/lib
+includedir=${prefix}/include
+Name: wrt-commons-security-origin-dao
+Description: wrt-commons-security-origin-dao
+
+Version: @VERSION@
+Requires: dpl-efl
+Libs: -lwrt-commons-security-origin-dao -L${libdir}
+Cflags: -I${includedir}/dpl-efl
include(log/config.cmake)
ADD_SUBDIRECTORY(widget_dao)
ADD_SUBDIRECTORY(auto_save_dao)
+ADD_SUBDIRECTORY(security_origin_dao)
include(popup/config.cmake)
include(utils/config.cmake)
include(localization/config.cmake)
--- /dev/null
+ADD_CUSTOM_COMMAND( OUTPUT .security_origin.db
+ COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/.security_origin.db
+ COMMAND gcc -Wall -I${PROJECT_SOURCE_DIR}/modules/db/include -I${PROJECT_SOURCE_DIR}/modules/security_origin_dao/orm -E ${PROJECT_SOURCE_DIR}/modules/security_origin_dao/orm/security_origin_db_sql_generator.h | grep --invert-match "^#" > ${CMAKE_CURRENT_BINARY_DIR}/security_origin_db.sql
+ COMMAND sqlite3 ${CMAKE_CURRENT_BINARY_DIR}/.security_origin.db ".read ${CMAKE_CURRENT_BINARY_DIR}/security_origin_db.sql" || rm -f ${CMAKE_CURRENT_BINARY_DIR}/.security_origin.db
+ DEPENDS ${PROJECT_SOURCE_DIR}/modules/security_origin_dao/orm/security_origin_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/security_origin_dao/orm/security_origin_db
+ )
+
+ADD_CUSTOM_COMMAND( OUTPUT .security_origin.db-journal
+ COMMAND touch
+ ARGS ${CMAKE_CURRENT_BINARY_DIR}/.security_origin.db-journal
+ )
+
+ADD_CUSTOM_TARGET(Sqlite3DbSecurityOrigin ALL DEPENDS .security_origin.db .security_origin.db-journal)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/security_origin_db.sql DESTINATION share/wrt-engine/)
+
+###############################################################################
+
+INCLUDE(FindPkgConfig)
+
+PKG_CHECK_MODULES(SECURITY_ORIGIN_DAO_DEPS
+ glib-2.0
+ REQUIRED)
+
+SET(SECURITY_ORIGIN_DAO_INCLUDE_DIRS
+ ${PROJECT_SOURCE_DIR}/modules/security_origin_dao/include
+ ${PROJECT_SOURCE_DIR}/modules/security_origin_dao/orm
+ ${PROJECT_SOURCE_DIR}/modules/core/include
+ ${PROJECT_SOURCE_DIR}/modules/db/include
+ ${PROJECT_SOURCE_DIR}/modules/log/include
+ ${PROJECT_SOURCE_DIR}/modules/widget_dao/include
+ ${SECURITY_ORIGIN_DAO_DEPS_INCLUDE_DIRS}
+)
+
+SET(SECURITY_ORIGIN_DAO_SOURCES
+ dao/security_origin_dao_types.cpp
+ dao/security_origin_database.cpp
+ dao/security_origin_dao.cpp
+)
+
+INCLUDE_DIRECTORIES(${SECURITY_ORIGIN_DAO_INCLUDE_DIRS})
+
+ADD_LIBRARY(${TARGET_SECURITY_ORIGIN_DAO_LIB} SHARED ${SECURITY_ORIGIN_DAO_SOURCES})
+SET_TARGET_PROPERTIES(${TARGET_SECURITY_ORIGIN_DAO_LIB} PROPERTIES SOVERSION ${API_VERSION} VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${TARGET_SECURITY_ORIGIN_DAO_LIB} ${TARGET_DPL_EFL} ${TARGET_DPL_DB_EFL} ${TARGET_WRT_DAP_RO_LIB} ${SECURITY_ORIGIN_DAO_DEPS_LIBRARIES})
+
+INSTALL(TARGETS ${TARGET_SECURITY_ORIGIN_DAO_LIB} DESTINATION lib)
+
+INSTALL(FILES
+ include/wrt-commons/security-origin-dao/security_origin_dao_types.h
+ include/wrt-commons/security-origin-dao/security_origin_database.h
+ include/wrt-commons/security-origin-dao/security_origin_dao.h
+ DESTINATION include/dpl-efl/wrt-commons/security-origin-dao
+)
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 security_origin_dao.cpp
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief This file contains the definition of security origin dao class.
+ */
+
+#include <wrt-commons/security-origin-dao/security_origin_database.h>
+#include <wrt-commons/security-origin-dao/security_origin_dao.h>
+#include <wrt-commons/security-origin-dao/security_origin_dao_types.h>
+#include <orm_generator_security_origin.h>
+#include <dpl/foreach.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/WrtDatabase.h>
+#include <dpl/wrt-dao-ro/widget_config.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <sys/stat.h>
+#include <fstream>
+
+using namespace DPL::DB::ORM;
+using namespace DPL::DB::ORM::security_origin;
+
+namespace SecurityOriginDB {
+
+#define SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN Try
+
+#define SQL_CONNECTION_EXCEPTION_HANDLER_END(message) \
+ Catch(DPL::DB::SqlConnection::Exception::Base) { \
+ LogError(message); \
+ ReThrowMsg(SecurityOriginDAO::Exception::DatabaseError, \
+ message); \
+ }
+
+namespace {
+DPL::DB::SqlConnection::Flag::Option SECURITY_ORIGIN_DB_OPTION =
+ DPL::DB::SqlConnection::Flag::RW;
+DPL::DB::SqlConnection::Flag::Type SECURITY_ORIGIN_DB_TYPE =
+ DPL::DB::SqlConnection::Flag::UseLucene;
+const char* const SECURITY_ORIGIN_DB_NAME = ".security_origin.db";
+const char* const SECURITY_ORIGIN_DB_SQL_PATH =
+ "/usr/share/wrt-engine/security_origin_db.sql";
+
+std::string createDatabasePath(int widgetHandle)
+{
+ using namespace DPL::DB::ORM;
+ using namespace WrtDB::WidgetConfig;
+ using namespace WrtDB::GlobalConfig;
+
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ std::stringstream filename;
+ WrtDB::WidgetDAOReadOnly widgetDAO(widgetHandle);
+ DPL::Optional<DPL::String> pkgname = widgetDAO.getPkgname();
+
+ filename << GetWidgetPersistentStoragePath(*pkgname)
+ << "/"
+ << SECURITY_ORIGIN_DB_NAME;
+ return filename.str();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Fail to get database Path")
+
+}
+
+void checkDatabase(std::string databasePath)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ if (databasePath.empty()) {
+ ThrowMsg(SecurityOriginDAO::Exception::DatabaseError,
+ "Wrong database Path is passed");
+ }
+
+ struct stat buffer;
+ if (stat(databasePath.c_str(), &buffer) != 0) {
+
+ //Create fresh database
+ LogInfo("Creating database " << databasePath);
+
+ std::fstream file;
+ file.open(SECURITY_ORIGIN_DB_SQL_PATH, std::ios_base::in);
+ if (!file) {
+ ThrowMsg(SecurityOriginDAO::Exception::DatabaseError,
+ "Fail to get database Path");
+ }
+
+ std::stringstream ssBuffer;
+ ssBuffer << file.rdbuf();
+
+ file.close();
+
+ DPL::DB::SqlConnection con(databasePath,
+ SECURITY_ORIGIN_DB_TYPE,
+ SECURITY_ORIGIN_DB_OPTION);
+ con.ExecCommand(ssBuffer.str().c_str());
+ }
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Fail to get database Path")
+}
+}
+
+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()
+{
+ m_securityOriginDBInterface.DetachFromThread();
+}
+
+Result SecurityOriginDAO::getResult(const SecurityOriginData &securityOriginData)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ SECURITY_ORIGIN_DB_SELECT(select, SecurityOriginInfo, &m_securityOriginDBInterface);
+ select->Where(
+ And(And(And(Equals<SecurityOriginInfo::feature>(securityOriginData.feature),
+ Equals<SecurityOriginInfo::scheme>(securityOriginData.origin.scheme)),
+ Equals<SecurityOriginInfo::host>(securityOriginData.origin.host)),
+ Equals<SecurityOriginInfo::port>(securityOriginData.origin.port)));
+ SecurityOriginInfo::Select::RowList rows = select->GetRowList();
+
+ if (rows.empty()) {
+ return RESULT_UNKNOWN;
+ }
+ SecurityOriginInfo::Row row = rows.front();
+ return static_cast<Result>(row.Get_result());
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get result for security origin")
+}
+
+void SecurityOriginDAO::setSecurityOriginData(const SecurityOriginData &securityOriginData,
+ const Result result)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ ScopedTransaction transaction(&m_securityOriginDBInterface);
+ SecurityOriginInfo::Row row;
+ row.Set_feature(securityOriginData.feature);
+ row.Set_scheme(securityOriginData.origin.scheme);
+ row.Set_host(securityOriginData.origin.host);
+ row.Set_port(securityOriginData.origin.port);
+ row.Set_result(result);
+
+ if (true == hasResult(securityOriginData)) {
+ SECURITY_ORIGIN_DB_UPDATE(update,
+ SecurityOriginInfo,
+ &m_securityOriginDBInterface);
+ update->Values(row);
+ update->Execute();
+ } else {
+ SECURITY_ORIGIN_DB_INSERT(
+ insert,
+ SecurityOriginInfo,
+ &m_securityOriginDBInterface);
+ insert->Values(row);
+ insert->Execute();
+ }
+ transaction.Commit();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Fail to set security origin data")
+}
+
+bool SecurityOriginDAO::hasResult(const SecurityOriginData &securityOriginData)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ SECURITY_ORIGIN_DB_SELECT(select, SecurityOriginInfo, &m_securityOriginDBInterface);
+ select->Where(
+ And(And(And(Equals<SecurityOriginInfo::feature>(securityOriginData.feature),
+ Equals<SecurityOriginInfo::scheme>(securityOriginData.origin.scheme)),
+ Equals<SecurityOriginInfo::host>(securityOriginData.origin.host)),
+ Equals<SecurityOriginInfo::port>(securityOriginData.origin.port)));
+
+ SecurityOriginInfo::Select::RowList rows = select->GetRowList();
+
+ return !rows.empty();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get result for security origin")
+}
+
+#undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+#undef SQL_CONNECTION_EXCEPTION_HANDLER_END
+
+} // namespace SecurityOriginDB
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 security_origin_dao_types.cpp
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief This file contains the implementation of
+ * common data types for wrt_security_origin.db
+ */
+
+#include <wrt-commons/security-origin-dao/security_origin_dao_types.h>
+#include <dpl/log/log.h>
+
+namespace SecurityOriginDB {
+} // namespace SecurityOriginDB
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <wrt-commons/security-origin-dao/security_origin_database.h>
+
+DPL::Mutex g_securityOriginDBQueriesMutex;
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 securoty_origin_dao.h
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief This file contains the declaration of security origin dao
+ */
+#ifndef _SECURITY_ORIGIN_DAO_H_
+#define _SECURITY_ORIGIN_DAO_H_
+
+#include <dpl/db/thread_database_support.h>
+#include <wrt-commons/security-origin-dao/security_origin_dao_types.h>
+
+namespace SecurityOriginDB {
+
+class SecurityOriginDAO
+{
+ public:
+ class Exception
+ {
+ public:
+ DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
+ DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
+ DECLARE_EXCEPTION_TYPE(Base, DataNotExist)
+ };
+
+ explicit SecurityOriginDAO(int handle);
+ virtual ~SecurityOriginDAO();
+ Result getResult(const SecurityOriginData &securityOriginData);
+ void setSecurityOriginData(const SecurityOriginData &securityOriginData,
+ const Result result);
+ private:
+ std::string m_securityOriginDBPath;
+ DPL::DB::ThreadDatabaseSupport m_securityOriginDBInterface;
+ bool hasResult(const SecurityOriginData &securityOriginData);
+};
+
+} // namespace SecurityOriginDB
+
+#endif // _SECURITY_ORIGIN_DAO_H_
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 security_origin_dao_types.h
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief This file contains the declaration of
+ * common data types for security origin database.
+ */
+#ifndef _SECURITY_ORIGIN_DAO_TYPES_H_
+#define _SECURITY_ORIGIN_DAO_TYPES_H_
+
+#include <list>
+#include <dpl/string.h>
+
+namespace SecurityOriginDB {
+
+enum Feature
+{
+ FEATURE_GEOLOCATION = 0,
+ FEATURE_FILESYSTEM,
+ FEATURE_WEB_NOTIFICATION
+};
+
+enum Result
+{
+ RESULT_UNKNOWN = 0,
+ RESULT_USER_ALLOWED,
+ RESULT_USER_DENIED,
+ RESULT_EXCEPTION_ALLOWED,
+ RESULT_EXCEPTION_DENIED
+};
+
+struct Origin
+{
+ DPL::String scheme;
+ DPL::String host;
+ unsigned int port;
+
+ Origin(const DPL::String& Scheme,
+ const DPL::String& Host,
+ const unsigned int Port) :
+ scheme(Scheme),
+ host(Host),
+ port(Port)
+ {
+ }
+
+ bool operator== (const Origin& other) const
+ {
+ return (!DPL::StringCompare(scheme, other.scheme) &&
+ !DPL::StringCompare(host, other.host) &&
+ port == other.port);
+ }
+
+ bool operator!= (const Origin& other) const
+ {
+ return !(*this == other);
+ }
+};
+
+struct SecurityOriginData
+{
+ Feature feature;
+ Origin origin;
+
+ SecurityOriginData(const Feature features, const Origin& ori) :
+ feature(features),
+ origin(ori)
+ {
+ }
+
+ bool operator== (const SecurityOriginData& other) const
+ {
+ return !(origin == other.origin) &&
+ !(feature == other.feature);
+ }
+
+ bool operator!= (const SecurityOriginData& other) const
+ {
+ return !(*this == other);
+ }
+};
+
+} // namespace SecurityOriginDB
+
+#endif // _SECURITY_ORIGIN_DAO_TYPES_H_
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef _SECURITY_ORIGIN_DATABASE_H_
+#define _SECURITY_ORIGIN_DATABASE_H_
+
+#include <dpl/thread.h>
+#include <dpl/mutex.h>
+
+extern DPL::Mutex g_securityOriginDBQueriesMutex;
+
+#define SECURITY_ORIGIN_DB_INTERNAL(tlsCommand, InternalType, interface) \
+ static DPL::ThreadLocalVariable<InternalType> *tlsCommand ## Ptr = NULL; \
+ { \
+ DPL::Mutex::ScopedLock lock(&g_securityOriginDBQueriesMutex); \
+ if (!tlsCommand ## Ptr) { \
+ static DPL::ThreadLocalVariable<InternalType> tmp; \
+ tlsCommand ## Ptr = &tmp; \
+ } \
+ } \
+ DPL::ThreadLocalVariable<InternalType> &tlsCommand = *tlsCommand ## Ptr; \
+ if (tlsCommand.IsNull()) { tlsCommand = InternalType(interface); }
+
+#define SECURITY_ORIGIN_DB_SELECT(name, type, interface) \
+ SECURITY_ORIGIN_DB_INTERNAL(name, type::Select, interface)
+
+#define SECURITY_ORIGIN_DB_INSERT(name, type, interface) \
+ SECURITY_ORIGIN_DB_INTERNAL(name, type::Insert, interface)
+
+#define SECURITY_ORIGIN_DB_UPDATE(name, type, interface) \
+ SECURITY_ORIGIN_DB_INTERNAL(name, type::Update, interface)
+
+#define SECURITY_ORIGIN_DB_DELETE(name, type, interface) \
+ SECURITY_ORIGIN_DB_INTERNAL(name, type::Delete, interface)
+
+#endif // _SECURITY_ORIGIN_DATABASE_H_
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef _ORM_GENERATOR_SECURITY_ORIGIN_H_
+#define _ORM_GENERATOR_SECURITY_ORIGIN_H_
+
+#define ORM_GENERATOR_DATABASE_NAME security_origin_db_definitions
+#include <dpl/db/orm_generator.h>
+#undef ORM_GENERATOR_DATABASE_NAME
+
+#endif // _ORM_GENERATOR_SECURITY_ORIGIN_H_
--- /dev/null
+SQL(BEGIN TRANSACTION;)
+
+CREATE_TABLE(SecurityOriginInfo)
+ COLUMN_NOT_NULL(feature, INT, )
+ COLUMN_NOT_NULL(scheme, TEXT,DEFAULT '')
+ COLUMN_NOT_NULL(host, TEXT,DEFAULT '')
+ COLUMN_NOT_NULL(port, INT, DEFAULT 0)
+ COLUMN_NOT_NULL(result, INT, DEFAULT 0)
+ TABLE_CONSTRAINTS(PRIMARY KEY(feature,scheme,host,port))
+CREATE_TABLE_END()
+
+SQL(COMMIT;)
--- /dev/null
+DATABASE_START(security_origin)
+
+#include "security_origin_db"
+
+DATABASE_END()
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 security_origin_db_sql_generator.h
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief Macro definitions for generating the SQL
+ * input file from database definition.
+ */
+
+//Do not include this file directly! It is used only for SQL code generation.
+#include <dpl/db/orm_macros.h>
+
+#include "security_origin_db_definitions"