use of org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding in project legend-engine by finos.
the class BindingCompiler method firstPass.
// First pass - create and index schemas
private PackageableElement firstPass(Binding srcSchemaOp, CompileContext context) {
Root_meta_external_shared_format_binding_Binding binding = new Root_meta_external_shared_format_binding_Binding_Impl(srcSchemaOp.name)._name(srcSchemaOp.name)._classifierGenericType(new Root_meta_pure_metamodel_type_generics_GenericType_Impl("")._rawType(context.pureModel.getType("meta::external::shared::format::binding::Binding")));
String path = context.pureModel.buildPackageString(srcSchemaOp._package, srcSchemaOp.name);
this.bindingIndex.put(path, binding);
context.pureModel.storesIndex.put(path, binding);
return binding;
}
use of org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding in project legend-engine by finos.
the class BindingCompiler method fourthPass.
// Fourth pass - ensure correlation using the extension
private void fourthPass(Binding srcBinding, CompileContext context) {
String path = context.pureModel.buildPackageString(srcBinding._package, srcBinding.name);
Root_meta_external_shared_format_binding_Binding compiled = bindingIndex.get(path);
ExternalFormatExtension schemaExtension = getExtension(compiled, srcBinding);
Root_meta_external_shared_format_binding_validation_BindingDetail bindingDetail = schemaExtension.bindDetails(compiled, context);
if (bindingDetail instanceof Root_meta_external_shared_format_binding_validation_FailedBindingDetail) {
Root_meta_external_shared_format_binding_validation_FailedBindingDetail failed = (Root_meta_external_shared_format_binding_validation_FailedBindingDetail) bindingDetail;
throw new EngineException("Model and schema are mismatched:\n" + failed._errorMessages().makeString("\n"), srcBinding.sourceInformation, EngineErrorType.COMPILATION);
}
}
use of org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding in project legend-engine by finos.
the class ExternalFormatConnectionCompilerExtension method getExtraConnectionSecondPassProcessors.
@Override
public List<Procedure3<Connection, org.finos.legend.pure.m3.coreinstance.meta.pure.runtime.Connection, CompileContext>> getExtraConnectionSecondPassProcessors() {
return Collections.singletonList((connectionValue, pureConnection, context) -> {
if (connectionValue instanceof ExternalFormatConnection) {
ExternalFormatConnection externalFormatConnection = (ExternalFormatConnection) connectionValue;
List<IExternalFormatCompilerExtension> extensions = IExternalFormatCompilerExtension.getExtensions(context);
Root_meta_external_shared_format_executionPlan_ExternalFormatConnection connection = (Root_meta_external_shared_format_executionPlan_ExternalFormatConnection) pureConnection;
Store store = context.pureModel.getStore(connectionValue.element, connectionValue.elementSourceInformation);
if (!(store instanceof Root_meta_external_shared_format_binding_Binding)) {
throw new EngineException("Store for ExternalFormatConnection must be a Binding", connectionValue.sourceInformation, EngineErrorType.COMPILATION);
}
connection._element(store);
Root_meta_external_shared_format_executionPlan_ExternalSource externalSource = IExternalFormatCompilerExtension.process(externalFormatConnection.externalSource, ListIterate.flatCollect(extensions, IExternalFormatCompilerExtension::getExtraExternalSourceSpecificationProcessors), context);
connection._externalSource(externalSource);
}
});
}
use of org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding in project legend-engine by finos.
the class HelperExternalFormat method getBinding.
public static Root_meta_external_shared_format_binding_Binding getBinding(String fullPath, SourceInformation sourceInformation, CompileContext context) {
Root_meta_external_shared_format_binding_Binding binding = getExternalFormatCompilerExtension(context).bindingCompiler.getCompiledBinding(fullPath);
Assert.assertTrue(binding != null, () -> "Can't find (external format) Binding '" + fullPath + "'", sourceInformation, EngineErrorType.COMPILATION);
return binding;
}
use of org.finos.legend.pure.generated.Root_meta_external_shared_format_binding_Binding in project legend-engine by finos.
the class Generator method transformBinding.
protected Binding transformBinding(Root_meta_external_shared_format_binding_Binding binding) {
ModelUnit modelUnit = new ModelUnit();
modelUnit.packageableElementIncludes = binding._modelUnit()._packageableElementIncludes().collect(this::elementToPath).toList();
modelUnit.packageableElementExcludes = binding._modelUnit()._packageableElementExcludes().collect(this::elementToPath).toList();
Binding result = new Binding();
result.name = binding._name();
result._package = elementToPath(binding._package());
result.schemaSet = elementToPath(binding._schemaSet());
result.schemaId = binding._schemaId();
result.contentType = binding._contentType();
result.modelUnit = modelUnit;
return result;
}
Aggregations