Пример #1
0
SmartPtrCCmdlUnionDoc CmdlUnionXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("CmdlUnionXml", "parse");

	SmartPtrCCmdlUnionDoc cmdlUnionDoc;

	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;

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

	return cmdlUnionDoc;
}
SmartPtrCLoggingLevelElemDoc LoggingLevelElemXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("LoggingLevelElemXml", "parse");

	SmartPtrCLoggingLevelElemDoc loggingLevelElemDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string componentStrVal =
			thisXml->findRequiredAttribute("component");
		LOGGINGCOMPONENT_TYPE componentVal = LOGGINGCOMPONENT_NONE;
		if (! componentStrVal.empty()) {
			componentVal = EnumConvertersXml::convertStringToLoggingComponentType(componentStrVal);
		}

		const std::string levelStrVal =
			thisXml->findRequiredAttribute("level");
		LOGGINGLEVEL_TYPE levelVal = LOGGINGLEVEL_NONE;
		if (! levelStrVal.empty()) {
			levelVal = EnumConvertersXml::convertStringToLoggingLevelType(levelStrVal);
		}

		loggingLevelElemDoc.CreateInstance();
		loggingLevelElemDoc->initialize(
			componentVal,
			levelVal);
	}
	CAF_CM_EXIT;

	return loggingLevelElemDoc;
}
Пример #3
0
SmartPtrCEventKeyDoc EventKeyXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("EventKeyXml", "parse");

	SmartPtrCEventKeyDoc eventKeyDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

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

		const std::string valueStrVal =
			thisXml->findRequiredAttribute("value");
		const std::string valueVal = valueStrVal;

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

	return eventKeyDoc;
}
Пример #4
0
SmartPtrCMethodParameterDoc MethodParameterXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("MethodParameterXml", "parse");

	SmartPtrCMethodParameterDoc methodParameterDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

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

		const std::string typeStrVal =
			thisXml->findRequiredAttribute("type");
		PARAMETER_TYPE typeVal = PARAMETER_NONE;
		if (! typeStrVal.empty()) {
			typeVal = EnumConvertersXml::convertStringToParameterType(typeStrVal);
		}

		const std::string isOptionalStrVal =
			thisXml->findRequiredAttribute("isOptional");
		bool isOptionalVal = false;
		if (! isOptionalStrVal.empty()) {
			isOptionalVal = (isOptionalStrVal.compare("true") == 0)  ? true : false;
		}

		const std::string isListStrVal =
			thisXml->findOptionalAttribute("isList");
		bool isListVal = false;
		if (! isListStrVal.empty()) {
			isListVal = (isListStrVal.compare("true") == 0)  ? true : false;
		}

		const std::string defaultValStrVal =
			thisXml->findOptionalAttribute("default");
		const std::string defaultValVal = defaultValStrVal;

		const std::string displayNameStrVal =
			thisXml->findOptionalAttribute("displayName");
		const std::string displayNameVal = displayNameStrVal;

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

		methodParameterDoc.CreateInstance();
		methodParameterDoc->initialize(
			nameVal,
			typeVal,
			isOptionalVal,
			isListVal,
			defaultValVal,
			displayNameVal,
			descriptionVal);
	}
	CAF_CM_EXIT;

	return methodParameterDoc;
}
Пример #5
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;
}
SmartPtrCInstallProviderSpecDoc InstallProviderSpecXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("InstallProviderSpecXml", "parse");

	SmartPtrCInstallProviderSpecDoc installProviderSpecDoc;

	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 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 CXmlElement::SmartPtrCElementCollection packageValChildrenXml =
			thisXml->findRequiredChildren("package");

		std::deque<SmartPtrCMinPackageElemDoc> packageValVal;
		if (! packageValChildrenXml.IsNull() && ! packageValChildrenXml->empty()) {
			for (TConstIterator<CXmlElement::CElementCollection> packageValXmlIter(*packageValChildrenXml);
				packageValXmlIter; packageValXmlIter++) {
				const SmartPtrCXmlElement packageValXml = packageValXmlIter->second;
				const SmartPtrCMinPackageElemDoc packageValDoc =
					MinPackageElemXml::parse(packageValXml);
				packageValVal.push_back(packageValDoc);
			}
		}

		installProviderSpecDoc.CreateInstance();
		installProviderSpecDoc->initialize(
			clientIdVal,
			providerNamespaceVal,
			providerNameVal,
			providerVersionVal,
			packageValVal);
	}
	CAF_CM_EXIT;

	return installProviderSpecDoc;
}
Пример #7
0
SmartPtrCResponseHeaderDoc ResponseHeaderXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("ResponseHeaderXml", "parse");

	SmartPtrCResponseHeaderDoc responseHeaderDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

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

		const std::string createdDateTimeVal =
			thisXml->findRequiredAttribute("createdDateTime");

		const std::string sequenceNumberStrVal =
			thisXml->findRequiredAttribute("sequenceNumber");
		uint32 sequenceNumberVal = 0;
		if (! sequenceNumberStrVal.empty()) {
			sequenceNumberVal = CStringConv::fromString<uint32>(sequenceNumberStrVal);
		}

		const std::string isFinalResponseStrVal =
			thisXml->findRequiredAttribute("isFinalResponse");
		bool isFinalResponseVal = false;
		if (! isFinalResponseStrVal.empty()) {
			isFinalResponseVal = (isFinalResponseStrVal.compare("true") == 0)  ? true : false;
		}

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

		responseHeaderDoc.CreateInstance();
		responseHeaderDoc->initialize(
			versionVal,
			createdDateTimeVal,
			sequenceNumberVal,
			isFinalResponseVal,
			sessionIdVal);
	}
	CAF_CM_EXIT;

	return responseHeaderDoc;
}
Пример #8
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;
}
SmartPtrCAttachmentNameCollectionDoc AttachmentNameCollectionXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("AttachmentNameCollectionXml", "parse");

	SmartPtrCAttachmentNameCollectionDoc attachmentNameCollectionDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const CXmlElement::SmartPtrCElementCollection nameChildrenXml =
			thisXml->findRequiredChildren("attachmentName");

		std::deque<std::string> nameVal;
		if (! nameChildrenXml.IsNull() && ! nameChildrenXml->empty()) {
			for (TConstIterator<CXmlElement::CElementCollection> nameXmlIter(*nameChildrenXml);
				nameXmlIter; nameXmlIter++) {
				const SmartPtrCXmlElement nameXml = nameXmlIter->second;
				const std::string name = nameXml->findRequiredAttribute("name");
				nameVal.push_back(name);
			}
		}

		attachmentNameCollectionDoc.CreateInstance();
		attachmentNameCollectionDoc->initialize(
			nameVal);
	}
	CAF_CM_EXIT;

	return attachmentNameCollectionDoc;
}
Пример #10
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;
}
Пример #11
0
SmartPtrCPropertyDoc PropertyXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("PropertyXml", "parse");

	SmartPtrCPropertyDoc propertyDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

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

		const std::string typeStrVal =
			thisXml->findRequiredAttribute("type");
		PROPERTY_TYPE typeVal = PROPERTY_NONE;
		if (! typeStrVal.empty()) {
			typeVal = EnumConvertersXml::convertStringToPropertyType(typeStrVal);
		}

		const CXmlElement::SmartPtrCElementCollection valueChildrenXml =
			thisXml->findRequiredChildren("value");

		std::deque<std::string> valueVal;
		if (! valueChildrenXml.IsNull() && ! valueChildrenXml->empty()) {
			for (TConstIterator<CXmlElement::CElementCollection> valueXmlIter(*valueChildrenXml);
				valueXmlIter; valueXmlIter++) {
				const SmartPtrCXmlElement valueXml = valueXmlIter->second;
				const std::string valueDoc = valueXml->getValue();
				valueVal.push_back(valueDoc);
			}
		}

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

	return propertyDoc;
}
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;
}
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;
}
Пример #14
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;
}
Пример #15
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;
}
Пример #16
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;
}
SmartPtrCUninstallProviderJobDoc UninstallProviderJobXml::parse(
    const SmartPtrCXmlElement thisXml) {
    CAF_CM_STATIC_FUNC_VALIDATE("UninstallProviderJobXml", "parse");

    SmartPtrCUninstallProviderJobDoc uninstallProviderJobDoc;

    CAF_CM_ENTER {
        CAF_CM_VALIDATE_SMARTPTR(thisXml);

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

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

        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 std::string packageOSTypeStrVal =
        thisXml->findRequiredAttribute("packageOSType");
        PACKAGE_OS_TYPE packageOSTypeVal = PACKAGE_OS_NONE;
        if (! packageOSTypeStrVal.empty()) {
            packageOSTypeVal = EnumConvertersXml::convertStringToPackageOSType(packageOSTypeStrVal);
        }

        uninstallProviderJobDoc.CreateInstance();
        uninstallProviderJobDoc->initialize(
            clientIdVal,
            jobIdVal,
            providerNamespaceVal,
            providerNameVal,
            providerVersionVal,
            packageOSTypeVal);
    }
    CAF_CM_EXIT;

    return uninstallProviderJobDoc;
}
SmartPtrCDiagCollectInstancesDoc DiagCollectInstancesXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("DiagCollectInstancesXml", "parse");

	SmartPtrCDiagCollectInstancesDoc diagCollectInstancesDoc;

	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);
		}

		diagCollectInstancesDoc.CreateInstance();
		diagCollectInstancesDoc->initialize(
			jobIdVal);
	}
	CAF_CM_EXIT;

	return diagCollectInstancesDoc;
}
SmartPtrCInstanceParameterDoc InstanceParameterXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("InstanceParameterXml", "parse");

	SmartPtrCInstanceParameterDoc instanceParameterDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

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

		const std::string instanceNamespaceStrVal =
			thisXml->findRequiredAttribute("instanceNamespace");
		const std::string instanceNamespaceVal = instanceNamespaceStrVal;

		const std::string instanceNameStrVal =
			thisXml->findRequiredAttribute("instanceName");
		const std::string instanceNameVal = instanceNameStrVal;

		const std::string instanceVersionStrVal =
			thisXml->findRequiredAttribute("instanceVersion");
		const std::string instanceVersionVal = instanceVersionStrVal;

		const std::string isOptionalStrVal =
			thisXml->findRequiredAttribute("isOptional");
		bool isOptionalVal = false;
		if (! isOptionalStrVal.empty()) {
			isOptionalVal = (isOptionalStrVal.compare("true") == 0)  ? true : false;
		}

		const std::string isListStrVal =
			thisXml->findOptionalAttribute("isList");
		bool isListVal = false;
		if (! isListStrVal.empty()) {
			isListVal = (isListStrVal.compare("true") == 0)  ? true : false;
		}

		const std::string displayNameStrVal =
			thisXml->findOptionalAttribute("displayName");
		const std::string displayNameVal = displayNameStrVal;

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

		instanceParameterDoc.CreateInstance();
		instanceParameterDoc->initialize(
			nameVal,
			instanceNamespaceVal,
			instanceNameVal,
			instanceVersionVal,
			isOptionalVal,
			isListVal,
			displayNameVal,
			descriptionVal);
	}
	CAF_CM_EXIT;

	return instanceParameterDoc;
}
Пример #20
0
void CApplicationContext::parseBeanConfig(
	const std::string& beanConfigFile,
	CBeanCollection& beanCollection) const {
	CAF_CM_FUNCNAME("parseBeanConfig");
	CAF_CM_VALIDATE_STRING(beanConfigFile);
	CAF_CM_LOG_DEBUG_VA1("Parsing bean config file %s", beanConfigFile.c_str());

	// We will look up class references early in the process to fail as early
	// as possible and to make logging better.
	// Parse the bean config file
	CXmlElement::SmartPtrCElementCollection rootElements =
			CXmlUtils::parseFile(beanConfigFile, "caf:beans")->getAllChildren();
	for (TSmartConstMultimapIterator<CXmlElement::CElementCollection> rootChild(*rootElements);
			rootChild;
			rootChild++) {

		// if the child is a bean...
		if (rootChild->getName() == "bean") {
			// Syntactic sugar
			const SmartPtrCXmlElement beanElement = *rootChild;

			// Bean attributes
			const std::string beanId = beanElement->findRequiredAttribute("id");
			CAF_CM_LOG_DEBUG_VA1("Parsing bean [id=%s]", beanId.c_str());
			const std::string beanClass = beanElement->findRequiredAttribute("class");
			CAF_CM_LOG_DEBUG_VA2(
					"Checking bean class [id=%s][class=%s]",
					beanId.c_str(),
					beanClass.c_str());
			if (!CEcmSubSystemRegistry::IsRegistered(beanClass)) {
				CAF_CM_EXCEPTIONEX_VA3(
						NoSuchElementException,
						0,
						"Bean class %s is not registered. Fix the AppConfig file. "
						"[bean id=%s][bean_config_file=%s]",
						beanClass.c_str(),
						beanId.c_str(),
						beanConfigFile.c_str());
			}

			// get optional constructor args and properties
			CBeanCtorArgCollection beanCtorArgs;
			Cmapstrstr beanProperties;
			CAF_CM_LOG_DEBUG_VA1("Parsing bean ctor args and properties [id=%s]", beanId.c_str());
			CXmlElement::SmartPtrCElementCollection beanElements = beanElement->getAllChildren();
			for (TSmartConstMultimapIterator<CXmlElement::CElementCollection> beanChild(*beanElements);
					beanChild;
					beanChild++) {
				if (beanChild->getName() == "property") {
					// Syntactic sugar
					const SmartPtrCXmlElement propArgElement = *beanChild;

					// property attributes
					const std::string name = propArgElement->findRequiredAttribute("name");
					const std::string value = propArgElement->findRequiredAttribute("value");
					if (!beanProperties.insert(std::make_pair(name, value)).second) {
						CAF_CM_EXCEPTIONEX_VA3(
								DuplicateElementException,
								0,
								"Bean property name is duplicated. "
								"[bean id=%s][property name=%s][bean_config_file=%s]",
								beanId.c_str(),
								name.c_str(),
								beanConfigFile.c_str());
					}
				}
				else if (beanChild->getName() == "constructor-arg") {
					// Syntactic sugar
					const SmartPtrCXmlElement ctorArgElement = *beanChild;

					// ctor attributes
					const uint32 ctorArgIndex = CStringConv::fromString<uint32>(ctorArgElement->findRequiredAttribute("index"));
					CBeanCtorArg::ARG_TYPE ctorArgType = CBeanCtorArg::NOT_SET;
					std::string ctorArgValue = ctorArgElement->findOptionalAttribute("value");
					if (ctorArgValue.length() > 0) {
						ctorArgType = CBeanCtorArg::VALUE;
					} else {
						ctorArgValue = ctorArgElement->findOptionalAttribute("ref");
						if (ctorArgValue.length() > 0) {
							ctorArgType = CBeanCtorArg::REFERENCE;
						} else {
							CAF_CM_EXCEPTIONEX_VA2(
									InvalidArgumentException,
									0,
									"Bean constructor argument must be of type value or ref and cannot be empty. "
									"[bean id=%s][bean_config_file=%s]",
									beanId.c_str(),
									beanConfigFile.c_str());
						}
					}

					if (!beanCtorArgs.insert(
							CBeanCtorArgCollection::value_type(
									ctorArgIndex,
									CBeanCtorArg(ctorArgType, ctorArgValue))).second) {
						CAF_CM_EXCEPTIONEX_VA3(
								DuplicateElementException,
								0,
								"Bean has a duplicate constructor-arg index. "
								"[bean id=%s][bean_config_file=%s][arg-index=%d]",
								beanId.c_str(),
								beanConfigFile.c_str(),
								ctorArgIndex);
					}
					CAF_CM_LOG_DEBUG_VA4(
							"Bean ctor arg parsed [id=%s][arg-index=%d][arg-type=%s][arg-value=%s]",
							beanId.c_str(),
							ctorArgIndex,
							(CBeanCtorArg::VALUE == ctorArgType ? "VALUE" : "REFERENCE"),
							ctorArgValue.c_str());
				}
			}

			// Add the bean definition to the collection
			SmartPtrCBeanNode beanNode;
			beanNode.CreateInstance();
			beanNode->_id = beanId;
			beanNode->_class = beanClass;
			beanNode->_ctorArgs = beanCtorArgs;
			beanNode->_properties = beanProperties;

			if (!beanCollection.insert(
					CBeanCollection::value_type(
							beanId,
							beanNode)).second) {
				CAF_CM_EXCEPTIONEX_VA3(
						DuplicateElementException,
						0,
						"Duplicate bean definition detected. "
						"[bean id=%s][bean class=%s][bean_config_file=%s]",
						beanId.c_str(),
						beanNode->_class.c_str(),
						beanConfigFile.c_str());
			}
		}
	}

	CAF_CM_LOG_DEBUG_VA2(
			"Bean configuration file defined %d beans. "
			"[file=%s]",
			beanCollection.size(),
			beanConfigFile.c_str());
}
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;
}