2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
22 #include <vcore/VCorePrivate.h>
23 #include <vcore/Config.h>
24 #include <vcore/Database.h>
25 #include <openssl/ssl.h>
26 #include <database_checksum_vcore.h>
28 #include <glib-object.h>
31 DPL::DB::ThreadDatabaseSupport threadInterface(
32 VCoreDatabaseConnectionTraits::Address(),
33 VCoreDatabaseConnectionTraits::Flags());
34 } // namespace anonymous
36 namespace ValidationCore {
38 void AttachToThread(void){
39 threadInterface.AttachToThread();
42 void DetachFromThread(void){
43 threadInterface.DetachFromThread();
46 DPL::DB::ThreadDatabaseSupport& ThreadInterface(void) {
47 return threadInterface;
50 bool VCoreInit(const std::string& configFilePath,
51 const std::string& configSchemaPath,
52 const std::string& databasePath)
58 LogDebug("Initializing VCore");
59 Config &globalConfig = ConfigSingleton::Instance();
60 bool returnValue = globalConfig.setXMLConfigPath(configFilePath) &&
61 globalConfig.setXMLSchemaPath(configSchemaPath) &&
62 globalConfig.setDatabasePath(databasePath);
64 Assert(ThreadInterface().CheckTableExist(DB_CHECKSUM_STR) &&
65 "Not a valid vcore database version");
70 } // namespace ValidationCore