summaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgrFullConnector.cpp
blob: 30f31e96942a71e2b212baf92599552f27d74b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/*
 * Copyright (c) 2015, Intel Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation and/or
 * other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors
 * may be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#include "ParameterMgrFullConnector.h"
#include "ParameterMgr.h"
#include "ParameterMgrLogger.h"

#include <list>

using std::string;

CParameterMgrFullConnector::CParameterMgrFullConnector(const string& strConfigurationFilePath) :
    _pParameterMgr(new CParameterMgr(strConfigurationFilePath)), _pLogger(NULL)
{
    _pParameterMgrLogger = new CParameterMgrLogger<CParameterMgrFullConnector>(*this);
    _pParameterMgr->setLogger(_pParameterMgrLogger);
}

CParameterMgrFullConnector::~CParameterMgrFullConnector()
{
    delete _pParameterMgr;
    delete _pParameterMgrLogger;
}


bool CParameterMgrFullConnector::start(string& strError)
{
    // Create data structure & Init flow
    return _pParameterMgr->load(strError) && _pParameterMgr->init(strError);
}

void CParameterMgrFullConnector::setLogger(CParameterMgrFullConnector::ILogger* pLogger)
{
    _pLogger = pLogger;
}

// Private logging
void CParameterMgrFullConnector::doLog(bool bIsWarning, const string& strLog)
{
    if (_pLogger) {

        _pLogger->log(bIsWarning, strLog);
    }
}

CParameterHandle* CParameterMgrFullConnector::createParameterHandle(const string& strPath,
                                                                    string& strError)
{
    return _pParameterMgr->createParameterHandle(strPath, strError);
}

ISelectionCriterionTypeInterface* CParameterMgrFullConnector::createSelectionCriterionType(
        bool bIsInclusive)
{
    return _pParameterMgr->createSelectionCriterionType(bIsInclusive);
}

ISelectionCriterionInterface* CParameterMgrFullConnector::createSelectionCriterion(
        const string& strName,
        const ISelectionCriterionTypeInterface* pSelectionCriterionType)
{
    return _pParameterMgr->createSelectionCriterion(strName,
            static_cast<const CSelectionCriterionType*>(pSelectionCriterionType));
}

ISelectionCriterionInterface* CParameterMgrFullConnector::getSelectionCriterion(
        const string& strName)
{
    return _pParameterMgr->getSelectionCriterion(strName);
}

bool CParameterMgrFullConnector::getForceNoRemoteInterface() const
{
    return _pParameterMgr->getForceNoRemoteInterface();
}

void CParameterMgrFullConnector::setForceNoRemoteInterface(bool bForceNoRemoteInterface)
{
    _pParameterMgr->setForceNoRemoteInterface(bForceNoRemoteInterface);
}

void CParameterMgrFullConnector::applyConfigurations()
{
    return _pParameterMgr->applyConfigurations();
}

void CParameterMgrFullConnector::setFailureOnMissingSubsystem(bool bFail)
{
    _pParameterMgr->setFailureOnMissingSubsystem(bFail);
}

bool CParameterMgrFullConnector::getFailureOnMissingSubsystem() const
{
    return _pParameterMgr->getFailureOnMissingSubsystem();
}

void CParameterMgrFullConnector::setFailureOnFailedSettingsLoad(bool bFail)
{
    _pParameterMgr->setFailureOnFailedSettingsLoad(bFail);
}

bool CParameterMgrFullConnector::getFailureOnFailedSettingsLoad()
{
    return _pParameterMgr->getFailureOnFailedSettingsLoad();
}

const string& CParameterMgrFullConnector::getSchemaFolderLocation() const
{
    return _pParameterMgr->getSchemaFolderLocation();
}

void CParameterMgrFullConnector::setSchemaFolderLocation(const string& strSchemaFolderLocation)
{
    _pParameterMgr->setSchemaFolderLocation(strSchemaFolderLocation);
}

void CParameterMgrFullConnector::setValidateSchemasOnStart(bool bValidate)
{
    _pParameterMgr->setValidateSchemasOnStart(bValidate);
}

bool CParameterMgrFullConnector::getValidateSchemasOnStart() const
{
    return _pParameterMgr->getValidateSchemasOnStart();
}

bool CParameterMgrFullConnector::setTuningMode(bool bOn, string& strError)
{
    return _pParameterMgr->setTuningMode(bOn, strError);
}

bool CParameterMgrFullConnector::isTuningModeOn() const
{
    return _pParameterMgr->tuningModeOn();
}

void CParameterMgrFullConnector::setValueSpace(bool bIsRaw)
{
    return _pParameterMgr->setValueSpace(bIsRaw);
}

bool CParameterMgrFullConnector::isValueSpaceRaw() const
{
    return _pParameterMgr->valueSpaceIsRaw();
}

void CParameterMgrFullConnector::setOutputRawFormat(bool bIsHex)
{
    return _pParameterMgr->setOutputRawFormat(bIsHex);
}

bool CParameterMgrFullConnector::isOutputRawFormatHex() const
{
    return _pParameterMgr->outputRawFormatIsHex();
}

bool CParameterMgrFullConnector::setAutoSync(bool bAutoSyncOn, string& strError)
{
    return _pParameterMgr->setAutoSync(bAutoSyncOn, strError);
}

bool CParameterMgrFullConnector::isAutoSyncOn() const
{
    return _pParameterMgr->autoSyncOn();
}

bool CParameterMgrFullConnector::sync(string& strError)
{
    return _pParameterMgr->sync(strError);
}

bool CParameterMgrFullConnector::accessParameterValue(const string& strPath, string& strValue,
                                                      bool bSet, string& strError)
{
    return _pParameterMgr->accessParameterValue(strPath, strValue, bSet, strError);
}

bool CParameterMgrFullConnector::accessConfigurationValue(const string &strDomain,
                                                          const string &strConfiguration,
                                                          const string& strPath, string& strValue,
                                                          bool bSet, string& strError)
{
    return _pParameterMgr->accessConfigurationValue(strDomain, strConfiguration, strPath, strValue,
            bSet, strError);
}

bool CParameterMgrFullConnector::getParameterMapping(const string& strPath, string& strValue) const
{
    return _pParameterMgr->getParameterMapping(strPath, strValue);
}

bool CParameterMgrFullConnector::createDomain(const string& strName, string& strError)
{
    return _pParameterMgr->createDomain(strName, strError);
}

bool CParameterMgrFullConnector::deleteDomain(const string& strName, string& strError)
{
    return _pParameterMgr->deleteDomain(strName, strError);
}

bool CParameterMgrFullConnector::renameDomain(const string& strName, const string& strNewName,
                                              string& strError)
{
    return _pParameterMgr->renameDomain(strName, strNewName, strError);
}

bool CParameterMgrFullConnector::deleteAllDomains(string& strError)
{
    return _pParameterMgr->deleteAllDomains(strError);
}

bool CParameterMgrFullConnector::createConfiguration(const string& strDomain,
                                                     const string& strConfiguration,
                                                     string& strError)
{
    return _pParameterMgr->createConfiguration(strDomain, strConfiguration, strError);
}

bool CParameterMgrFullConnector::deleteConfiguration(const string& strDomain,
                                                     const string& strConfiguration,
                                                     string& strError)
{
    return _pParameterMgr->deleteConfiguration(strDomain, strConfiguration, strError);
}

bool CParameterMgrFullConnector::renameConfiguration(const string& strDomain,
                                                     const string& strConfiguration,
                                                     const string& strNewConfiguration,
                                                     string& strError)
{
    return _pParameterMgr->renameConfiguration(strDomain, strConfiguration, strNewConfiguration,
            strError);
}

bool CParameterMgrFullConnector::saveConfiguration(const string& strDomain,
                                                   const string& strConfiguration, string& strError)
{
    return _pParameterMgr->saveConfiguration(strDomain, strConfiguration, strError);
}

bool CParameterMgrFullConnector::restoreConfiguration(const string& strDomain,
                                                      const string& strConfiguration,
                                                      std::list<string>& lstrError)
{
    return _pParameterMgr->restoreConfiguration(strDomain, strConfiguration, lstrError);
}

bool CParameterMgrFullConnector::setSequenceAwareness(const string& strName, bool bSequenceAware,
                                                      string& strResult)
{
    return _pParameterMgr->setSequenceAwareness(strName, bSequenceAware, strResult);
}

bool CParameterMgrFullConnector::getSequenceAwareness(const string& strName, bool& bSequenceAware,
                                                      string& strResult)
{
    return _pParameterMgr->getSequenceAwareness(strName, bSequenceAware, strResult);
}

bool CParameterMgrFullConnector::addConfigurableElementToDomain(const string& strDomain,
        const string& strConfigurableElementPath, string& strError)
{
    return _pParameterMgr->addConfigurableElementToDomain(strDomain, strConfigurableElementPath,
            strError);
}

bool CParameterMgrFullConnector::removeConfigurableElementFromDomain(const string& strDomain,
        const string& strConfigurableElementPath, string& strError)
{
    return _pParameterMgr->removeConfigurableElementFromDomain(strDomain,
            strConfigurableElementPath, strError);
}

bool CParameterMgrFullConnector::split(const string& strDomain, 
                                       const string& strConfigurableElementPath, string& strError)
{
    return _pParameterMgr->split(strDomain, strConfigurableElementPath, strError);
}

bool CParameterMgrFullConnector::setElementSequence(const string& strDomain,
        const string& strConfiguration,
        const std::vector<string>& astrNewElementSequence,
        string& strError)
{
    return _pParameterMgr->setElementSequence(strDomain, strConfiguration, astrNewElementSequence,
            strError);
}

bool CParameterMgrFullConnector::setApplicationRule(const string& strDomain,
                                                    const string& strConfiguration,
                                                    const string& strApplicationRule,
                                                    string& strError)
{
    return _pParameterMgr->setApplicationRule(strDomain, strConfiguration, strApplicationRule,
            strError);
}


bool CParameterMgrFullConnector::getApplicationRule(const string& strDomain,
                                                    const string& strConfiguration,
                                                    string& strResult)
{
    return _pParameterMgr->getApplicationRule(strDomain, strConfiguration, strResult);
}
bool CParameterMgrFullConnector::clearApplicationRule(const string& strDomain,
                                                      const string& strConfiguration,
                                                      string& strError)
{
    return _pParameterMgr->clearApplicationRule(strDomain, strConfiguration, strError);
}


bool CParameterMgrFullConnector::importDomainsXml(const string& strXmlSource, bool bWithSettings,
                                                  bool bFromFile, string& strError)
{
    return _pParameterMgr->importDomainsXml(strXmlSource, bWithSettings, bFromFile, strError);
}

bool CParameterMgrFullConnector::exportDomainsXml(string& strXmlDest, bool bWithSettings,
                                                  bool bToFile, string& strError) const
{
    return _pParameterMgr->exportDomainsXml(strXmlDest, bWithSettings, bToFile, strError);
}

bool CParameterMgrFullConnector::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
                                                       string& strError)
{
    return _pParameterMgr->importSingleDomainXml(strXmlSource, bOverwrite, strError);
}

bool CParameterMgrFullConnector::exportSingleDomainXml(string& strXmlDest,
                                                       const string& strDomainName,
                                                       bool bWithSettings, bool bToFile,
                                                       string& strError) const
{
    return _pParameterMgr->exportSingleDomainXml(strXmlDest, strDomainName, bWithSettings, bToFile,
            strError);
}