• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015, Intel Corporation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation and/or
13  * other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 #include "ParameterMgrFullConnector.h"
31 #include "ParameterMgr.h"
32 #include "ParameterMgrLogger.h"
33 
34 #include "CommandHandlerWrapper.h"
35 
36 #include <list>
37 
38 using std::string;
39 
CParameterMgrFullConnector(const string & strConfigurationFilePath)40 CParameterMgrFullConnector::CParameterMgrFullConnector(const string &strConfigurationFilePath)
41     : CParameterMgrPlatformConnector(strConfigurationFilePath)
42 {
43 }
44 
createCommandHandler()45 CommandHandlerInterface *CParameterMgrFullConnector::createCommandHandler()
46 {
47     return new CommandHandlerWrapper(_pParameterMgr->createCommandHandler());
48 }
49 
setFailureOnMissingSubsystem(bool bFail)50 void CParameterMgrFullConnector::setFailureOnMissingSubsystem(bool bFail)
51 {
52     std::string error;
53     setFailureOnMissingSubsystem(bFail, error);
54 }
55 
setFailureOnFailedSettingsLoad(bool bFail)56 void CParameterMgrFullConnector::setFailureOnFailedSettingsLoad(bool bFail)
57 {
58     std::string error;
59     setFailureOnFailedSettingsLoad(bFail, error);
60 }
61 
setValidateSchemasOnStart(bool bValidate)62 void CParameterMgrFullConnector::setValidateSchemasOnStart(bool bValidate)
63 {
64     std::string error;
65     setValidateSchemasOnStart(bValidate, error);
66 }
67 
setTuningMode(bool bOn,string & strError)68 bool CParameterMgrFullConnector::setTuningMode(bool bOn, string &strError)
69 {
70     return _pParameterMgr->setTuningMode(bOn, strError);
71 }
72 
isTuningModeOn() const73 bool CParameterMgrFullConnector::isTuningModeOn() const
74 {
75     return _pParameterMgr->tuningModeOn();
76 }
77 
setValueSpace(bool bIsRaw)78 void CParameterMgrFullConnector::setValueSpace(bool bIsRaw)
79 {
80     _pParameterMgr->setValueSpace(bIsRaw);
81 }
82 
isValueSpaceRaw() const83 bool CParameterMgrFullConnector::isValueSpaceRaw() const
84 {
85     return _pParameterMgr->valueSpaceIsRaw();
86 }
87 
setOutputRawFormat(bool bIsHex)88 void CParameterMgrFullConnector::setOutputRawFormat(bool bIsHex)
89 {
90     _pParameterMgr->setOutputRawFormat(bIsHex);
91 }
92 
isOutputRawFormatHex() const93 bool CParameterMgrFullConnector::isOutputRawFormatHex() const
94 {
95     return _pParameterMgr->outputRawFormatIsHex();
96 }
97 
setAutoSync(bool bAutoSyncOn,string & strError)98 bool CParameterMgrFullConnector::setAutoSync(bool bAutoSyncOn, string &strError)
99 {
100     return _pParameterMgr->setAutoSync(bAutoSyncOn, strError);
101 }
102 
isAutoSyncOn() const103 bool CParameterMgrFullConnector::isAutoSyncOn() const
104 {
105     return _pParameterMgr->autoSyncOn();
106 }
107 
sync(string & strError)108 bool CParameterMgrFullConnector::sync(string &strError)
109 {
110     return _pParameterMgr->sync(strError);
111 }
112 
accessParameterValue(const string & strPath,string & strValue,bool bSet,string & strError)113 bool CParameterMgrFullConnector::accessParameterValue(const string &strPath, string &strValue,
114                                                       bool bSet, string &strError)
115 {
116     return _pParameterMgr->accessParameterValue(strPath, strValue, bSet, strError);
117 }
118 
accessConfigurationValue(const string & strDomain,const string & strConfiguration,const string & strPath,string & strValue,bool bSet,string & strError)119 bool CParameterMgrFullConnector::accessConfigurationValue(const string &strDomain,
120                                                           const string &strConfiguration,
121                                                           const string &strPath, string &strValue,
122                                                           bool bSet, string &strError)
123 {
124     return _pParameterMgr->accessConfigurationValue(strDomain, strConfiguration, strPath, strValue,
125                                                     bSet, strError);
126 }
127 
getParameterMapping(const string & strPath,string & strValue) const128 bool CParameterMgrFullConnector::getParameterMapping(const string &strPath, string &strValue) const
129 {
130     return _pParameterMgr->getParameterMapping(strPath, strValue);
131 }
132 
createDomain(const string & strName,string & strError)133 bool CParameterMgrFullConnector::createDomain(const string &strName, string &strError)
134 {
135     return _pParameterMgr->createDomain(strName, strError);
136 }
137 
deleteDomain(const string & strName,string & strError)138 bool CParameterMgrFullConnector::deleteDomain(const string &strName, string &strError)
139 {
140     return _pParameterMgr->deleteDomain(strName, strError);
141 }
142 
renameDomain(const string & strName,const string & strNewName,string & strError)143 bool CParameterMgrFullConnector::renameDomain(const string &strName, const string &strNewName,
144                                               string &strError)
145 {
146     return _pParameterMgr->renameDomain(strName, strNewName, strError);
147 }
148 
deleteAllDomains(string & strError)149 bool CParameterMgrFullConnector::deleteAllDomains(string &strError)
150 {
151     return _pParameterMgr->deleteAllDomains(strError);
152 }
153 
createConfiguration(const string & strDomain,const string & strConfiguration,string & strError)154 bool CParameterMgrFullConnector::createConfiguration(const string &strDomain,
155                                                      const string &strConfiguration,
156                                                      string &strError)
157 {
158     return _pParameterMgr->createConfiguration(strDomain, strConfiguration, strError);
159 }
160 
deleteConfiguration(const string & strDomain,const string & strConfiguration,string & strError)161 bool CParameterMgrFullConnector::deleteConfiguration(const string &strDomain,
162                                                      const string &strConfiguration,
163                                                      string &strError)
164 {
165     return _pParameterMgr->deleteConfiguration(strDomain, strConfiguration, strError);
166 }
167 
renameConfiguration(const string & strDomain,const string & strConfiguration,const string & strNewConfiguration,string & strError)168 bool CParameterMgrFullConnector::renameConfiguration(const string &strDomain,
169                                                      const string &strConfiguration,
170                                                      const string &strNewConfiguration,
171                                                      string &strError)
172 {
173     return _pParameterMgr->renameConfiguration(strDomain, strConfiguration, strNewConfiguration,
174                                                strError);
175 }
176 
saveConfiguration(const string & strDomain,const string & strConfiguration,string & strError)177 bool CParameterMgrFullConnector::saveConfiguration(const string &strDomain,
178                                                    const string &strConfiguration, string &strError)
179 {
180     return _pParameterMgr->saveConfiguration(strDomain, strConfiguration, strError);
181 }
182 
restoreConfiguration(const string & strDomain,const string & strConfiguration,Results & errors)183 bool CParameterMgrFullConnector::restoreConfiguration(const string &strDomain,
184                                                       const string &strConfiguration,
185                                                       Results &errors)
186 {
187     return _pParameterMgr->restoreConfiguration(strDomain, strConfiguration, errors);
188 }
189 
setSequenceAwareness(const string & strName,bool bSequenceAware,string & strResult)190 bool CParameterMgrFullConnector::setSequenceAwareness(const string &strName, bool bSequenceAware,
191                                                       string &strResult)
192 {
193     return _pParameterMgr->setSequenceAwareness(strName, bSequenceAware, strResult);
194 }
195 
getSequenceAwareness(const string & strName,bool & bSequenceAware,string & strResult)196 bool CParameterMgrFullConnector::getSequenceAwareness(const string &strName, bool &bSequenceAware,
197                                                       string &strResult)
198 {
199     return _pParameterMgr->getSequenceAwareness(strName, bSequenceAware, strResult);
200 }
201 
addConfigurableElementToDomain(const string & strDomain,const string & strConfigurableElementPath,string & strError)202 bool CParameterMgrFullConnector::addConfigurableElementToDomain(
203     const string &strDomain, const string &strConfigurableElementPath, string &strError)
204 {
205     return _pParameterMgr->addConfigurableElementToDomain(strDomain, strConfigurableElementPath,
206                                                           strError);
207 }
208 
removeConfigurableElementFromDomain(const string & strDomain,const string & strConfigurableElementPath,string & strError)209 bool CParameterMgrFullConnector::removeConfigurableElementFromDomain(
210     const string &strDomain, const string &strConfigurableElementPath, string &strError)
211 {
212     return _pParameterMgr->removeConfigurableElementFromDomain(
213         strDomain, strConfigurableElementPath, strError);
214 }
215 
split(const string & strDomain,const string & strConfigurableElementPath,string & strError)216 bool CParameterMgrFullConnector::split(const string &strDomain,
217                                        const string &strConfigurableElementPath, string &strError)
218 {
219     return _pParameterMgr->split(strDomain, strConfigurableElementPath, strError);
220 }
221 
setElementSequence(const string & strDomain,const string & strConfiguration,const std::vector<string> & astrNewElementSequence,string & strError)222 bool CParameterMgrFullConnector::setElementSequence(
223     const string &strDomain, const string &strConfiguration,
224     const std::vector<string> &astrNewElementSequence, string &strError)
225 {
226     return _pParameterMgr->setElementSequence(strDomain, strConfiguration, astrNewElementSequence,
227                                               strError);
228 }
229 
setApplicationRule(const string & strDomain,const string & strConfiguration,const string & strApplicationRule,string & strError)230 bool CParameterMgrFullConnector::setApplicationRule(const string &strDomain,
231                                                     const string &strConfiguration,
232                                                     const string &strApplicationRule,
233                                                     string &strError)
234 {
235     return _pParameterMgr->setApplicationRule(strDomain, strConfiguration, strApplicationRule,
236                                               strError);
237 }
238 
getApplicationRule(const string & strDomain,const string & strConfiguration,string & strResult)239 bool CParameterMgrFullConnector::getApplicationRule(const string &strDomain,
240                                                     const string &strConfiguration,
241                                                     string &strResult)
242 {
243     return _pParameterMgr->getApplicationRule(strDomain, strConfiguration, strResult);
244 }
clearApplicationRule(const string & strDomain,const string & strConfiguration,string & strError)245 bool CParameterMgrFullConnector::clearApplicationRule(const string &strDomain,
246                                                       const string &strConfiguration,
247                                                       string &strError)
248 {
249     return _pParameterMgr->clearApplicationRule(strDomain, strConfiguration, strError);
250 }
251 
importDomainsXml(const string & strXmlSource,bool bWithSettings,bool bFromFile,string & strError)252 bool CParameterMgrFullConnector::importDomainsXml(const string &strXmlSource, bool bWithSettings,
253                                                   bool bFromFile, string &strError)
254 {
255     return _pParameterMgr->importDomainsXml(strXmlSource, bWithSettings, bFromFile, strError);
256 }
257 
exportDomainsXml(string & strXmlDest,bool bWithSettings,bool bToFile,string & strError) const258 bool CParameterMgrFullConnector::exportDomainsXml(string &strXmlDest, bool bWithSettings,
259                                                   bool bToFile, string &strError) const
260 {
261     return _pParameterMgr->exportDomainsXml(strXmlDest, bWithSettings, bToFile, strError);
262 }
263 
264 // deprecated, use the other version of importSingleDomainXml instead
importSingleDomainXml(const string & strXmlSource,bool bOverwrite,string & strError)265 bool CParameterMgrFullConnector::importSingleDomainXml(const string &strXmlSource, bool bOverwrite,
266                                                        string &strError)
267 {
268     return importSingleDomainXml(strXmlSource, bOverwrite, true, false, strError);
269 }
270 
importSingleDomainXml(const string & xmlSource,bool overwrite,bool withSettings,bool fromFile,string & errorMsg)271 bool CParameterMgrFullConnector::importSingleDomainXml(const string &xmlSource, bool overwrite,
272                                                        bool withSettings, bool fromFile,
273                                                        string &errorMsg)
274 {
275     return _pParameterMgr->importSingleDomainXml(xmlSource, overwrite, withSettings, fromFile,
276                                                  errorMsg);
277 }
278 
exportSingleDomainXml(string & strXmlDest,const string & strDomainName,bool bWithSettings,bool bToFile,string & strError) const279 bool CParameterMgrFullConnector::exportSingleDomainXml(string &strXmlDest,
280                                                        const string &strDomainName,
281                                                        bool bWithSettings, bool bToFile,
282                                                        string &strError) const
283 {
284     return _pParameterMgr->exportSingleDomainXml(strXmlDest, strDomainName, bWithSettings, bToFile,
285                                                  strError);
286 }
287