コード例 #1
0
SmartPtrCDiagRequestDoc DiagRequestXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("DiagRequestXml", "parse");

	SmartPtrCDiagRequestDoc diagRequestDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string clientIdStrVal =
			thisXml->findRequiredAttribute("clientId");
		UUID clientIdVal = CAFCOMMON_GUID_NULL;
		if (! clientIdStrVal.empty()) {
			BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal);
		}

		const std::string requestIdStrVal =
			thisXml->findRequiredAttribute("requestId");
		UUID requestIdVal = CAFCOMMON_GUID_NULL;
		if (! requestIdStrVal.empty()) {
			BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal);
		}

		const std::string pmeIdVal =
			thisXml->findRequiredAttribute("pmeId");

		const SmartPtrCXmlElement requestHeaderXml =
			thisXml->findRequiredChild("requestHeader");

		SmartPtrCRequestHeaderDoc requestHeaderVal;
		if (! requestHeaderXml.IsNull()) {
			requestHeaderVal = RequestHeaderXml::parse(requestHeaderXml);
		}

		const SmartPtrCXmlElement batchXml =
			thisXml->findRequiredChild("batch");

		SmartPtrCDiagBatchDoc batchVal;
		if (! batchXml.IsNull()) {
			batchVal = DiagBatchXml::parse(batchXml);
		}

		diagRequestDoc.CreateInstance();
		diagRequestDoc->initialize(
			clientIdVal,
			requestIdVal,
			pmeIdVal,
			requestHeaderVal,
			batchVal);
	}
	CAF_CM_EXIT;

	return diagRequestDoc;
}
コード例 #2
0
SmartPtrCErrorResponseDoc ErrorResponseXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("ErrorResponseXml", "parse");

	SmartPtrCErrorResponseDoc errorResponseDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string clientIdStrVal =
			thisXml->findOptionalAttribute("clientId");
		UUID clientIdVal = CAFCOMMON_GUID_NULL;
		if (! clientIdStrVal.empty()) {
			BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal);
		}

		const std::string requestIdStrVal =
			thisXml->findOptionalAttribute("requestId");
		UUID requestIdVal = CAFCOMMON_GUID_NULL;
		if (! requestIdStrVal.empty()) {
			BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal);
		}

		const std::string pmeIdVal =
			thisXml->findOptionalAttribute("pmeId");

		const SmartPtrCXmlElement responseHeaderXml =
			thisXml->findOptionalChild("responseHeader");
		SmartPtrCResponseHeaderDoc responseHeaderVal;
		if (! responseHeaderXml.IsNull()) {
			responseHeaderVal = ResponseHeaderXml::parse(responseHeaderXml);
		}

		const SmartPtrCXmlElement errorMessageXml =
			thisXml->findOptionalChild("errorMessage");
		std::string errorMessageVal;
		if (! errorMessageXml.IsNull()) {
			errorMessageVal = errorMessageXml->getValue();
		}

		errorResponseDoc.CreateInstance();
		errorResponseDoc->initialize(
			clientIdVal,
			requestIdVal,
			pmeIdVal,
			responseHeaderVal,
			errorMessageVal);
	}
	CAF_CM_EXIT;

	return errorResponseDoc;
}
コード例 #3
0
SmartPtrCProviderEventResponseDoc ProviderEventResponseXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("ProviderEventResponseXml", "parse");

	SmartPtrCProviderEventResponseDoc providerEventResponseDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string pmeIdVal =
			thisXml->findRequiredAttribute("pmeId");

		const SmartPtrCXmlElement responseHeaderXml =
			thisXml->findOptionalChild("responseHeader");
		SmartPtrCResponseHeaderDoc responseHeaderVal;
		if (! responseHeaderXml.IsNull()) {
			responseHeaderVal = ResponseHeaderXml::parse(responseHeaderXml);
		}

		const SmartPtrCXmlElement manifestXml =
			thisXml->findRequiredChild("manifest");
		SmartPtrCEventManifestDoc manifestVal;
		if (! manifestXml.IsNull()) {
			manifestVal = EventManifestXml::parse(manifestXml);
		}

		const SmartPtrCXmlElement eventKeyCollectionXml =
			thisXml->findOptionalChild("eventKeyCollection");
		SmartPtrCEventKeyCollectionDoc eventKeyCollectionVal;
		if (! eventKeyCollectionXml.IsNull()) {
			eventKeyCollectionVal = EventKeyCollectionXml::parse(eventKeyCollectionXml);
		}

		const SmartPtrCXmlElement statisticsXml =
			thisXml->findOptionalChild("statistics");
		SmartPtrCStatisticsDoc statisticsVal;
		if (! statisticsXml.IsNull()) {
			statisticsVal = StatisticsXml::parse(statisticsXml);
		}

		providerEventResponseDoc.CreateInstance();
		providerEventResponseDoc->initialize(
			pmeIdVal,
			responseHeaderVal,
			manifestVal,
			eventKeyCollectionVal,
			statisticsVal);
	}
	CAF_CM_EXIT;

	return providerEventResponseDoc;
}
コード例 #4
0
SmartPtrCCmdlMetadataDoc CmdlMetadataXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("CmdlMetadataXml", "parse");

	SmartPtrCCmdlMetadataDoc cmdlMetadataDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string nameStrVal =
			thisXml->findRequiredAttribute("name");
		const std::string nameVal = nameStrVal;

		const SmartPtrCXmlElement valueXml =
			thisXml->findRequiredChild("value");

		std::string valueVal;
		if (! valueXml.IsNull()) {
			valueVal = valueXml->getValue();
		}

		cmdlMetadataDoc.CreateInstance();
		cmdlMetadataDoc->initialize(
			nameVal,
			valueVal);
	}
	CAF_CM_EXIT;

	return cmdlMetadataDoc;
}
コード例 #5
0
SmartPtrCJoinTypeDoc JoinTypeXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("JoinTypeXml", "parse");

	SmartPtrCJoinTypeDoc joinTypeDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string operandStrVal =
			thisXml->findRequiredAttribute("operand");
		OPERATOR_TYPE operandVal = OPERATOR_NONE;
		if (! operandStrVal.empty()) {
			operandVal = EnumConvertersXml::convertStringToOperatorType(operandStrVal);
		}

		const SmartPtrCXmlElement dataClassLeftXml =
			thisXml->findRequiredChild("dataClassLeft");

		SmartPtrCClassFieldDoc dataClassLeftVal;
		if (! dataClassLeftXml.IsNull()) {
			dataClassLeftVal = ClassFieldXml::parse(dataClassLeftXml);
		}

		const SmartPtrCXmlElement dataClassRightXml =
			thisXml->findRequiredChild("dataClassRight");

		SmartPtrCClassFieldDoc dataClassRightVal;
		if (! dataClassRightXml.IsNull()) {
			dataClassRightVal = ClassFieldXml::parse(dataClassRightXml);
		}

		const std::string descriptionStrVal =
			thisXml->findOptionalAttribute("description");
		const std::string descriptionVal = descriptionStrVal;

		joinTypeDoc.CreateInstance();
		joinTypeDoc->initialize(
			operandVal,
			dataClassLeftVal,
			dataClassRightVal,
			descriptionVal);
	}
	CAF_CM_EXIT;

	return joinTypeDoc;
}
コード例 #6
0
std::string CCafMessagePayload::getVersion() const {
	CAF_CM_FUNCNAME_VALIDATE("getVersion");
	CAF_CM_PRECOND_ISINITIALIZED(_isInitialized);

	SmartPtrCXmlElement headerXml = _payloadXml->findOptionalChild("requestHeader");
	if (headerXml.IsNull()) {
		headerXml = _payloadXml->findOptionalChild("responseHeader");
	}

	std::string rc;
	if (headerXml.IsNull()) {
		rc = _payloadXml->findRequiredAttribute("version");
	} else {
		rc = headerXml->findRequiredAttribute("version");
	}

	return rc;
}
コード例 #7
0
void CConfigProvider::setValue(
	const std::string& filePath,
	const std::string& encoding,
	const std::string& valueName,
	const std::string& valueData) const {
	CAF_CM_FUNCNAME("setValue");

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_STRING(filePath);
		CAF_CM_VALIDATE_STRING(encoding);
		CAF_CM_VALIDATE_STRING(valueName);
		CAF_CM_VALIDATE_STRING(valueData);

		if (encoding.compare("iniFileWithoutSection") == 0) {
			SmartPtrCIniFileWithoutSection iniFileWithoutSection;
			iniFileWithoutSection.CreateInstance();
			iniFileWithoutSection->initialize(filePath);
			iniFileWithoutSection->setValue(valueName, valueData);
		} else if (encoding.compare("iniFile") == 0) {
			std::string sectionName;
			std::string keyName;
			parseIniFileValuePath(valueName, sectionName, keyName);

			SmartPtrCIniFile iniFile;
			iniFile.CreateInstance();
			iniFile->initialize(filePath);
			iniFile->setValue(sectionName, keyName, valueData);
		} else if (encoding.compare("xmlFile") == 0) {
			std::string keyName;
			std::deque<std::string> keyPathCollection;
			parseKeyPath(valueName, keyPathCollection, keyName);

			const SmartPtrCXmlElement rootXml = CXmlUtils::parseFile(filePath, std::string());
			const SmartPtrCXmlElement parentXml = findXmlElement(keyPathCollection, rootXml);

			const SmartPtrCXmlElement foundElement = parentXml->findOptionalChild(keyName);
			if (! foundElement.IsNull()) {
				foundElement->setValue(valueData);
			} else {
				const std::string foundAttribute = parentXml->findOptionalAttribute(keyName);
				if (! foundAttribute.empty()) {
					parentXml->setAttribute(keyName, valueData);
				} else {
					const SmartPtrCXmlElement createdElement = parentXml->createAndAddElement(keyName);
					createdElement->setValue(valueData);
				}
			}
			rootXml->saveToFile(filePath);
		} else {
			CAF_CM_EXCEPTIONEX_VA2(InvalidArgumentException, E_INVALIDARG,
				"URI encoding is not recognized - filePath: %s, encoding: %s",
				filePath.c_str(), encoding.c_str());
		}
	}
	CAF_CM_EXIT;
}
コード例 #8
0
SmartPtrCSchemaSummaryDoc SchemaSummaryXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("SchemaSummaryXml", "parse");

	SmartPtrCSchemaSummaryDoc schemaSummaryDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string providerNamespaceStrVal =
			thisXml->findRequiredAttribute("providerNamespace");
		const std::string providerNamespaceVal = providerNamespaceStrVal;

		const std::string providerNameStrVal =
			thisXml->findRequiredAttribute("providerName");
		const std::string providerNameVal = providerNameStrVal;

		const std::string providerVersionStrVal =
			thisXml->findRequiredAttribute("providerVersion");
		const std::string providerVersionVal = providerVersionStrVal;

		const SmartPtrCXmlElement classCollectionXml =
			thisXml->findRequiredChild("classCollection");

		SmartPtrCClassCollectionDoc classCollectionVal;
		if (! classCollectionXml.IsNull()) {
			classCollectionVal = ClassCollectionXml::parse(classCollectionXml);
		}

		const std::string invokerPathStrVal =
			thisXml->findOptionalAttribute("invokerPath");
		const std::string invokerPathVal = invokerPathStrVal;

		schemaSummaryDoc.CreateInstance();
		schemaSummaryDoc->initialize(
			providerNamespaceVal,
			providerNameVal,
			providerVersionVal,
			classCollectionVal,
			invokerPathVal);
	}
	CAF_CM_EXIT;

	return schemaSummaryDoc;
}
コード例 #9
0
SmartPtrCActionClassInstanceDoc ActionClassInstanceXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("ActionClassInstanceXml", "parse");

	SmartPtrCActionClassInstanceDoc actionClassInstanceDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string namespaceValStrVal =
			thisXml->findRequiredAttribute("namespace");
		const std::string namespaceValVal = namespaceValStrVal;

		const std::string nameStrVal =
			thisXml->findRequiredAttribute("name");
		const std::string nameVal = nameStrVal;

		const std::string versionStrVal =
			thisXml->findRequiredAttribute("version");
		const std::string versionVal = versionStrVal;

		const SmartPtrCXmlElement instanceOperationCollectionXml =
			thisXml->findRequiredChild("instanceOperationCollection");

		SmartPtrCInstanceOperationCollectionDoc instanceOperationCollectionVal;
		if (! instanceOperationCollectionXml.IsNull()) {
			instanceOperationCollectionVal = InstanceOperationCollectionXml::parse(instanceOperationCollectionXml);
		}

		actionClassInstanceDoc.CreateInstance();
		actionClassInstanceDoc->initialize(
			namespaceValVal,
			nameVal,
			versionVal,
			instanceOperationCollectionVal);
	}
	CAF_CM_EXIT;

	return actionClassInstanceDoc;
}
コード例 #10
0
SmartPtrCDiagDeleteValueDoc DiagDeleteValueXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("DiagDeleteValueXml", "parse");

	SmartPtrCDiagDeleteValueDoc diagDeleteValueDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string jobIdStrVal =
			thisXml->findRequiredAttribute("jobId");
		UUID jobIdVal = CAFCOMMON_GUID_NULL;
		if (! jobIdStrVal.empty()) {
			BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal);
		}

		const std::string fileAliasStrVal =
			thisXml->findRequiredAttribute("fileAlias");
		const std::string fileAliasVal = fileAliasStrVal;

		const SmartPtrCXmlElement valueNameXml =
			thisXml->findRequiredChild("valueName");

		std::string valueNameVal;
		if (! valueNameXml.IsNull()) {
			valueNameVal = valueNameXml->getValue();
		}

		diagDeleteValueDoc.CreateInstance();
		diagDeleteValueDoc->initialize(
			jobIdVal,
			fileAliasVal,
			valueNameVal);
	}
	CAF_CM_EXIT;

	return diagDeleteValueDoc;
}
コード例 #11
0
SmartPtrCLogicalRelationshipDoc LogicalRelationshipXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("LogicalRelationshipXml", "parse");

	SmartPtrCLogicalRelationshipDoc logicalRelationshipDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string namespaceValStrVal =
			thisXml->findRequiredAttribute("namespace");
		const std::string namespaceValVal = namespaceValStrVal;

		const std::string nameStrVal =
			thisXml->findRequiredAttribute("name");
		const std::string nameVal = nameStrVal;

		const std::string versionStrVal =
			thisXml->findRequiredAttribute("version");
		const std::string versionVal = versionStrVal;

		const std::string arityStrVal =
			thisXml->findRequiredAttribute("arity");
		ARITY_TYPE arityVal = ARITY_NONE;
		if (! arityStrVal.empty()) {
			arityVal = EnumConvertersXml::convertStringToArityType(arityStrVal);
		}

		const SmartPtrCXmlElement dataClassLeftXml =
			thisXml->findRequiredChild("dataClassLeft");

		SmartPtrCClassCardinalityDoc dataClassLeftVal;
		if (! dataClassLeftXml.IsNull()) {
			dataClassLeftVal = ClassCardinalityXml::parse(dataClassLeftXml);
		}

		const SmartPtrCXmlElement dataClassRightXml =
			thisXml->findRequiredChild("dataClassRight");

		SmartPtrCClassCardinalityDoc dataClassRightVal;
		if (! dataClassRightXml.IsNull()) {
			dataClassRightVal = ClassCardinalityXml::parse(dataClassRightXml);
		}

		const CXmlElement::SmartPtrCElementCollection joinChildrenXml =
			thisXml->findRequiredChildren("join");

		std::deque<SmartPtrCJoinTypeDoc> joinVal;
		if (! joinChildrenXml.IsNull() && ! joinChildrenXml->empty()) {
			for (TConstIterator<CXmlElement::CElementCollection> joinXmlIter(*joinChildrenXml);
				joinXmlIter; joinXmlIter++) {
				const SmartPtrCXmlElement joinXml = joinXmlIter->second;
				const SmartPtrCJoinTypeDoc joinDoc =
					JoinTypeXml::parse(joinXml);
				joinVal.push_back(joinDoc);
			}
		}

		const std::string descriptionStrVal =
			thisXml->findOptionalAttribute("description");
		const std::string descriptionVal = descriptionStrVal;

		logicalRelationshipDoc.CreateInstance();
		logicalRelationshipDoc->initialize(
			namespaceValVal,
			nameVal,
			versionVal,
			arityVal,
			dataClassLeftVal,
			dataClassRightVal,
			joinVal,
			descriptionVal);
	}
	CAF_CM_EXIT;

	return logicalRelationshipDoc;
}