Tizen 2.1 base
[framework/web/wrt-commons.git] / modules / vcore / src / vcore / Config.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef _SRC_VALIDATION_CORE_VALIDATION_CORE_CONFIG_H_
18 #define _SRC_VALIDATION_CORE_VALIDATION_CORE_CONFIG_H_
19
20 #include <string>
21
22 #include <dpl/singleton.h>
23
24 namespace ValidationCore {
25 class Config {
26 public:
27     /*
28      * Set path to config file with certificate description.
29      */
30     bool setXMLConfigPath(const std::string& path) {
31         if (!m_certificateXMLConfigPath.empty()) {
32             return false;
33         }
34         m_certificateXMLConfigPath = path;
35         return true;
36     }
37
38     /*
39      * Set path to schema of config file.
40      */
41     bool setXMLSchemaPath(const std::string& path) {
42         if (!m_certificateXMLSchemaPath.empty()) {
43             return false;
44         }
45         m_certificateXMLSchemaPath = path;
46         return true;
47     }
48
49     /*
50      * Set path to database with OCSP/CRL Cache.
51      */
52     bool setDatabasePath(const std::string& path) {
53         if (!m_databasePath.empty()) {
54             return false;
55         }
56         m_databasePath = path;
57         return true;
58     }
59
60     /*
61      * Get path to config file with certificate description.
62      */
63     std::string getXMLConfigPath() {
64         return m_certificateXMLConfigPath;
65     }
66
67     /*
68      * Get path to schema of config file.
69      */
70     std::string getXMLSchemaPath() {
71         return m_certificateXMLSchemaPath;
72     }
73
74     /*
75      * Get path to database with OCSP/CRL Cache.
76      */
77     std::string getDatabasePath() {
78         return m_databasePath;
79     }
80
81 private:
82     std::string m_certificateXMLConfigPath;
83     std::string m_certificateXMLSchemaPath;
84     std::string m_databasePath;
85 };
86
87 typedef DPL::Singleton<Config> ConfigSingleton;
88
89 } // namespace ValidationCore
90
91 #endif // _SRC_VALIDATION_CORE_VALIDATION_CORE_CONFIG_H_
92