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.
16 #include <dpl/assert.h>
17 #include <dpl/log/log.h>
23 #include <ace/ConfigurationManager.h>
29 const string currentXMLSchema("bondixml.xsd");
32 ConfigurationManager * ConfigurationManager::instance = NULL;
35 string ConfigurationManager::getCurrentPolicyFile(void) const
37 LogError("ConfigurationManager::getCurrentPolicyFile is DEPRECATED");
41 string ConfigurationManager::getFullPathToCurrentPolicyFile(void) const
43 LogError("ConfigurationManager::getFullPathToCurrentPolicyFile"
48 string ConfigurationManager::getFullPathToCurrentPolicyXMLSchema(void) const
50 LogError("ConfigurationManager::getFullPathToCurrentPolicyXMLSchema"
55 int ConfigurationManager::addPolicyFile(const string &)
57 LogError("ConfigurationManager::addPolicyFile is DEPRECATED");
58 return CM_GENERAL_ERROR;
61 int ConfigurationManager::removePolicyFile(const string&)
63 LogError("ConfigurationManager::removePolicyFile is DEPRECATED");
64 return CM_GENERAL_ERROR;
67 int ConfigurationManager::changeCurrentPolicyFile(const string&)
69 LogError("ConfigurationManager::changeCurrentPolicyFile is DEPRECATED");
70 return CM_GENERAL_ERROR;
73 string ConfigurationManager::extractFilename(const string&) const
75 LogError("ConfigurationManager::extractFilename is DEPRECATED");
80 int ConfigurationManager::parse(const string&)
82 LogError("ConfigurationManager::parse is DEPRECATED");
83 return CM_GENERAL_ERROR;
86 bool ConfigurationManager::copyFile(FILE*, FILE*, int) const
88 LogError("ConfigurationManager::copyFile is DEPRECATED");
92 bool ConfigurationManager::checkIfFileExistst(const string&) const
94 LogError("ConfigurationManager::checkIfFileExistst is DEPRECATED");
98 const list<string> & ConfigurationManager::getPolicyFiles() const
100 LogError("ConfigurationManager::getPolicyFiles is DEPRECATED");
101 static list<string> aList;
105 const string & ConfigurationManager::getConfigFile() const
107 LogError("ConfigurationManager::getConfigFile is DEPRECATED");
108 static string returnString("");
112 string ConfigurationManager::getFullPathToPolicyFile(PolicyType policy) const
114 string cscStoragePath = getCscStoragePath();
115 string storagePath = getStoragePath();
119 case PolicyType::WAC2_0: {
120 fileName = ACE_WAC_POLICY_FILE_NAME;
122 case PolicyType::Tizen: {
123 fileName = ACE_TIZEN_POLICY_FILE_NAME;
126 LogError("Invalid policy file requested");
129 string cscPolicyFilePath = cscStoragePath + fileName;
130 if ( access(cscPolicyFilePath.c_str(), R_OK) == -1)
131 return storagePath + fileName;
133 return cscPolicyFilePath;
136 string ConfigurationManager::getFullPathToPolicyXMLSchema() const
138 string storagePath = getStoragePath();
139 if (*(storagePath.rbegin()) == '/')
141 return storagePath + currentXMLSchema;
143 return storagePath + "/" + currentXMLSchema;
146 string ConfigurationManager::getStoragePath(void) const
148 return ACE_MAIN_STORAGE;
151 string ConfigurationManager::getCscStoragePath(void) const
153 return ACE_CSC_STORAGE;