Blame view

src/XMLParameterConfigurator/GetAMDAParamNode.cc 1.27 KB
fbe3c2bb   Benjamin Renard   First commit
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
/*
 * AMDAParamNNode.cc
 *
 *  Created on: Nov 16, 2012
 *      Author: f.casimir
 */

#include "ServicesServer.hh"
#include "Parameter.hh"
#include "FileConfigurator.hh"
#include "ParamGet.hh"
#include "ParameterManager.hh"

#include "Constant.hh"

#include "Config.hh"
#include "GetAMDAParamNode.hh"

using namespace AMDA::Parameters;
using namespace AMDA::XMLConfigurator;

namespace AMDA {
	namespace XMLParameterConfigurator {

		GetAMDAParamNode::GetAMDAParamNode() {
		}

		GetAMDAParamNode::~GetAMDAParamNode() {
		}

		void GetAMDAParamNode::proceed(xmlNodePtr pNode,		const AMDA::Parameters::CfgContext& pContext) {
			LOG4CXX_DEBUG(gLogger,	"GetAMDAParamNode::proceed: '" << pNode->name << "' node")

			ParameterManager* lParameterManager =  pContext.get<ParameterManager*>();
fbe3c2bb   Benjamin Renard   First commit
35
36

			try {
c6a67968   Benjamin Renard   Fix some violatio...
37
38
39
40
41
42
43
				xmlChar* lParamName = xmlGetProp(pNode, (const xmlChar *) PARAMNAME);
				std::string paramNameStr;
				if (lParamName) {
					paramNameStr = std::string((const char*)lParamName);
					xmlFree(lParamName);
				}
				else {
fbe3c2bb   Benjamin Renard   First commit
44
45
46
					ERROR_EXCEPTION(
							ERROR_MANDATORY_ATTRIBUTE_MISSING << pNode->name << "@" << PARAMNAME)
				}
c6a67968   Benjamin Renard   Fix some violatio...
47
				lParameterManager->createParameter(paramNameStr.c_str());
fbe3c2bb   Benjamin Renard   First commit
48
			} catch (...) {
fbe3c2bb   Benjamin Renard   First commit
49
50
				throw;
			}
fbe3c2bb   Benjamin Renard   First commit
51
52
53
54
		}

	} /* namespace XMLParameterConfigurator */
} /* namespace AMDA */