Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 65b40647 authored by Harald Martini's avatar Harald Martini
Browse files

added MockupXMLInputDataFactory

parent 3dffad26
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML
}
}
private IMultistageBusInputDataProvider ReadMultistageDeclarationJob(XmlDocument xmlDoc, string source)
protected virtual IMultistageBusInputDataProvider ReadMultistageDeclarationJob(XmlDocument xmlDoc, string source)
{
var versionNumber = XMLHelper.GetXsdType(xmlDoc.DocumentElement?.SchemaInfo.SchemaType);
try {
......@@ -167,7 +167,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML
}
}
private IEngineeringInputDataProvider ReadEngineeringJob(XmlDocument xmlDoc, string source)
protected virtual IEngineeringInputDataProvider ReadEngineeringJob(XmlDocument xmlDoc, string source)
{
var versionNumber = XMLHelper.GetXsdType(xmlDoc.DocumentElement?.SchemaInfo.SchemaType);
......@@ -176,7 +176,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML
return input;
}
private IDeclarationInputDataProvider ReadDeclarationJob(XmlDocument xmlDoc, string source)
protected virtual IDeclarationInputDataProvider ReadDeclarationJob(XmlDocument xmlDoc, string source)
{
var versionNumber = XMLHelper.GetXsdType(xmlDoc.DocumentElement?.SchemaInfo.SchemaType);
try {
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCore.InputData.FileIO.XML;
using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType;
namespace TUGraz.VectoMockup
{
internal class MockupXMLInputDataFactory : XMLInputDataFactory
{
private const string prefix = "urn:tugraz:ivt:VectoAPI:";
private readonly HashSet<string> _supportedNamespaces = new HashSet<string>() {
prefix + "DeclarationDefinitions:v2.4",
prefix + "VectoOutputMultistep:v0.1",
};
#region Overrides of XMLInputDataFactory
protected override IMultistageBusInputDataProvider ReadMultistageDeclarationJob(XmlDocument xmlDoc, string source)
{
var ret = base.ReadMultistageDeclarationJob(xmlDoc, source);
return ret;
}
protected override IEngineeringInputDataProvider ReadEngineeringJob(XmlDocument xmlDoc, string source)
{
throw new VectoException("Engineering Mode is not supported in Mockup Vecto");
}
protected override IDeclarationInputDataProvider ReadDeclarationJob(XmlDocument xmlDoc, string source)
{
var ret = base.ReadDeclarationJob(xmlDoc, source);
NamespaceSupported(ret.JobInputData.Vehicle.XMLSource.SchemaInfo.SchemaType.QualifiedName.Namespace);
return ret;
}
private void NamespaceSupported(string ns)
{
if (!_supportedNamespaces.Contains(ns)) {
throw new VectoException($"Namespace {ns} not supported in Mockup Vecto!");
}
}
#endregion
}
}
......@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Ninject.Modules;
using TUGraz.VectoCore;
using TUGraz.VectoCore.InputData;
using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.OutputData.XML;
using TUGraz.VectoMockup.Reports;
using TUGraz.VectoMockup.Simulation.RundataFactories;
......@@ -20,6 +21,7 @@ namespace TUGraz.VectoMockup.Ninject
{
Rebind<IVectoRunDataFactoryFactory>().To<VectoMockUpRunDataFactoryFactory>();
Rebind<IXMLDeclarationReportFactory>().To<MockupReportFactory>();
Rebind<IXMLInputDataReader>().To<MockupXMLInputDataFactory>();
}
#endregion
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment