Search in sources :

Example 1 with OspSystemStructureParser

use of com.opensimulationplatform.systemstructure.xml.parser.OspSystemStructureParser in project osp-validator by open-simulation-platform.

the class Validator method validate.

public List<String> validate(File ospSystemStructureFile) {
    List<String> errorMessages = new ArrayList<>();
    OspSystemStructureParser parser = new OspSystemStructureParser();
    OspSystemStructure ospSystemStructureElement = parser.parse(ospSystemStructureFile);
    Map<Object, Location> locations = parser.getLocations();
    errorMessages.addAll(getModelDescriptionErrorMessages(ospSystemStructureFile, ospSystemStructureElement));
    errorMessages.addAll(getSystemStructureErrorMessages(ospSystemStructureFile, ospSystemStructureElement, locations));
    return errorMessages;
}
Also used : OspSystemStructureParser(com.opensimulationplatform.systemstructure.xml.parser.OspSystemStructureParser) OspSystemStructure(com.opensimulationplatform.systemstructure.xml.model.OspSystemStructure) Location(javax.xml.stream.Location)

Example 2 with OspSystemStructureParser

use of com.opensimulationplatform.systemstructure.xml.parser.OspSystemStructureParser in project osp-validator by open-simulation-platform.

the class SystemStructureFactory method create.

public SystemStructure create(File ospSystemStructureFile) {
    OspSystemStructureParser parser = new OspSystemStructureParser();
    OspSystemStructure ospSystemStructure = parser.parse(ospSystemStructureFile);
    if (fmuLocator == null) {
        fmuLocator = new DefaultFmuLocator(ospSystemStructureFile);
    }
    if (ospModelDescriptionLocator == null) {
        ospModelDescriptionLocator = new DefaultOspModelDescriptionLocator(ospSystemStructureFile, fmuLocator);
    }
    ConverterContext context = new ConverterContext();
    context.ospModelDescriptionLocator = ospModelDescriptionLocator;
    context.fmuLocator = fmuLocator;
    OspSystemStructureConverter converter = new OspSystemStructureConverter(context);
    return converter.convert(ospSystemStructure);
}
Also used : OspSystemStructureParser(com.opensimulationplatform.systemstructure.xml.parser.OspSystemStructureParser) ConverterContext(com.opensimulationplatform.systemstructure.xml.converter.ConverterContext) DefaultFmuLocator(com.opensimulationplatform.systemstructure.util.DefaultFmuLocator) OspSystemStructureConverter(com.opensimulationplatform.systemstructure.xml.converter.OspSystemStructureConverter) OspSystemStructure(com.opensimulationplatform.systemstructure.xml.model.OspSystemStructure) DefaultOspModelDescriptionLocator(com.opensimulationplatform.systemstructure.util.DefaultOspModelDescriptionLocator)

Aggregations

OspSystemStructure (com.opensimulationplatform.systemstructure.xml.model.OspSystemStructure)2 OspSystemStructureParser (com.opensimulationplatform.systemstructure.xml.parser.OspSystemStructureParser)2 DefaultFmuLocator (com.opensimulationplatform.systemstructure.util.DefaultFmuLocator)1 DefaultOspModelDescriptionLocator (com.opensimulationplatform.systemstructure.util.DefaultOspModelDescriptionLocator)1 ConverterContext (com.opensimulationplatform.systemstructure.xml.converter.ConverterContext)1 OspSystemStructureConverter (com.opensimulationplatform.systemstructure.xml.converter.OspSystemStructureConverter)1 Location (javax.xml.stream.Location)1