SET(TARGET_CERTIFICATE_DAO_LIB "wrt-commons-certificate-dao")
SET(TARGET_DPL_UTILS_EFL "lib${PROJECT_NAME}-utils-efl")
SET(TARGET_DPL_ENCRYPTION "lib${PROJECT_NAME}-encryption")
+SET(TARGET_I18N_DAO_RO_LIB "wrt-commons-i18n-dao-ro")
macro(configure_and_install_pkg PKG_FILE)
CONFIGURE_FILE(${PKG_FILE}.in ${PKG_FILE} @ONLY)
ADD_SUBDIRECTORY(support)
ADD_SUBDIRECTORY(encryption)
ADD_SUBDIRECTORY(certificate_dao)
+ADD_SUBDIRECTORY(i18n)
--- /dev/null
+# Copyright (c) 2012 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 Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+# @brief
+#
+
+configure_and_install_pkg(wrt-commons-i18n-dao-ro.pc)
--- /dev/null
+prefix=/usr
+exec_prefix=${prefix}
+
+libdir=${prefix}/lib
+includedir=${prefix}/include
+Name: wrt-commons-i18n-dao-ro
+Description: wrt-commons-i18n-dao-ro
+
+Version: @VERSION@
+Requires: dpl-efl
+Libs: -lwrt-commons-i18n-dao-ro -L${libdir}
+Cflags: -I${includedir}/dpl-efl
create_db $name $DB_PATH
done
-for name in wrt_custom_handler
+for name in wrt_custom_handler wrt_i18n
do
create_db $name $DB_USER_PATH
done
GVariant *parameters,
GDBusMethodInvocation *invocation)
{
- LogInfo("On method call: " << methodName);
+ LogDebug("On method call: " << methodName);
if (g_strcmp0(methodName, "echo") == 0)
{
const gchar* arg = NULL;
g_variant_get(parameters, "(&s)", &arg);
- LogInfo("Client said: " << arg);
+ LogDebug("Client said: " << arg);
gchar* response = g_strdup_printf(arg);
g_dbus_method_invocation_return_value(invocation,
virtual void OnEventReceived(const AsyncCallEvent &event)
{
- LogInfo("CLIENT: AsyncCallEvent received");
+ LogDebug("CLIENT: AsyncCallEvent received");
event.GetArg0().ConsumeArg(m_receivedData);
- LogInfo("CLIENT: Result from server: " << m_receivedData);
+ LogDebug("CLIENT: Result from server: " << m_receivedData);
if (m_receivedData != m_sentData)
LogError("Wrong data Received!");
{
if (dynamic_cast<DPL::FakeRpcConnection *>(event.GetArg1())){
++m_connections;
- LogInfo("CLIENT: Acquiring new fake connection");
+ LogDebug("CLIENT: Acquiring new fake connection");
m_rpcFakeConnection.reset(event.GetArg1());
//this is not used on this side
// m_rpcFakeConnection->DPL::EventSupport<AsyncCallEvent>::AddListener(this);
}
else{
++m_connections;
- LogInfo("CLIENT: Acquiring new unix connection");
+ LogDebug("CLIENT: Acquiring new unix connection");
m_rpcUnixConnection.reset(event.GetArg1());
m_rpcUnixConnection->DPL::EventSupport<AsyncCallEvent>::AddListener(this);
}
// Emit RPC function call
DPL::RPCFunction proc;
proc.AppendArg(m_sentData);
- LogInfo("CLIENT: Calling RPC function");
+ LogDebug("CLIENT: Calling RPC function");
m_rpcFakeConnection->AsyncCall(proc);
}
}
{
m_connections = 0;
// Attach RPC listeners
- LogInfo("CLIENT: Attaching connection established event");
+ LogDebug("CLIENT: Attaching connection established event");
m_rpcUnixClient.DPL::EventSupport<ConnectionEstablishedEvent>::AddListener(this);
m_rpcFakeClient.DPL::EventSupport<ConnectionEstablishedEvent>::AddListener(this);
// Open connection to server
- LogInfo("CLIENT: Opening connection to RPC");
+ LogDebug("CLIENT: Opening connection to RPC");
m_rpcUnixClient.Open(UNIX_RPC_NAME);
m_rpcFakeClient.Open(FAKE_RPC_NAME);
// Start message loop
- LogInfo("CLIENT: Starting thread event loop");
+ LogDebug("CLIENT: Starting thread event loop");
int ret = Exec();
if (m_rpcUnixConnection.get()){
- LogInfo("CLIENT: Removing Unix connection");
+ LogDebug("CLIENT: Removing Unix connection");
m_rpcUnixConnection->DPL::EventSupport<AsyncCallEvent>::RemoveListener(this);
m_rpcUnixConnection.reset();
}
- LogInfo("CLIENT: Closing");
+ LogDebug("CLIENT: Closing");
if (m_rpcFakeConnection.get()){
- LogInfo("CLIENT: Removing Fake connection");
+ LogDebug("CLIENT: Removing Fake connection");
//this is not used on this side
// m_rpcFakeConnection->DPL::EventSupport<AsyncCallEvent>::RemoveListener(this);
m_rpcFakeConnection.reset();
}
// Detach RPC client listener
- LogInfo("CLIENT: Detaching connection established event");
+ LogDebug("CLIENT: Detaching connection established event");
m_rpcUnixClient.DPL::EventSupport<ConnectionEstablishedEvent>::RemoveListener(this);
m_rpcFakeClient.DPL::EventSupport<ConnectionEstablishedEvent>::RemoveListener(this);
// Close RPC
- LogInfo("CLIENT: Closing RPC client");
+ LogDebug("CLIENT: Closing RPC client");
m_rpcUnixClient.CloseAll();
m_rpcFakeClient.Close();//not needed
// Quit application event occurred
virtual void OnEventReceived(const QuitEvent &/*event*/){
// Close RPC now
- LogInfo("SERVER: Closing RPC connection...");
+ LogDebug("SERVER: Closing RPC connection...");
// Detach RPC connection listeners
if (m_rpcUnixConnection.get()) {
m_rpcFakeConnection.reset();
}
- LogInfo("SERVER: Closing Server");
+ LogDebug("SERVER: Closing Server");
m_rpcUnixServer.CloseAll();
m_rpcFakeServer.CloseAll();//not needed
m_rpcUnixServer.DPL::EventSupport<ConnectionEstablishedEvent>::RemoveListener(this);
m_rpcFakeServer.DPL::EventSupport<ConnectionEstablishedEvent>::RemoveListener(this);
- LogInfo("SERVER: Server closed");
+ LogDebug("SERVER: Server closed");
Quit();
}
virtual void OnEventReceived(const AsyncCallEvent &event)
{
- LogInfo("SERVER: AsyncCallEvent received");
+ LogDebug("SERVER: AsyncCallEvent received");
int value;
event.GetArg0().ConsumeArg(value);
- LogInfo("SERVER: Result from client: " << value);
+ LogDebug("SERVER: Result from client: " << value);
// send back data to client (via fake)
// Emit RPC function call
DPL::RPCFunction proc;
proc.AppendArg(value);
- LogInfo("SERVER: Calling RPC function");
+ LogDebug("SERVER: Calling RPC function");
m_rpcUnixConnection->AsyncCall(proc);
}
{
// Save connection pointer
if (dynamic_cast<DPL::FakeRpcConnection *>(event.GetArg1())){
- LogInfo("SERVER: Acquiring Fake RPC connection");
+ LogDebug("SERVER: Acquiring Fake RPC connection");
m_rpcFakeConnection.reset(event.GetArg1());
m_rpcFakeConnection->DPL::EventSupport<AsyncCallEvent>::AddListener(this);
}
else{
- LogInfo("SERVER: Acquiring Unix RPC connection");
+ LogDebug("SERVER: Acquiring Unix RPC connection");
m_rpcUnixConnection.reset(event.GetArg1());
//this is not used on this side
// m_rpcUnixConnection->DPL::EventSupport<AsyncCallEvent>::AddListener(this);
: Application(argc, argv, "rpc")
{
// Attach RPC server listeners
- LogInfo("SERVER: Attaching connection established event");
+ LogDebug("SERVER: Attaching connection established event");
m_rpcUnixServer.DPL::EventSupport<ConnectionEstablishedEvent>::AddListener(this);
m_rpcFakeServer.DPL::EventSupport<ConnectionEstablishedEvent>::AddListener(this);
// Self touch
- LogInfo("SERVER: Touching controller");
+ LogDebug("SERVER: Touching controller");
Touch();
// Open RPC server
- LogInfo("SERVER: Opening server RPC");
+ LogDebug("SERVER: Opening server RPC");
m_rpcUnixServer.Open(UNIX_RPC_NAME);
m_rpcFakeServer.Open(FAKE_RPC_NAME);
// Run RPC client in thread
- LogInfo("SERVER: Starting RPC client thread");
+ LogDebug("SERVER: Starting RPC client thread");
m_thread.Run();
// Quit application automatically in few seconds
- LogInfo("SERVER: Sending control timed events");
+ LogDebug("SERVER: Sending control timed events");
DPL::ControllerEventHandler<CloseThreadEvent>::PostTimedEvent(CloseThreadEvent(), 2);
DPL::ControllerEventHandler<QuitEvent>::PostTimedEvent(QuitEvent(), 3);
}
virtual ~MyApplication()
{
// Quit thread
- LogInfo("SERVER: Quitting thread");
+ LogDebug("SERVER: Quitting thread");
}
};
int main(int argc, char *argv[])
{
- LogInfo("Starting");
+ LogDebug("Starting");
MyApplication app(argc, argv);
return app.Exec();
}
(void)event;
// Heart beat
- LogInfo("* Got metronome signal *");
+ LogDebug("* Got metronome signal *");
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent &event)
{
(void)event;
- LogInfo("Connection closed");
+ LogDebug("Connection closed");
// Must quit
Quit();
{
(void)event;
- LogInfo("Connection broken");
+ LogDebug("Connection broken");
// Must quit
Quit();
virtual void OnEventReceived(const DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent &event)
{
// Save connection pointer
- LogInfo("Connected to metronome server");
+ LogDebug("Connected to metronome server");
m_rpcConnection.reset(event.GetArg1());
// Attach event listeners
m_rpcClient.Open("127.0.0.1", 12345);
// Started
- LogInfo("Metronome client started");
+ LogDebug("Metronome client started");
}
virtual ~MetronomeClientApplication()
{
(void)event;
- LogInfo("Connection closed");
+ LogDebug("Connection closed");
// Remove connection from list
RemoveConnection(static_cast<DPL::AbstractRPCConnection *>(event.GetSender()));
{
(void)event;
- LogInfo("Connection broken");
+ LogDebug("Connection broken");
// Remove connection from list
RemoveConnection(static_cast<DPL::AbstractRPCConnection *>(event.GetSender()));
virtual void OnEventReceived(const DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent &event)
{
// Save connection pointer
- LogInfo("New connection");
+ LogDebug("New connection");
// Add nre connection to list
AddConnection(event.GetArg1());
DPL::ControllerEventHandler<SignalEvent>::PostTimedEvent(SignalEvent(), HEART_BEAT_INTERVAL);
// Started
- LogInfo("Metronome server started");
+ LogDebug("Metronome server started");
}
virtual ~MetronomeServerApplication()
{
(void)event;
- LogInfo("CLIENT: AsyncCallEvent received");
+ LogDebug("CLIENT: AsyncCallEvent received");
int value;
event.GetArg0().ConsumeArg(value);
- LogInfo("CLIENT: Result from server: " << value);
+ LogDebug("CLIENT: Result from server: " << value);
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent &event)
{
(void)event;
- LogInfo("CLIENT: ConnectionClosedEvent received");
+ LogDebug("CLIENT: ConnectionClosedEvent received");
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectionEvents::ConnectionBrokenEvent &event)
{
(void)event;
- LogInfo("CLIENT: ConnectionBrokenEvent received");
+ LogDebug("CLIENT: ConnectionBrokenEvent received");
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent &event)
{
// Save connection pointer
- LogInfo("CLIENT: Acquiring new connection");
+ LogDebug("CLIENT: Acquiring new connection");
m_rpcConnection.reset(event.GetArg1());
// Attach listener to new connection
- LogInfo("CLIENT: Attaching connection event listeners");
+ LogDebug("CLIENT: Attaching connection event listeners");
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::AsyncCallEvent>::AddListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent>::AddListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionBrokenEvent>::AddListener(this);
- LogInfo("CLIENT: Connection established");
+ LogDebug("CLIENT: Connection established");
// Emit RPC function call
DPL::RPCFunction proc;
proc.AppendArg((int)1111);
- LogInfo("CLIENT: Calling RPC function");
+ LogDebug("CLIENT: Calling RPC function");
m_rpcConnection->AsyncCall(proc);
}
virtual int ThreadEntry()
{
// Attach RPC listeners
- LogInfo("CLIENT: Attaching connection established event");
+ LogDebug("CLIENT: Attaching connection established event");
m_rpcClient.DPL::EventSupport<DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent>::AddListener(this);
// Open connection to server
- LogInfo("CLIENT: Opening connection to RPC");
+ LogDebug("CLIENT: Opening connection to RPC");
m_rpcClient.Open(RPC_NAME);
// Start message loop
- LogInfo("CLIENT: Starting thread event loop");
+ LogDebug("CLIENT: Starting thread event loop");
int ret = Exec();
// Detach RPC listeners
if (m_rpcConnection.get())
{
- LogInfo("CLIENT: Detaching RPC connection events");
+ LogDebug("CLIENT: Detaching RPC connection events");
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::AsyncCallEvent>::RemoveListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent>::RemoveListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionBrokenEvent>::RemoveListener(this);
- LogInfo("CLIENT: Resetting connection");
+ LogDebug("CLIENT: Resetting connection");
m_rpcConnection.reset();
}
// Detach RPC client listener
- LogInfo("CLIENT: Detaching connection established event");
+ LogDebug("CLIENT: Detaching connection established event");
m_rpcClient.DPL::EventSupport<DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent>::RemoveListener(this);
// Close RPC
- LogInfo("CLIENT: Closing RPC client");
+ LogDebug("CLIENT: Closing RPC client");
m_rpcClient.CloseAll();
// Done
{
(void)event;
- LogInfo("SERVER: AsyncCallEvent received");
+ LogDebug("SERVER: AsyncCallEvent received");
int value;
event.GetArg0().ConsumeArg(value);
- LogInfo("SERVER: Result from client: " << value);
+ LogDebug("SERVER: Result from client: " << value);
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent &event)
{
(void)event;
- LogInfo("SERVER: ConnectionClosedEvent received");
+ LogDebug("SERVER: ConnectionClosedEvent received");
// Close RPC now
- LogInfo("SERVER: Closing RPC connection on event...");
+ LogDebug("SERVER: Closing RPC connection on event...");
// Detach RPC connection listeners
if (m_rpcConnection.get())
{
- LogInfo("SERVER: Detaching connection events");
+ LogDebug("SERVER: Detaching connection events");
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::AsyncCallEvent>::RemoveListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent>::RemoveListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionBrokenEvent>::RemoveListener(this);
}
- LogInfo("SERVER: RPC connection closed");
+ LogDebug("SERVER: RPC connection closed");
- LogInfo("SERVER: Closing RPC on event...");
+ LogDebug("SERVER: Closing RPC on event...");
m_rpcServer.CloseAll();
- LogInfo("SERVER: RPC closed");
+ LogDebug("SERVER: RPC closed");
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectionEvents::ConnectionBrokenEvent &event)
{
(void)event;
- LogInfo("SERVER: ConnectionBrokenEvent received");
+ LogDebug("SERVER: ConnectionBrokenEvent received");
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent &event)
{
// Save connection pointer
- LogInfo("SERVER: Acquiring RPC connection");
+ LogDebug("SERVER: Acquiring RPC connection");
m_rpcConnection.reset(event.GetArg1());
// Attach event listeners
- LogInfo("SERVER: Attaching connection listeners");
+ LogDebug("SERVER: Attaching connection listeners");
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::AsyncCallEvent>::AddListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent>::AddListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionBrokenEvent>::AddListener(this);
- LogInfo("SERVER: Connection established");
+ LogDebug("SERVER: Connection established");
// Emit RPC function call
DPL::RPCFunction proc;
proc.AppendArg((int)2222);
- LogInfo("SERVER: Calling RPC function");
+ LogDebug("SERVER: Calling RPC function");
m_rpcConnection->AsyncCall(proc);
}
: Application(argc, argv, "rpc")
{
// Attach RPC server listeners
- LogInfo("SERVER: Attaching connection established event");
+ LogDebug("SERVER: Attaching connection established event");
m_rpcServer.DPL::EventSupport<DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent>::AddListener(this);
// Self touch
- LogInfo("SERVER: Touching controller");
+ LogDebug("SERVER: Touching controller");
Touch();
// Open RPC server
- LogInfo("SERVER: Opening server RPC");
+ LogDebug("SERVER: Opening server RPC");
m_rpcServer.Open(RPC_NAME);
// Run RPC client in thread
- LogInfo("SERVER: Starting RPC client thread");
+ LogDebug("SERVER: Starting RPC client thread");
m_thread.Run();
// Quit application automatically in few seconds
- LogInfo("SERVER: Sending control timed events");
+ LogDebug("SERVER: Sending control timed events");
DPL::ControllerEventHandler<CloseThreadEvent>::PostTimedEvent(CloseThreadEvent(), 2);
DPL::ControllerEventHandler<QuitEvent>::PostTimedEvent(QuitEvent(), 3);
}
virtual ~MyApplication()
{
// Quit thread
- LogInfo("SERVER: Quitting thread");
+ LogDebug("SERVER: Quitting thread");
m_thread.Quit();
// Close RPC server
- LogInfo("SERVER: Closing RPC server");
+ LogDebug("SERVER: Closing RPC server");
m_rpcServer.CloseAll();
// Detach RPC server listener
int main(int argc, char *argv[])
{
- LogInfo("Starting");
+ LogDebug("Starting");
MyApplication app(argc, argv);
return app.Exec();
}
{
(void)argc;
(void)argv;
- LogInfo("Hello world!");
+ LogDebug("Hello world!");
return 0;
}
virtual void OnEventReceived(const DPL::AbstractSocketEvents::AcceptEvent &event)
{
(void)event;
- LogInfo("Accept event occurred");
+ LogDebug("Accept event occurred");
DPL::UnixSocket *client = static_cast<DPL::UnixSocket *>(m_socket.Accept());
- LogInfo("Accepted client remote address: " << client->GetRemoteAddress().ToString());
- LogInfo("Accepted client local address: " << client->GetLocalAddress().ToString());
+ LogDebug("Accepted client remote address: " << client->GetRemoteAddress().ToString());
+ LogDebug("Accepted client local address: " << client->GetLocalAddress().ToString());
delete client;
}
m_socket.DPL::EventSupport<DPL::AbstractSocketEvents::AcceptEvent>::AddListener(this);
// Create server
- LogInfo("Starting server...");
+ LogDebug("Starting server...");
m_socket.Bind(DPL::Address(SOCKET_NAME));
m_socket.Listen(5);
- LogInfo("Server started");
+ LogDebug("Server started");
- LogInfo("Server local address: " << m_socket.GetLocalAddress().ToString());
+ LogDebug("Server local address: " << m_socket.GetLocalAddress().ToString());
int result = Exec();
virtual void OnEventReceived(const DPL::AbstractSocketEvents::ConnectedEvent &event)
{
(void)event;
- LogInfo("Connected event occurred");
+ LogDebug("Connected event occurred");
}
public:
Touch();
// Start threaded server
- LogInfo("Running threaded server");
+ LogDebug("Running threaded server");
// Run server in thread
thread.Run();
- LogInfo("Waiting for server to start...");
+ LogDebug("Waiting for server to start...");
sleep(1);
// Connect to server
virtual void OnEventReceived(const DPL::AbstractSocketEvents::ConnectedEvent &event)
{
(void)event;
- LogInfo("Connected!");
+ LogDebug("Connected!");
// Send request
DPL::BinaryQueue data;
virtual void OnEventReceived(const DPL::AbstractSocketEvents::ReadEvent &event)
{
(void)event;
- LogInfo("Read!");
+ LogDebug("Read!");
DPL::BinaryQueueAutoPtr data = m_socket.Read(100); // Bad: DLOG cannot log more than about 450 bytes...
if (data->Empty())
{
- LogInfo("Connection closed!");
+ LogDebug("Connection closed!");
m_socket.Close();
// Done
MyApplication(int argc, char **argv)
: Application(argc, argv, "tcpsock")
{
- LogInfo("CTOR!");
+ LogDebug("CTOR!");
// Add listeners
m_socket.DPL::EventSupport<DPL::AbstractSocketEvents::ConnectedEvent>::AddListener(this);
// Connect
m_socket.Open();
- LogInfo("Connecting...");
+ LogDebug("Connecting...");
m_socket.Connect(DPL::Address("en.wikipedia.org", 80));
}
virtual ~MyApplication()
{
- LogInfo("DTOR!");
+ LogDebug("DTOR!");
// Remove listeners
m_socket.DPL::EventSupport<DPL::AbstractSocketEvents::ConnectedEvent>::RemoveListener(this);
virtual void OnEventReceived(const FirstEvent &event)
{
(void)event;
- LogInfo("First event occurred");
+ LogDebug("First event occurred");
}
virtual void OnEventReceived(const SecondEvent &event)
{
(void)event;
- LogInfo("Second event occurred");
+ LogDebug("Second event occurred");
}
};
ADD_SUBDIRECTORY(security_origin_dao)
ADD_SUBDIRECTORY(custom_handler_dao)
ADD_SUBDIRECTORY(certificate_dao)
+ADD_SUBDIRECTORY(i18n)
include(utils/config.cmake)
include(localization/config.cmake)
include(support/config.cmake)
struct stat buffer;
if (stat(databasePath.c_str(), &buffer) != 0) {
//Create fresh database
- LogInfo("Creating database " << databasePath);
+ LogDebug("Creating database " << databasePath);
std::fstream file;
file.open(CERTIFICATE_DB_SQL_PATH, std::ios_base::in);
${PROJECT_SOURCE_DIR}/modules/core/include/dpl/preprocessor.h
${PROJECT_SOURCE_DIR}/modules/core/include/dpl/read_write_mutex.h
${PROJECT_SOURCE_DIR}/modules/core/include/dpl/recursive_mutex.h
+ ${PROJECT_SOURCE_DIR}/modules/core/include/dpl/scope_guard.h
${PROJECT_SOURCE_DIR}/modules/core/include/dpl/scoped_resource.h
${PROJECT_SOURCE_DIR}/modules/core/include/dpl/scoped_array.h
${PROJECT_SOURCE_DIR}/modules/core/include/dpl/scoped_close.h
#define DPL_MACRO_CONCAT_IMPL(x, y) x##y
#define DPL_MACRO_CONCAT(x, y) DPL_MACRO_CONCAT_IMPL(x, y)
+#ifdef __COUNTER__
+#define DPL_ANONYMOUS_VARIABLE(name) DPL_MACRO_CONCAT(name, __COUNTER__)
+#else
+#define DPL_ANONYMOUS_VARIABLE(name) DPL_MACRO_CONCAT(name, __LINE__)
+#endif
+
#endif //DPL_PREPROCESSOR_H
--- /dev/null
+/*
+ * Copyright 2013 Facebook, Inc.
+ *
+ * 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 scope_guard.h
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file is the implementation file of scope guard RAII
+ */
+#ifndef DPL_SCOPE_GUARD_H_
+#define DPL_SCOPE_GUARD_H_
+
+#include <cstddef>
+#include <utility>
+#include <new>
+#include <type_traits>
+#include <dpl/preprocessor.h>
+
+namespace DPL {
+template<typename FunctionType>
+class ScopeGuard
+{
+ public:
+ explicit ScopeGuard(const FunctionType& function)
+ : m_function{function},
+ m_released{false}
+ {}
+
+ explicit ScopeGuard(FunctionType&& function)
+ : m_function{std::move(function)},
+ m_released{false}
+ {}
+
+ ScopeGuard(ScopeGuard&& other)
+ : m_function{std::move(other.m_function)},
+ m_released{other.m_released}
+ {
+ other.Release();
+ }
+
+ ScopeGuard(const ScopeGuard&) = delete;
+
+ ~ScopeGuard()
+ {
+ if (!m_released)
+ {
+ Execute();
+ }
+ }
+
+ ScopeGuard& operator=(const ScopeGuard&) = delete;
+
+ void Release()
+ {
+ m_released = true;
+ }
+
+ void* operator new(size_t) = delete;
+
+ private:
+ // FIXME change to noexcept when available
+ void Execute() throw()
+ {
+ m_function();
+ }
+
+ FunctionType m_function;
+ bool m_released;
+};
+
+template<typename FunctionType>
+ScopeGuard<typename std::decay<FunctionType>::type>
+MakeScopeGuard(FunctionType&& function)
+{
+ return ScopeGuard<typename std::decay<FunctionType>::type>(
+ std::forward<FunctionType>(function));
+}
+
+namespace detail {
+enum class ScopeGuardOnExit {};
+
+template <typename FunctionType>
+ScopeGuard<typename std::decay<FunctionType>::type>
+operator+(detail::ScopeGuardOnExit, FunctionType&& function)
+{
+ return ScopeGuard<typename std::decay<FunctionType>::type>(
+ std::forward<FunctionType>(function));
+}
+}
+}
+
+// FIXME provide support for compilers not supporting variadic macros
+#define DPL_SCOPE_EXIT(...) \
+ auto DPL_ANONYMOUS_VARIABLE(DPL_SCOPE_EXIT_STATE) \
+ = ::DPL::detail::ScopeGuardOnExit() + [__VA_ARGS__]()
+
+#endif // DPL_SCOPE_GUARD_H_
}
// Destroy connection
- LogInfo("Destroying thread database connection: " << m_address);
+ LogDebug("Destroying thread database connection: " << m_address);
delete *Connection();
}
// Initialize SQL connection described in traits
- LogInfo("Attaching thread database connection: " << m_address);
+ LogDebug("Attaching thread database connection: " << m_address);
Connection() = new DPL::DB::SqlConnection(
m_address.c_str(), m_flags, options);
// It must not be in linger state yet
Assert(*Linger() == false);
- LogInfo("Detaching thread database connection: " << m_address);
+ LogDebug("Detaching thread database connection: " << m_address);
// Enter linger state
*Linger() = true;
const gchar* /*interfaceName*/,
const gchar* propertyName)
{
- LogInfo("InterfaceDispatcher onPropertyGet: " << propertyName);
+ LogDebug("InterfaceDispatcher onPropertyGet: " << propertyName);
return NULL;
}
const gchar* propertyName,
GVariant* /*value*/)
{
- LogInfo("InterfaceDispatcher onPropertySet: " << propertyName);
+ LogDebug("InterfaceDispatcher onPropertySet: " << propertyName);
return false;
}
G_CALLBACK(onNewConnection),
this);
- LogInfo("Server started at: "
+ LogDebug("Server started at: "
<< g_dbus_server_get_client_address(m_server));
}
ServerEvents::NewConnectionEvent event(
ConnectionPtr(new Connection(connection)));
- LogInfo("Emitting new connection event");
+ LogDebug("Emitting new connection event");
// TODO Blocking to allow object registration before any DBus messages are
// processed.
self->DPL::Event::EventSupport<ServerEvents::NewConnectionEvent>::
--- /dev/null
+ADD_SUBDIRECTORY(dao)
--- /dev/null
+SET(TARGET_I18N_DAO_DB "Sqlite3DbI18n")
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h
+ COMMAND ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/gen_db_md5.sh
+ ARGS ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h
+ ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/iana_db
+ DEPENDS ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/iana_db
+ ${CMAKE_SOURCE_DIR}/modules/i18n/dao/orm/gen_db_md5.sh
+ COMMENT "Generating WRT i18n database checksum"
+ )
+
+ADD_CUSTOM_COMMAND( OUTPUT .wrt_i18n.db
+ COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db
+ COMMAND gcc -Wall -include ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h -I${PROJECT_SOURCE_DIR}/modules/db/include -I${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm -E ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm/i18n_db_sql_generator.h | grep --invert-match "^#" > ${CMAKE_CURRENT_BINARY_DIR}/wrt_i18n_db.sql
+ COMMAND sqlite3 ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db ".read ${CMAKE_CURRENT_BINARY_DIR}/wrt_i18n_db.sql" || rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db
+ DEPENDS ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm/i18n_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm/iana_db
+ )
+
+ADD_CUSTOM_COMMAND( OUTPUT .wrt_i18n.db-journal
+ COMMAND touch
+ ARGS ${CMAKE_CURRENT_BINARY_DIR}/.wrt_i18n.db-journal
+ )
+
+ADD_CUSTOM_TARGET(${TARGET_I18N_DAO_DB} ALL DEPENDS .wrt_i18n.db .wrt_i18n.db-journal)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wrt_i18n_db.sql DESTINATION share/wrt-engine/)
+
+###############################################################################
+
+SET(I18N_DAO_INCLUDE_DIRS
+ ${PROJECT_SOURCE_DIR}/modules/i18n/dao/include
+ ${PROJECT_SOURCE_DIR}/modules/i18n/dao/orm
+ ${PROJECT_SOURCE_DIR}/modules/core/include
+ ${PROJECT_SOURCE_DIR}/modules/db/include
+ ${PROJECT_SOURCE_DIR}/modules/log/include
+)
+
+
+SET(I18N_DAO_RO_SOURCES
+ src/i18n_database.cpp
+ src/i18n_dao_read_only.cpp
+)
+
+INCLUDE_DIRECTORIES(${I18N_DAO_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(SYSTEM ${I18N_DAO_DEPS_INCLUDE_DIRS})
+
+ADD_LIBRARY(${TARGET_I18N_DAO_RO_LIB} SHARED ${I18N_DAO_RO_SOURCES})
+SET_TARGET_PROPERTIES(${TARGET_I18N_DAO_RO_LIB} PROPERTIES SOVERSION ${API_VERSION} VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${TARGET_I18N_DAO_RO_LIB} PROPERTIES COMPILE_FLAGS "-include ${CMAKE_BINARY_DIR}/modules/i18n/dao/database_checksum_i18n.h")
+TARGET_LINK_LIBRARIES(${TARGET_I18N_DAO_RO_LIB} ${TARGET_DPL_DB_EFL})
+ADD_DEPENDENCIES(${TARGET_I18N_DAO_RO_LIB} ${TARGET_I18N_DAO_DB})
+
+INSTALL(TARGETS ${TARGET_I18N_DAO_RO_LIB} DESTINATION lib)
+
+INSTALL(FILES
+ include/wrt-commons/i18n-dao-ro/i18n_database.h
+ include/wrt-commons/i18n-dao-ro/i18n_dao_read_only.h
+ DESTINATION include/dpl-efl/wrt-commons/i18n-dao-ro
+)
--- /dev/null
+/*
+ * Copyright (c) 2012 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.
+ */
+/**
+ * This file contains the declaration of i18n dao namespace.
+ *
+ * @file i18n_dao_read_only.h
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file contains the declaration of i18n dao.
+ */
+
+#ifndef _I18N_DAO_READ_ONLY_H_
+#define _I18N_DAO_READ_ONLY_H_
+
+#include <dpl/string.h>
+
+namespace I18n {
+namespace DB {
+namespace I18nDAOReadOnly {
+bool IsValidSubTag(const DPL::String& tag, int type);
+} // namespace I18nDAOReadOnly
+} // namespace DB
+} // namespace I18n
+
+#endif // _I18N_DAO_READ_ONLY_H_
+
--- /dev/null
+/*
+ * Copyright (c) 2012 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 _I18N_DATABASE_H_
+#define _I18N_DATABASE_H_
+
+#include <dpl/thread.h>
+#include <dpl/mutex.h>
+#include <dpl/db/thread_database_support.h>
+
+namespace I18n {
+namespace DB {
+namespace Interface {
+void attachDatabaseRO();
+void detachDatabase();
+
+extern DPL::Mutex g_dbQueriesMutex;
+extern DPL::DB::ThreadDatabaseSupport g_dbInterface;
+} // namespace Interface
+} // namespace DB
+} // namespace I18n
+
+#define I18N_DB_INTERNAL(tlsCommand, InternalType) \
+ static DPL::ThreadLocalVariable<InternalType> *tlsCommand##Ptr = NULL; \
+ { \
+ DPL::Mutex::ScopedLock lock( \
+ &I18n::DB::Interface::g_dbQueriesMutex); \
+ if (!tlsCommand##Ptr) { \
+ static DPL::ThreadLocalVariable<InternalType> tmp; \
+ tlsCommand##Ptr = &tmp; \
+ } \
+ } \
+ DPL::ThreadLocalVariable<InternalType> &tlsCommand = *tlsCommand##Ptr; \
+ if (tlsCommand.IsNull()) \
+ { \
+ tlsCommand = InternalType(&I18n::DB::Interface::g_dbInterface); \
+ }
+
+#define I18N_DB_SELECT(name, type) \
+ I18N_DB_INTERNAL(name, type::Select)
+
+#endif /* _I18N_DATABASE_H_ */
+
--- /dev/null
+#!/bin/sh
+# Copyright (c) 2012 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.
+#
+CHECKSUM=`cat ${2} ${3} 2>/dev/null | md5sum 2>/dev/null | cut -d\ -f1 2>/dev/null`
+echo "#define DB_CHECKSUM DB_VERSION_${CHECKSUM}" > ${1}
+echo "#define DB_CHECKSUM_STR \"DB_VERSION_${CHECKSUM}\"" >> ${1}
+
--- /dev/null
+DATABASE_START(i18n)
+
+#include "iana_db"
+#include "version_db"
+
+DATABASE_END()
--- /dev/null
+/*
+ * Copyright (c) 2012 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 i18n_db_sql_generator.h
+ * @author Zbigniew Kostrzewa (z.kostrzewa@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 "i18n_db_definitions"
--- /dev/null
+/*
+ * Copyright (c) 2012 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_I18N_H_
+#define _ORM_GENERATOR_I18N_H_
+
+#define ORM_GENERATOR_DATABASE_NAME i18n_db_definitions
+#include <dpl/db/orm_generator.h>
+#undef ORM_GENERATOR_DATABASE_NAME
+
+#endif // _ORM_GENERATOR_I18N_H_
--- /dev/null
+SQL(
+ BEGIN TRANSACTION;
+ CREATE TABLE DB_CHECKSUM (version INT);
+ COMMIT;
+)
--- /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.
+ */
+/**
+ * This file contains the definition of i18n dao namespace.
+ *
+ * @file i18n_dao_read_only.cpp
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file contains the definition of i18n dao
+ */
+
+#include <wrt-commons/i18n-dao-ro/i18n_dao_read_only.h>
+#include <wrt-commons/i18n-dao-ro/i18n_database.h>
+
+#include <orm_generator_i18n.h>
+
+using namespace DPL::DB::ORM;
+using namespace DPL::DB::ORM::i18n;
+
+namespace I18n {
+namespace DB {
+namespace I18nDAOReadOnly {
+bool IsValidSubTag(const DPL::String& tag, int type)
+{
+ I18N_DB_SELECT(select, iana_records)
+ select->Where(And(Equals<iana_records::SUBTAG>(tag),
+ Equals<iana_records::TYPE>(type)));
+ return !select->GetRowList().empty();
+}
+}
+}
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 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/i18n-dao-ro/i18n_database.h>
+
+namespace I18n {
+namespace DB {
+namespace Interface {
+namespace {
+const char* const I18N_DB_FILE_PATH = "/opt/usr/dbspace/.wrt_i18n.db";
+
+DPL::DB::SqlConnection::Flag::Type I18N_DB_FLAGS =
+ DPL::DB::SqlConnection::Flag::UseLucene;
+}
+
+DPL::Mutex g_dbQueriesMutex;
+DPL::DB::ThreadDatabaseSupport g_dbInterface(I18N_DB_FILE_PATH,
+ I18N_DB_FLAGS);
+
+void attachDatabaseRO()
+{
+ g_dbInterface.AttachToThread(DPL::DB::SqlConnection::Flag::RO);
+}
+
+void detachDatabase()
+{
+ g_dbInterface.DetachFromThread();
+}
+} //namespace Interface
+} //namespace DB
+} //namespace I18n
const std::string SCHEME_WIDGET = "widget://";
const std::string SCHEM_APP = "app://";
const std::string LOCALE_PATH = "locales/";
+ const std::string DOUBLE_ROOT = "//";
static std::string lastTzAppId;
static WidgetDAOReadOnlyPtr dao;
// remove "file://"
workingUrl.erase(0, SCHEME_FILE.length());
+ // exception handling for "//"
+ if (workingUrl.compare(0, DOUBLE_ROOT.length(), DOUBLE_ROOT) == 0)
+ {
+ workingUrl.erase(0, 1);
+ LogDebug("workingUrl: " << workingUrl);
+ }
+
// remove src path
if (workingUrl.compare(0, srcPath.length(), srcPath) == 0)
{
${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/dlog_log_provider.h
${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/log.h
${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/old_style_log_provider.h
+ ${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/secure_log.h
PARENT_SCOPE
)
--- /dev/null
+/*
+ * Copyright (c) 2013 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 secure_log.h
+ * @author Jihoon Chung(jihoon.chung@samsung.com)
+ * @version 0.1
+ * @brief
+ */
+
+#ifndef DPL_SECURE_LOG_H
+#define DPL_SECURE_LOG_H
+
+#include <dlog.h>
+
+#define COLOR_ERROR "\e[1;31m"
+#define COLOR_WARNING "\e[2;31m"
+#define COLOR_END "\e[0m"
+#define COLOR_TAG "\e[0m"
+
+#ifdef WRT_LOG
+#undef LOG_TAG
+#define LOG_TAG "WRT"
+#undef COLOR_TAG
+#define COLOR_TAG "\e[1;32m"
+#endif
+
+#ifdef WRT_BUNDLE_LOG
+#undef LOG_TAG
+#define LOG_TAG "WRT_BUNDLE"
+#undef COLOR_TAG
+#define COLOR_TAG "\e[1;34m"
+#endif
+
+#ifdef WRT_PLUGINS_COMMON_LOG
+#undef LOG_TAG
+#define LOG_TAG "WRT_PLUGINS/COMMON"
+#undef COLOR_TAG
+#define COLOR_TAG "\e[1;36m"
+#endif
+
+#ifdef WRT_PLUGINS_WIDGET_LOG
+#undef LOG_TAG
+#define LOG_TAG "WRT_PLUGINS/WIDGET"
+#undef COLOR_TAG
+#define COLOR_TAG "\e[1;35m"
+#endif
+
+#ifdef WRT_INSTALLER_LOG
+#undef LOG_TAG
+#define LOG_TAG "WRT_INSTALLER"
+#undef COLOR_TAG
+#define COLOR_TAG "\e[1;32m"
+#endif
+
+#ifndef SECURE_SLOGD
+#define SECURE_SLOGD(fmt, arg...) SLOGD(fmt,##arg)
+#endif
+
+#ifndef SECURE_SLOGW
+#define SECURE_SLOGW(fmt, arg...) SLOGW(fmt,##arg)
+#endif
+
+#ifndef SECURE_SLOGE
+#define SECURE_SLOGE(fmt, arg...) SLOGE(fmt,##arg)
+#endif
+
+#define _D(fmt, arg ...) SECURE_SLOGD(COLOR_TAG fmt COLOR_END,##arg)
+#define _W(fmt, arg ...) SECURE_SLOGW(COLOR_WARNING fmt COLOR_END,##arg)
+#define _E(fmt, arg ...) SECURE_SLOGE(COLOR_ERROR fmt COLOR_END,##arg)
+
+#endif // DPL_SECURE_LOG_H
+
struct stat buffer;
if (stat(databasePath.c_str(), &buffer) != 0) {
//Create fresh database
- LogInfo("Creating database " << databasePath);
+ LogDebug("Creating database " << databasePath);
std::fstream file;
file.open(SECURITY_ORIGIN_DB_SQL_PATH, std::ios_base::in);
SECURITY_ORIGIN_DB_UPDATE(update,
SecurityOriginInfo,
&m_securityOriginDBInterface);
+ update->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)));
update->Values(row);
update->Execute();
} else {
void SecurityOriginDAO::setPrivilegeSecurityOriginData(const Feature feature,
bool isOnlyAllowedLocalOrigin)
{
- Origin origin(DPL::FromUTF8String("file"),
+ Origin origin(DPL::FromUTF8String("file"), //TODO: this breaks app:// scheme code -> no case for app scheme
DPL::FromUTF8String(""),
0);
if (!isOnlyAllowedLocalOrigin) {
if (set.empty()) {
set.insert(s("text/html"));
set.insert(s("application/xhtml+xml"));
+ set.insert(s("image/svg+xml"));
}
return set;
}
COMMAND ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/gen_db_md5.sh
ARGS ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h
${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/wrt_db
- ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/iana_db
DEPENDS ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/wrt_db
- ${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/iana_db
${CMAKE_SOURCE_DIR}/modules/widget_dao/orm/gen_db_md5.sh
COMMENT "Generating WRT database checksum"
)
COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt.db
COMMAND gcc -Wall -include ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h -I${PROJECT_SOURCE_DIR}/modules/db/include -I${PROJECT_SOURCE_DIR}/modules/widget_dao/orm -E ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db_sql_generator.h | grep --invert-match "^#" > ${CMAKE_CURRENT_BINARY_DIR}/wrt_db.sql
COMMAND sqlite3 ${CMAKE_CURRENT_BINARY_DIR}/.wrt.db ".read ${CMAKE_CURRENT_BINARY_DIR}/wrt_db.sql" || rm -f ${CMAKE_CURRENT_BINARY_DIR}/.wrt.db
- DEPENDS ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/iana_db
+ DEPENDS ${CMAKE_BINARY_DIR}/modules/widget_dao/database_checksum.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/widget_dao/orm/wrt_db
)
ADD_CUSTOM_COMMAND( OUTPUT .wrt.db-journal
//register feature
{
- LogInfo(" |-- Registering feature " << feature.m_name);
+ LogDebug(" |-- Registering feature " << feature.m_name);
FeaturesList::Row row;
row.Set_FeatureName(DPL::FromUTF8String(feature.m_name));
int deviceCapID;
if (FeatureDAOReadOnly::isDeviceCapabilityInstalled(*itdev)) {
- LogInfo(" | |--DeviceCap " << *itdev <<
+ LogDebug(" | |--DeviceCap " << *itdev <<
" already installed!");
WRT_DB_SELECT(select,
deviceCapID =
select->GetSingleValue<DeviceCapabilities::DeviceCapID>();
} else {
- LogInfo(" | |--Register DeviceCap: " << *itdev);
+ LogDebug(" | |--Register DeviceCap: " << *itdev);
DeviceCapabilities::Row row;
row.Set_DeviceCapName(DPL::FromUTF8String(*itdev));
}
}
-void GlobalDAO::setComplianceMode(bool mode)
-{
- LogDebug("Updating compliance mode to:" << mode);
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- GlobalProperties::Row row;
- row.Set_compliance_mode(mode);
-
- WRT_DB_UPDATE(update, GlobalProperties, &WrtDatabase::interface())
- update->Values(row);
- update->Execute();
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAO::Exception::DatabaseError,
- "Failed to update compliance mode");
- }
-}
-
-void GlobalDAO::setComplianceFakeImei(const std::string &imei)
-{
- LogDebug("Setting compliance fake IMEI: " << imei);
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- GlobalProperties::Row row;
- row.Set_compliance_fake_imei(DPL::FromASCIIString(imei));
-
- WRT_DB_UPDATE(update, GlobalProperties, &WrtDatabase::interface())
- update->Values(row);
- update->Execute();
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAO::Exception::DatabaseError,
- "Failed to update compliance fake IMEI");
- }
-}
-
-void GlobalDAO::setComplianceFakeMeid(const std::string &meid)
-{
- LogDebug("Setting compliance fake MEID: " << meid);
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- GlobalProperties::Row row;
- row.Set_compliance_fake_meid(DPL::FromASCIIString(meid));
-
- WRT_DB_UPDATE(update, GlobalProperties, &WrtDatabase::interface())
- update->Values(row);
- update->Execute();
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAO::Exception::DatabaseError,
- "Failed to update compliance fake MEID");
- }
-}
-
void GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::NetworkAccessMode newMode)
{
LogDebug("updating home network data usage to:" << newMode);
return select->GetSingleValue<GlobalProperties::secure_by_default>();
}
-bool GlobalDAOReadOnly::getComplianceMode()
-{
- LogDebug("Getting compliance mode");
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- WRT_DB_SELECT(select, GlobalProperties, &WrtDatabase::interface())
- return select->GetSingleValue<GlobalProperties::compliance_mode>();
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError,
- "Failed to get compliance mode");
- }
-}
-
-std::string GlobalDAOReadOnly::getComplianceFakeImei()
-{
- LogDebug("Getting compliance fake IMEI");
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- WRT_DB_SELECT(select, GlobalProperties, &WrtDatabase::interface())
- DPL::Optional<DPL::String> result =
- select->GetSingleValue<GlobalProperties::compliance_fake_imei>();
- if (!result) {
- return std::string();
- }
- return DPL::ToUTF8String(*result);
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError,
- "Failed to get compliance fake IMEI");
- }
-}
-
-std::string GlobalDAOReadOnly::getComplianceFakeMeid()
-{
- LogDebug("Getting compliance fake MEID");
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- WRT_DB_SELECT(select, GlobalProperties, &WrtDatabase::interface())
- DPL::Optional<DPL::String> result =
- select->GetSingleValue<GlobalProperties::compliance_fake_meid>();
- if (!result) {
- return std::string();
- }
- return DPL::ToUTF8String(*result);
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError,
- "Failed to get compliance fake MEID");
- }
-}
-
-bool GlobalDAOReadOnly::IsValidSubTag(const DPL::String& tag, int type)
-{
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- WRT_DB_SELECT(select, iana_records, &WrtDatabase::interface())
- select->Where(Equals<iana_records::SUBTAG>(tag));
- auto row = select->GetRowList();
- if (row.empty() || row.front().Get_TYPE() != type) {
- return false;
- } else {
- return true;
- }
-}
-
GlobalDAOReadOnly::NetworkAccessMode
GlobalDAOReadOnly::GetHomeNetworkDataUsage()
{
whiteURI.strIRI = i->Get_uri();
whiteURI.bSubDomains = i->Get_subdomain_access();
resultList.push_back(whiteURI);
- LogInfo("[uri] : " << whiteURI.strIRI <<
+ LogDebug("[uri] : " << whiteURI.strIRI <<
", [subdomain] : " << whiteURI.bSubDomains);
}
return resultList;
if (isPluginInstalled(metafile.m_libraryName)) {
handle = PluginDAO(metafile.m_libraryName).getPluginHandle();
- LogInfo(" >> Library " << metafile.m_libraryName <<
+ LogDebug(" >> Library " << metafile.m_libraryName <<
" is already registered. Handle: " << handle);
} else {
LogDebug("Register Plugin: " << metafile.m_libraryName);
&WrtDatabase::interface());
if (!isPluginInstalled(pluginHandle)) {
- LogInfo("PluginHandle is invalid. Handle: " << pluginHandle);
+ LogDebug("PluginHandle is invalid. Handle: " << pluginHandle);
return;
} else {
using namespace DPL::DB::ORM;
void WidgetDAO::registerWidget(
const TizenAppId & tzAppId,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity)
+ const IWidgetSecurity &widgetSecurity)
{
LogDebug("Registering widget");
SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
{
DPL::DB::ORM::wrt::ScopedTransaction transaction(
&WrtDatabase::interface());
- registerWidgetInternal(tzAppId, widgetRegInfo, wacSecurity);
+ registerWidgetInternal(tzAppId, widgetRegInfo, widgetSecurity);
transaction.Commit();
}
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
DbWidgetHandle WidgetDAO::registerWidget(
const WidgetRegisterInfo &pWidgetRegisterInfo,
- const IWacSecurity &wacSecurity)
+ const IWidgetSecurity &widgetSecurity)
{
//make it more precise due to very fast tests
struct timeval tv;
registerWidget(*pWidgetRegisterInfo.configInfo.tizenAppId,
pWidgetRegisterInfo,
- wacSecurity);
+ widgetSecurity);
return widgetHandle;
}
TizenAppId WidgetDAO::registerWidgetGeneratePkgId(
const WidgetRegisterInfo &pWidgetRegisterInfo,
- const IWacSecurity &wacSecurity)
+ const IWidgetSecurity &widgetSecurity)
{
TizenAppId tzAppId = generatePkgId();
- registerWidget(tzAppId, pWidgetRegisterInfo, wacSecurity);
+ registerWidget(tzAppId, pWidgetRegisterInfo, widgetSecurity);
return tzAppId;
}
void WidgetDAO::registerWidgetInternal(
const TizenAppId & tzAppId,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity,
+ const IWidgetSecurity &widgetSecurity,
const DPL::Optional<DbWidgetHandle> handle)
{
//Register into WidgetInfo has to be first
//as all other tables depend upon that
DbWidgetHandle widgetHandle = registerWidgetInfo(tzAppId,
widgetRegInfo,
- wacSecurity,
+ widgetSecurity,
handle);
registerWidgetExtendedInfo(widgetHandle, widgetRegInfo);
registerWidgetAllowNavigationInfo(widgetHandle, widgetRegInfo);
- registerWidgetCertificates(widgetHandle, wacSecurity);
+ registerWidgetCertificates(widgetHandle, widgetSecurity);
CertificateChainList list;
- wacSecurity.getCertificateChainList(list, SIGNATURE_DISTRIBUTOR);
+ widgetSecurity.getCertificateChainList(list, SIGNATURE_DISTRIBUTOR);
registerCertificatesChains(widgetHandle, SIGNATURE_DISTRIBUTOR, list);
list.clear();
- wacSecurity.getCertificateChainList(list, SIGNATURE_AUTHOR);
+ widgetSecurity.getCertificateChainList(list, SIGNATURE_AUTHOR);
registerCertificatesChains(widgetHandle, SIGNATURE_AUTHOR, list);
registerWidgetSettings(widgetHandle, widgetRegInfo);
void WidgetDAO::registerOrUpdateWidget(
const TizenAppId & widgetName,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity)
+ const IWidgetSecurity &widgetSecurity)
{
LogDebug("Reregistering widget");
SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
&WrtDatabase::interface());
unregisterWidgetInternal(widgetName);
- registerWidgetInternal(widgetName, widgetRegInfo, wacSecurity);
+ registerWidgetInternal(widgetName, widgetRegInfo, widgetSecurity);
transaction.Commit();
}
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
const TizenAppId & oldAppId,
const TizenAppId & newAppId,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity)
+ const IWidgetSecurity &widgetSecurity)
{
LogDebug("Backup and Register widget");
SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
&WrtDatabase::interface());
updateWidgetAppIdInternal(newAppId, oldAppId);
- registerWidgetInternal(newAppId, widgetRegInfo, wacSecurity);
+ registerWidgetInternal(newAppId, widgetRegInfo, widgetSecurity);
transaction.Commit();
}
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to reregister widget")
row.Set_app_id(widgetHandle);
// row.Set_share_href (DPL::FromUTF8String(regInfo.shareHref));
row.Set_signature_type(regInfo.signatureType);
- row.Set_test_widget(regInfo.isTestWidget);
row.Set_install_time(regInfo.installedTime);
row.Set_splash_img_src(regInfo.configInfo.splashImgSrc);
row.Set_background_page(regInfo.configInfo.backgroundPage);
DbWidgetHandle WidgetDAO::registerWidgetInfo(
const TizenAppId & tzAppId,
const WidgetRegisterInfo ®Info,
- const IWacSecurity &wacSecurity,
+ const IWidgetSecurity &widgetSecurity,
const DPL::Optional<DbWidgetHandle> handle)
{
using namespace DPL::DB::ORM;
row.Set_csp_policy_report_only(widgetConfigurationInfo.cspPolicyReportOnly);
row.Set_base_folder(DPL::FromUTF8String(regInfo.baseFolder));
row.Set_webkit_plugins_required(widgetConfigurationInfo.flashNeeded);
- row.Set_recognized(wacSecurity.isRecognized());
- row.Set_wac_signed(wacSecurity.isWacSigned());
- row.Set_distributor_signed(wacSecurity.isDistributorSigned());
+ row.Set_recognized(widgetSecurity.isRecognized());
+ row.Set_distributor_signed(widgetSecurity.isDistributorSigned());
row.Set_tizen_appid(tzAppId);
row.Set_tizen_pkgid(regInfo.tzPkgid);
{
}
void WidgetDAO::registerWidgetCertificates(DbWidgetHandle widgetHandle,
- const IWacSecurity &wacSecurity)
+ const IWidgetSecurity &widgetSecurity)
{
using namespace DPL::DB::ORM;
using namespace DPL::DB::ORM::wrt;
- FOREACH(it, wacSecurity.getCertificateList())
+ FOREACH(it, widgetSecurity.getCertificateList())
{
WidgetCertificateFingerprint::Row row;
row.Set_app_id(widgetHandle);
}
} // namespace
-IWacSecurity::~IWacSecurity()
+IWidgetSecurity::~IWidgetSecurity()
{}
WidgetDAOReadOnly::WidgetDAOReadOnly(DbWidgetHandle widgetHandle) :
return static_cast<bool>(*result);
}
-bool WidgetDAOReadOnly::isWacSigned() const
-{
- WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
- DPL::OptionalInt result = row.Get_wac_signed();
- if (result.IsNull()) {
- return false;
- }
- return static_cast<bool>(*result);
-}
-
bool WidgetDAOReadOnly::isDistributorSigned() const
{
WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
return isDistributorSigned();
}
-bool WidgetDAOReadOnly::isTestWidget() const
-{
- Try {
- WRT_DB_SELECT(select, WidgetExtendedInfo, &WrtDatabase::interface())
- select->Where(Equals<WidgetExtendedInfo::app_id>(m_widgetHandle));
-
- WidgetExtendedInfo::Select::RowList rows = select->GetRowList();
- if (rows.empty()) {
- ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
- "Cannot find widget. Handle: " << m_widgetHandle);
- }
-
- return static_cast<bool>(rows.front().Get_test_widget());
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(WidgetDAOReadOnly::Exception::DatabaseError,
- "Failed to check IsTestWidget");
- }
-}
-
DPL::OptionalString WidgetDAOReadOnly::getCspPolicy() const
{
WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
#undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
#undef SQL_CONNECTION_EXCEPTION_HANDLER_END
#undef CHECK_WIDGET_EXISTENCE
-} // namespace WrtDB
\ No newline at end of file
+} // namespace WrtDB
enum AppType
{
APP_TYPE_UNKNOWN = 0, // unknown
- APP_TYPE_WAC20, // WAC 2.0
APP_TYPE_TIZENWEBAPP // Tizen webapp
};
switch (appType) {
#define X(x) case x: return #x;
X(APP_TYPE_UNKNOWN)
- X(APP_TYPE_WAC20)
X(APP_TYPE_TIZENWEBAPP)
#undef X
default:
DPL::OptionalString tizenAppId;
// allow-navigation
+ bool allowNavigationEncountered;
AllowNavigationInfoList allowNavigationInfoList;
//csp polic for widget
backSupported(false),
accessNetwork(false),
startFileEncountered(false),
+ allowNavigationEncountered(false),
securityModelVersion(SecurityModelVersion::SECURITY_MODEL_V1)
{}
};
return "/usr/share/wrt-engine/schema.xsd";
}
-inline const char* GetWAC20TestRootCAFilePath()
-{
- return "/usr/share/wrt-engine/WAC2.0TestRootCA.cert";
-}
-
/**
* Name of the w3c geolocation feature
*/
return "/tmp";
}
-inline const char* GetWACVersion()
-{
- return "2.0";
-}
-
inline const char* GetTizenVersion()
{
return "2.2";
public:
- static bool IsValidSubTag(const DPL::String& tag, int type);
-
static bool GetSecureByDefault();
- static bool getComplianceMode();
-
- static std::string getComplianceFakeImei();
-
- static std::string getComplianceFakeMeid();
-
static WidgetAccessInfoList GetWhiteURIList();
static bool GetCookieSharingMode();
WidgetRegisterInfo() :
webAppType(APP_TYPE_UNKNOWN),
signatureType(SIGNATURE_TYPE_UNIDENTIFIED),
- isTestWidget(0),
configInfo(),
packagingType(PKG_TYPE_UNKNOWN)
{}
std::string shareHref;
std::string baseFolder;
WidgetSignatureType signatureType;
- int isTestWidget;
ConfigParserData configInfo;
LocalizationData localizationData;
};
typedef std::list<std::string> CertificateChainList;
-class IWacSecurity
+class IWidgetSecurity
{
public:
- virtual ~IWacSecurity();
+ virtual ~IWidgetSecurity();
virtual const WidgetCertificateDataList& getCertificateList() const = 0;
virtual bool isDistributorSigned() const = 0;
- virtual bool isWacSigned() const = 0;
-
virtual void getCertificateChainList(CertificateChainList& list,
CertificateSource source) const = 0;
};
* WAC 2.0 extension
* @return
*/
- bool isWacSigned() const;
-
- /**
- * WAC 2.0 extension
- * @return
- */
bool isDistributorSigned() const;
/**
bool isTrusted() const;
/**
- * WAC 2.0 extension
- * @return is WAC test widget
- */
- bool isTestWidget() const;
-
- /**
* This method returns window mode of widget.
*
* @return window modes of widget
public:
static void SetSecureByDefault(bool secureByDefault);
- static void setComplianceMode(bool mode);
-
- static void setComplianceFakeImei(const std::string &imei);
-
- static void setComplianceFakeMeid(const std::string &meid);
-
static void AddWhiteURI(const std::string &value, bool subDomain);
static void RemoveWhiteURI(const std::string &uri);
* @param[in] TizenAppId Widget app id that will be registered.
* @param[in] pWidgetRegisterInfo Specified the widget's information
* needed to be registered.
- * @param[in] wacSecurity Widget's security certificates.
+ * @param[in] widgetSecurity Widget's security certificates.
*/
static void registerWidget(
const TizenAppId& tzAppId,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity);
+ const IWidgetSecurity &widgetSecurity);
static DbWidgetHandle registerWidget(
const WidgetRegisterInfo &pWidgetRegisterInfo,
- const IWacSecurity &wacSecurity) __attribute__((deprecated));
+ const IWidgetSecurity &widgetSecurity) __attribute__((deprecated));
/**
* @brief registerWidgetGenerateTizenId Registers widget with auto-generated
* Function is not thread-safe.
*
* @param pWidgetRegisterInfo registeration information
- * @param wacSecurity Widget's security certificates.
+ * @param widgetSecurity Widget's security certificates.
* @return tzAppId generated
*/
static TizenAppId registerWidgetGeneratePkgId(
const WidgetRegisterInfo &pWidgetRegisterInfo,
- const IWacSecurity &wacSecurity);
+ const IWidgetSecurity &widgetSecurity);
/**
* This method re-registers the widget information to the DB when it is
* @param[in] tzAppId Widget tizen app id that will be registered.
* @param[in] pWidgetRegisterInfo Specified the widget's information
* needed to be registered.
- * @param[in] wacSecurity Widget's security certificates.
+ * @param[in] widgetSecurity Widget's security certificates.
*/
static void registerOrUpdateWidget(
const TizenAppId & tzAppId,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity);
+ const IWidgetSecurity &widgetSecurity);
/* This method backup widget information and update new widget information
* for restore widget information
const TizenAppId & oldAppId,
const TizenAppId & newAppId,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity);
+ const IWidgetSecurity &widgetSecurity);
static void restoreUpdateWidget(
const TizenAppId & oldAppId,
static DbWidgetHandle registerWidgetInfo(
const TizenAppId & widgetName,
const WidgetRegisterInfo ®Info,
- const IWacSecurity &wacSecurity,
+ const IWidgetSecurity &widgetSecurity,
const DPL::Optional<DbWidgetHandle> handle =
DPL::Optional<DbWidgetHandle>());
static void registerWidgetExtendedInfo(
const WidgetRegisterInfo ®Info);
static void registerWidgetCertificates(
DbWidgetHandle widgetHandle,
- const IWacSecurity &wacSecurity);
+ const IWidgetSecurity &widgetSecurity);
static void registerCertificatesChains(
DbWidgetHandle widgetHandle,
CertificateSource certificateSource,
static void registerWidgetInternal(
const TizenAppId & tzAppId,
const WidgetRegisterInfo &widgetRegInfo,
- const IWacSecurity &wacSecurity,
+ const IWidgetSecurity &widgetSecurity,
const DPL::Optional<DbWidgetHandle> handle =
DPL::Optional<DbWidgetHandle>());
static void unregisterWidgetInternal(
COLUMN_NOT_NULL(secure_by_default, INT, DEFAULT 1)
COLUMN_NOT_NULL(home_network_data_usage, TINYINT, DEFAULT 1)
COLUMN_NOT_NULL(roaming_data_usage, TINYINT, DEFAULT 1)
- COLUMN_NOT_NULL(compliance_mode, TINYINT, DEFAULT 0)
- COLUMN_NOT_NULL(compliance_fake_imei, VARCHAR(256), DEFAULT '')
- COLUMN_NOT_NULL(compliance_fake_meid, VARCHAR(256), DEFAULT '')
COLUMN_NOT_NULL(cookie_sharing_mode, INT, DEFAULT 0)
CREATE_TABLE_END()
DATABASE_START(wrt)
#include "wrt_db"
-#include "iana_db"
#include "version_db"
DATABASE_END()
#git:framework/web/wrt-commons
Name: wrt-commons
Summary: Wrt common library
-Version: 0.2.135
+Version: 0.2.139
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db
chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db-journal
+chsmack -a 'wrt-commons::db_wrt_i18n' /opt/usr/dbspace/.wrt_i18n.db
+chsmack -a 'wrt-commons::db_wrt_i18n' /opt/usr/dbspace/.wrt_i18n.db-journal
echo "[WRT] wrt-commons postinst done ..."
ADD_SUBDIRECTORY(files_localization)
ADD_SUBDIRECTORY(localizationTagsProvider)
ADD_SUBDIRECTORY(utils)
+ADD_SUBDIRECTORY(i18n)
IF(WITH_CHILD)
MESSAGE(STATUS "Additional test subdirectory is being added")
g_type_init();
g_thread_init(NULL);
- LogInfo("Starting");
+ LogDebug("Starting");
elm_init(argc, argv);
}
${TESTS_DIR}/core/test_thread.cpp
${TESTS_DIR}/core/test_type_list.cpp
${TESTS_DIR}/core/test_zip_input.cpp
+ ${TESTS_DIR}/core/test_scope_guard.cpp
)
WRT_TEST_ADD_INTERNAL_DEPENDENCIES(${TARGET_NAME} ${TARGET_DPL_EFL})
--- /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 test_scope_guard.cpp
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file is the implementation file of test scope guard
+ */
+#include <dpl/test/test_runner.h>
+#include <dpl/scope_guard.h>
+
+namespace {
+bool g_guardCalled = false;
+
+void regularFunction()
+{
+ g_guardCalled = true;
+}
+
+struct Functor
+{
+ explicit Functor(bool& guardCalled)
+ : m_guardCalled(guardCalled)
+ {}
+
+ void operator()()
+ {
+ m_guardCalled = true;
+ }
+
+ bool& m_guardCalled;
+};
+}
+
+RUNNER_TEST_GROUP_INIT(DPL)
+
+/*
+Name: ScopeGuard_MakeScopeGuard_RegularFunction
+Description: tests scope guard, created explicitly, with regular function
+Expected: guard should be called
+*/
+RUNNER_TEST(ScopeGuard_MakeScopeGuard_RegularFunction)
+{
+ g_guardCalled = false;
+ {
+ auto guard = DPL::MakeScopeGuard(regularFunction);
+ }
+ RUNNER_ASSERT(g_guardCalled);
+}
+
+/*
+Name: ScopeGuard_MakeScopeGuard_Functor
+Description: tests scope guard, created explicitly, with a functor
+Expected: guard should be called
+*/
+RUNNER_TEST(ScopeGuard_MakeScopeGuard_Functor)
+{
+ g_guardCalled = false;
+ {
+ auto guard = DPL::MakeScopeGuard(Functor(g_guardCalled));
+ }
+ RUNNER_ASSERT(g_guardCalled);
+}
+
+/*
+Name: ScopeGuard_MakeScopeGuard_Lambda
+Description: tests scope guard, created explicitly, with a lambda
+Expected: guard should be called
+*/
+RUNNER_TEST(ScopeGuard_MakeScopeGuard_Lambda)
+{
+ g_guardCalled = false;
+ {
+ auto guard = DPL::MakeScopeGuard(
+ [&g_guardCalled](){ g_guardCalled = true; });
+ }
+ RUNNER_ASSERT(g_guardCalled);
+}
+
+/*
+Name: ScopeGuard_Macro
+Description: tests scope guard, created implicitly, with a lambda
+Expected: guard should be called
+*/
+RUNNER_TEST(ScopeGuard_Macro)
+{
+ g_guardCalled = false;
+ {
+ DPL_SCOPE_EXIT(&g_guardCalled)
+ {
+ g_guardCalled = true;
+ };
+ }
+ RUNNER_ASSERT(g_guardCalled);
+}
+
+/*
+Name: ScopeGuard_Release
+Description: tests scope guard releasing API
+Expected: guard should not be called
+*/
+RUNNER_TEST(ScopeGuard_Release)
+{
+ g_guardCalled = false;
+ {
+ auto guard = DPL::MakeScopeGuard(
+ [&g_guardCalled](){ g_guardCalled = true; });
+ guard.Release();
+ }
+ RUNNER_ASSERT(!g_guardCalled);
+}
int id;
Foo(int i = 0) : id(i)
{
- LogInfo("Foo: ctor: " << id);
+ LogDebug("Foo: ctor: " << id);
}
~Foo()
{
- LogInfo("Foo: dtor: " << id);
+ LogDebug("Foo: dtor: " << id);
g_wasFooDeleted = true;
}
void Bar()
{
- LogInfo("Foo: bar");
+ LogDebug("Foo: bar");
}
};
protected:
virtual int ThreadEntry()
{
- LogInfo("In thread");
+ LogDebug("In thread");
RUNNER_ASSERT(!g_foo);
RUNNER_ASSERT(g_foo.IsNull());
using namespace WrtDB;
namespace {
-class WacSecurityMock : public WrtDB::IWacSecurity
+class WacSecurityMock : public WrtDB::IWidgetSecurity
{
public:
WacSecurityMock() :
mRecognized(false),
- mDistributorSigned(false),
- mWacSigned(false)
+ mDistributorSigned(false)
{}
virtual const WidgetCertificateDataList& getCertificateList() const
{
return mDistributorSigned;
}
- virtual bool isWacSigned() const
- {
- return mWacSigned;
- }
virtual void getCertificateChainList(CertificateChainList& /*lst*/) const {}
virtual void getCertificateChainList(CertificateChainList& /*lst*/,
CertificateSource /*source*/) const {}
{
mDistributorSigned = distributorSigned;
}
- void setWacSigned(bool wacSigned)
- {
- mWacSigned = wacSigned;
- }
private:
WrtDB::WidgetCertificateDataList mList;
// known distribuor
bool mDistributorSigned;
// distributor is wac
- bool mWacSigned;
};
TizenAppId _registerWidget(const WidgetRegisterInfo& regInfo,
- const IWacSecurity& sec,
+ const IWidgetSecurity& sec,
int line)
{
TizenAppId tizenAppId;
RUNNER_ASSERT(!dao.isDistributorSigned());
RUNNER_ASSERT(!dao.isRecognized());
- RUNNER_ASSERT(!dao.isWacSigned());
}
sec.setDistributorSigned(true);
sec.setRecognized(true);
- sec.setWacSigned(true);
{
// register widget
TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
RUNNER_ASSERT(dao.isDistributorSigned());
RUNNER_ASSERT(dao.isRecognized());
- RUNNER_ASSERT(dao.isWacSigned());
}
}
RUNNER_ASSERT_MSG(dao.getCspPolicy().IsNull(), "Policy is not null");
}
}
-#undef RUNNER_ASSERT_WHAT_EQUALS
\ No newline at end of file
+#undef RUNNER_ASSERT_WHAT_EQUALS
WrtDB::WrtDatabase::attachToThreadRW();
CustomHandlerDB::Interface::attachDatabaseRW();
- LogInfo("Starting tests");
+ LogDebug("Starting tests");
int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc,
argv);
{
LoopControl::init_loop(argc, argv);
- LogInfo("Running tests");
+ LogDebug("Running tests");
int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc,
argv);
void OnDelegateTest(const int &k)
{
- LogInfo("Got delegate call");
+ LogDebug("Got delegate call");
g_delegateTest = k;
}
{
event.GetArg0() (); //calling intercontext delegate
if (++m_reuseCount < ReuseCount) {
- LogInfo("[Send] Reuse: " << m_reuseCount);
+ LogDebug("[Send] Reuse: " << m_reuseCount);
DPL::Event::ControllerEventHandler<ReuseCountEvent>::PostEvent(
event);
}
--- /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 Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+# @version 1.0
+# @brief
+#
+
+#
+# Test files
+#
+# Define all DPL tests sources.
+# Runner is responsible for runnint it all and
+# generating proper output files
+#
+
+SET(TARGET_NAME "wrt-commons-tests-i18n")
+
+# Set DPL tests sources
+SET(DPL_TESTS_I18N_SOURCES
+ ${TESTS_DIR}/i18n/main.cpp
+ ${TESTS_DIR}/i18n/test_i18n_dao_read_only.cpp
+)
+
+#include subdirectory
+WRT_TEST_ADD_INTERNAL_DEPENDENCIES(${TARGET_NAME} ${TARGET_I18N_DAO_RO_LIB})
+WRT_TEST_BUILD(${TARGET_NAME} ${DPL_TESTS_I18N_SOURCES})
+WRT_TEST_INSTALL(${TARGET_NAME})
--- /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 main.cpp
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file is the implementation file of main.
+ */
+
+#include <dpl/test/test_runner.h>
+
+int main(int argc, char *argv[])
+{
+ return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
+}
--- /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 test_i18n_dao_read_only.cpp
+ * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
+ * @version 1.0
+ * @brief This file is the implementation file of i18n dao tests
+ */
+#include <dpl/test/test_runner.h>
+#include <dpl/log/log.h>
+#include <wrt-commons/i18n-dao-ro/i18n_database.h>
+#include <wrt-commons/i18n-dao-ro/i18n_dao_read_only.h>
+
+RUNNER_TEST_GROUP_INIT(I18N)
+
+/*
+Name: I18nDAOReadOnly_IsValidSubTag_True
+Description: Test valid IANA subtag presence
+Expected: Subtag found
+*/
+RUNNER_TEST(I18nDAOReadOnly_IsValidSubTag_True)
+{
+ I18n::DB::Interface::attachDatabaseRO();
+ bool result = I18n::DB::I18nDAOReadOnly::IsValidSubTag(L"aa", 0);
+ I18n::DB::Interface::detachDatabase();
+ RUNNER_ASSERT_MSG(result, "Subtag not found");
+}
+
+/*
+Name: I18nDAOReadOnly_IsValidSubTag_False
+Description: Test invalid IANA subtag presence
+Expected: Subtag not found
+*/
+RUNNER_TEST(I18nDAOReadOnly_IsValidSubTag_False)
+{
+ I18n::DB::Interface::attachDatabaseRO();
+ bool result = I18n::DB::I18nDAOReadOnly::IsValidSubTag(L"xxx000xxx", -1);
+ I18n::DB::Interface::detachDatabase();
+ RUNNER_ASSERT_MSG(!result, "Subtag found");
+}
RUNNER_TEST(tagsFromSystemLocales)
{
- LogInfo("Generating tags from system locales");
+ LogDebug("Generating tags from system locales");
char* currlocals = vconf_get_str(VCONFKEY_LANGSET);
LogDebug("Locales fetched from system settings: " << currlocals);
RUNNER_TEST(tagsFromGivenLocales)
{
- LogInfo("Generating tags from given locales");
+ LogDebug("Generating tags from given locales");
const char *locales1 = "it_IT.UTF-8", *locales2="en_GB";
RUNNER_TEST(tagsFromNullLocales)
{
- LogInfo("Generating tags when NULL locales given");
+ LogDebug("Generating tags when NULL locales given");
LanguageTagsProviderSingleton::Instance().setLanguageTagsFromLocales(NULL);
LanguageTags ltlist = LanguageTagsProviderSingleton::Instance().getLanguageTags();
RUNNER_TEST(tagsFromGivenTagList)
{
- LogInfo("Copying given tags list");
+ LogDebug("Copying given tags list");
LogDebug("Correct full list (with default values)");
LanguageTags correct;
RUNNER_TEST(tagsFromEmptyList)
{
- LogInfo("Generating tags when empty tag list given");
+ LogDebug("Generating tags when empty tag list given");
LanguageTags input;
LanguageTagsProviderSingleton::Instance().setLanguageTags(input);
RUNNER_TEST(defaultWidgetLocale)
{
- LogInfo("Adding default widget locales to language tags list");
+ LogDebug("Adding default widget locales to language tags list");
LanguageTags input;
input.push_back(L"de-DE");
int main (int argc, char *argv[])
{
- LogInfo("Starting miscellaneous unit tests");
+ LogDebug("Starting miscellaneous unit tests");
int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
return status;
m_output(output),
m_dataSize(dataSize)
{
- LogInfo("Thread created");
+ LogDebug("Thread created");
}
protected:
virtual int ThreadEntry()
{
- LogInfo("Entering copy thread");
+ LogDebug("Entering copy thread");
Try
{
return 0;
}
- LogInfo("Copy finished");
+ LogDebug("Copy finished");
return 0;
}
};
// Create and wait for notification. Make sure that the thread/controller 0
// is created first
- LogInfo("Creating controllers");
+ LogDebug("Creating controllers");
for (size_t i = 0; i < MAX_THREADS; ++i) {
controller[i] = new ShmController4(&waitable[i]);
Wait(waitable[i]);
MTSharedObjectPtr singleton = SharedObjectSingleton::Instance();
for (size_t repeats = 0; repeats < SINGLETON_TEST_REPEATS; ++repeats) {
- LogInfo("%%%%%%%%%%%%%%%%%%%%%");
- LogInfo("Iteration " << repeats + 1 << " of " << SINGLETON_TEST_REPEATS);
+ LogDebug("%%%%%%%%%%%%%%%%%%%%%");
+ LogDebug("Iteration " << repeats + 1 << " of " << SINGLETON_TEST_REPEATS);
singleton->Clear();
// add listeners
- LogInfo("Adding listeners");
+ LogDebug("Adding listeners");
for (size_t i = 0; i < MAX_THREADS; ++i) {
controller[i]->PostEvent(ShmController4::ADD_LISTENERS);
}
RUNNER_ASSERT(checkArray[2] == 0);
// change
- LogInfo("Setting property 0");
+ LogDebug("Setting property 0");
sho->SetProperty<0>(1);
// wait for confirmations
MultipleWait(waitable);
// change
- LogInfo("Setting property 1");
+ LogDebug("Setting property 1");
sho->SetProperty<1>(11);
// wait for confirmations
MultipleWait(waitable);
// change
- LogInfo("Setting property 2");
+ LogDebug("Setting property 2");
sho->SetProperty<2>('a');
// wait for confirmations
MultipleWait(waitable);
// change
- LogInfo("Setting property 3");
+ LogDebug("Setting property 3");
sho->SetProperty<3>(array);
// wait for confirmations
MultipleWait(waitable);
// remove listeners
- LogInfo("Removing listeners");
+ LogDebug("Removing listeners");
for (size_t i = 0; i < MAX_THREADS; ++i) {
controller[i]->PostEvent(ShmController4::REMOVE_LISTENERS);
}
MultipleWait(waitable);
// check if listeners array is empty
- LogInfo("Checking listeners");
+ LogDebug("Checking listeners");
for (size_t i = 0; i < MAX_THREADS; ++i) {
LISTENER_ASSERT(0);
LISTENER_ASSERT(1);
// Destroy controllers and wait for confirmation. Make sure that
// thread/controller 0 is destroyed in the end
- LogInfo("Destroying controllers");
+ LogDebug("Destroying controllers");
for (int i = MAX_THREADS - 1; i >= 0; --i) {
controller[i]->PostEvent(DESTROY_EVENT);
Wait(waitable[i]);
* This is to properly close all waitable handles opened by
* SharedObject in thread 0.
*/
- LogInfo("Destroying singleton");
+ LogDebug("Destroying singleton");
controller[i]->PostEvent(ShmController4::DESTROY_SINGLETON);
Wait(waitable[i]);
}
void StepOne()
{
- LogInfo("Step one");
+ LogDebug("Step one");
}
void StepTwo()
{
- LogInfo("Step two");
+ LogDebug("Step two");
}
void StepThree()
{
- LogInfo("Step three");
+ LogDebug("Step three");
}
public: