Search in sources :

Example 1 with Root_meta_external_shared_format_metamodel_SchemaDetail

use of org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaDetail in project legend-engine by finos.

the class SchemaSetCompiler method secondPass.

// Second pass - compile external schemas using extension
private void secondPass(ExternalFormatSchemaSet srcSchemaSet, CompileContext context) {
    String path = context.pureModel.buildPackageString(srcSchemaSet._package, srcSchemaSet.name);
    Root_meta_external_shared_format_metamodel_SchemaSet compiled = schemaSetIndex.get(path);
    ExternalFormatExtension schemaExtension = externalFormatExtensions.get(srcSchemaSet.format);
    compiled._schemas(Lists.mutable.empty());
    for (ExternalFormatSchema srcSchema : srcSchemaSet.schemas) {
        try {
            Root_meta_external_shared_format_metamodel_SchemaDetail detail = schemaExtension.compileSchema(new SchemaCompileContext(srcSchema, srcSchemaSet, context));
            Root_meta_external_shared_format_metamodel_Schema schema = new Root_meta_external_shared_format_metamodel_Schema_Impl("")._id(srcSchema.id)._location(srcSchema.location)._detail(detail);
            compiled._schemasAdd(schema);
        } catch (ExternalFormatSchemaException e) {
            throw new EngineException(e.getMessage(), srcSchema.contentSourceInformation, EngineErrorType.COMPILATION, e);
        }
    }
}
Also used : ExternalFormatSchema(org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.ExternalFormatSchema) ExternalSchemaCompileContext(org.finos.legend.engine.external.shared.format.model.ExternalSchemaCompileContext) Root_meta_external_shared_format_metamodel_Schema(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema) EngineException(org.finos.legend.engine.shared.core.operational.errorManagement.EngineException) Root_meta_external_shared_format_metamodel_SchemaSet(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet) Root_meta_external_shared_format_metamodel_Schema_Impl(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema_Impl) ExternalFormatExtension(org.finos.legend.engine.external.shared.format.model.ExternalFormatExtension) ExternalFormatSchemaException(org.finos.legend.engine.external.shared.format.model.compile.ExternalFormatSchemaException) Root_meta_external_shared_format_metamodel_SchemaDetail(org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaDetail)

Aggregations

ExternalFormatExtension (org.finos.legend.engine.external.shared.format.model.ExternalFormatExtension)1 ExternalSchemaCompileContext (org.finos.legend.engine.external.shared.format.model.ExternalSchemaCompileContext)1 ExternalFormatSchemaException (org.finos.legend.engine.external.shared.format.model.compile.ExternalFormatSchemaException)1 ExternalFormatSchema (org.finos.legend.engine.protocol.pure.v1.packageableElement.external.shared.ExternalFormatSchema)1 EngineException (org.finos.legend.engine.shared.core.operational.errorManagement.EngineException)1 Root_meta_external_shared_format_metamodel_Schema (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema)1 Root_meta_external_shared_format_metamodel_SchemaDetail (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaDetail)1 Root_meta_external_shared_format_metamodel_SchemaSet (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_SchemaSet)1 Root_meta_external_shared_format_metamodel_Schema_Impl (org.finos.legend.pure.generated.Root_meta_external_shared_format_metamodel_Schema_Impl)1