/// <summary> /// Initializes a new instance of the <see cref="SdmxXmlStream"/> class. /// </summary> /// <param name="reader"> /// The reader. /// </param> /// <param name="messageType"> /// The message type. /// </param> /// <param name="sdmxVersion"> /// The schema enum type. /// </param> /// <param name="registryType"> /// The registry type. /// </param> public SdmxXmlStream(XmlReader reader, MessageEnumType messageType, SdmxSchemaEnumType sdmxVersion, RegistryMessageEnumType registryType) { if (!SdmxSchema.GetFromEnum(sdmxVersion).IsXmlFormat()) { throw new ArgumentException("Input not an SDMX-ML file", "sdmxVersion"); } this._reader = reader; this._messageType = messageType; this._sdmxVersion = sdmxVersion; this._registryType = registryType; }
/// <summary> /// Processes a query message which is a RegistryInterface Document /// </summary> /// <param name="reader"> /// - the stream containing the SDMX /// </param> /// <param name="schemaVersion"> /// - the schema version that the SDMX is in /// </param> /// <param name="registryMessageType"> /// - the type of query message, provision, registration or structure /// </param> /// <returns> /// The <see cref="IQueryWorkspace"/>. /// </returns> private IQueryWorkspace ProcessRegistryQueryMessage( XmlReader reader, SdmxSchemaEnumType schemaVersion, RegistryMessageEnumType registryMessageType) { switch (registryMessageType) { case RegistryMessageEnumType.QueryProvisionRequest: return this.ProcessRegistryQueryMessageForProvision(reader, schemaVersion); case RegistryMessageEnumType.QueryRegistrationRequest: return this.ProcessRegistryQueryMessageForRegistration(reader, schemaVersion); case RegistryMessageEnumType.QueryStructureRequest: return this.ProcessRegistryQueryMessageForStructures(reader, schemaVersion); default: throw new SdmxNotImplementedException(ExceptionCode.Unsupported, registryMessageType); } }
public void TestGetRegistryMessageType(string file, RegistryMessageEnumType expectedResult) { using (var readable = new FileReadableDataLocation(file)) { RegistryMessageEnumType registryMessageEnumType = SdmxMessageUtil.GetRegistryMessageType(readable); Assert.AreEqual(expectedResult, registryMessageEnumType); } }
/// <summary> /// Initializes a new instance of the <see cref="SdmxXmlStream"/> class. /// </summary> /// <param name="readableDataLocation"> /// The readable data location. /// </param> /// <exception cref="ArgumentException"> /// Input not an SDMX-ML file /// </exception> public SdmxXmlStream(IReadableDataLocation readableDataLocation) { var xmlStream = readableDataLocation as ISdmxXmlStream; if (xmlStream != null) { this._reader = xmlStream.Reader; this._messageType = xmlStream.MessageType; this._sdmxVersion = xmlStream.SdmxVersion; this._registryType = xmlStream.RegistryType; this._queryMessageTypes = xmlStream.QueryMessageTypes; } else { this._sdmxVersion = SdmxMessageUtil.GetSchemaVersion(readableDataLocation); if (!SdmxSchema.GetFromEnum(this._sdmxVersion).IsXmlFormat()) { throw new ArgumentException("Input not an SDMX-ML file", "readableDataLocation"); } this._messageType = SdmxMessageUtil.GetMessageType(readableDataLocation); this._registryType = this._messageType != MessageEnumType.RegistryInterface ? RegistryMessageEnumType.Null : SdmxMessageUtil.GetRegistryMessageType(readableDataLocation); if (this._messageType == MessageEnumType.Query) { this._queryMessageTypes = SdmxMessageUtil.GetQueryMessageTypes(readableDataLocation); } this._reader = XMLParser.CreateSdmxMlReader(readableDataLocation.InputStream, this._sdmxVersion); this.AddDisposable(this._reader); } }
/// <summary> /// Initializes a new instance of the <see cref="SdmxStructureParserFactory" /> class. /// </summary> /// <param name="messageType">Type of the message.</param> /// <param name="sdmxSchema">The SDMX schema.</param> /// <param name="registryMessageType">Type of the registry message.</param> /// <param name="sdmxBeansBuilder">The SDMX beans builder.</param> /// <param name="provisionParsingManager">The provision parsing manager.</param> /// <param name="registrationParsingManager">The registration parsing manager.</param> /// <param name="subscriptionParsingManager">The subscription parsing manager.</param> public SdmxStructureParserFactory(MessageEnumType messageType, SdmxSchemaEnumType sdmxSchema, RegistryMessageEnumType registryMessageType, ISdmxObjectsBuilder sdmxBeansBuilder, IProvisionParsingManager provisionParsingManager, IRegistrationParsingManager registrationParsingManager, ISubscriptionParsingManager subscriptionParsingManager) { this._messageType = messageType; this._sdmxSchema = sdmxSchema; this._registryMessageType = registryMessageType; this._sdmxBeansBuilder = sdmxBeansBuilder ?? new SdmxObjectsBuilder(); this._provisionParsingManager = provisionParsingManager ?? new ProvisionParsingManager(); this._registrationParsingManager = registrationParsingManager ?? new RegistrationParsingManager(); this._subscriptionParsingManager = subscriptionParsingManager ?? new SubscriptionParsingManager(); }