GetAMDAParamNode.cc 1.27 KB
/*
 * 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*>();
			xmlChar* lParamName = NULL;

			try {

				if (!(lParamName = xmlGetProp(pNode, (const xmlChar *) PARAMNAME))) {
					ERROR_EXCEPTION(
							ERROR_MANDATORY_ATTRIBUTE_MISSING << pNode->name << "@" << PARAMNAME)
				}
				lParameterManager->createParameter(std::string((const char*)lParamName));
			} catch (...) {
				if (lParamName) {
					xmlFree(lParamName);
				}
				throw;
			}
			if (lParamName) {
				xmlFree(lParamName);
			}
		}

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