public IIR Execute(IIR predecessorIR) { AstIR astIR = predecessorIR as AstIR; if (astIR == null) { return null; } // Initialize Lowering Engine InitializeLoweringEngine(); PhysicalIR physicalIR = new PhysicalIR(astIR); foreach (Task.AstPackageNode packageNode in astIR.AstRootNode.Packages) { if (packageNode.Emit) { var root = physicalIR.InitializePackage(packageNode.Name); PhysicalLoweringProcessor.Lower(packageNode, new TaskLoweringContext(root)); } } return physicalIR; }
public VulcanEngine.IR.IIR Execute(VulcanEngine.IR.IIR predecessorIR) { AstIR astIR = predecessorIR as AstIR; if (astIR == null) { // TODO: Message.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, PredecessorIR.GetType().ToString(), this.Name); } PhysicalIR physicalIR = new PhysicalIR(astIR); try { foreach (Task.AstPackageNode packageNode in astIR.AstRootNode.Packages) { if (packageNode.Emit && !packageNode.AsClassOnly) { Package package = packageNode.Lower(); if (String.IsNullOrEmpty(package.Type)) { package.Type = "ETL"; } physicalIR.PhysicalNodes.Add(package); } } foreach (Dimension.AstDimensionNode dimensionNode in astIR.AstRootNode.Dimensions) { if (dimensionNode.Emit && !dimensionNode.AsClassOnly) { Package package = dimensionNode.Lower().Lower(); package.Type = "Dimension"; physicalIR.PhysicalNodes.Add(package); } } foreach (Fact.AstFactNode factNode in astIR.AstRootNode.Facts) { if (factNode.Emit && !factNode.AsClassOnly) { Package package = factNode.Lower().Lower(); package.Type = "FactTable"; physicalIR.PhysicalNodes.Add(package); } } foreach (Connection.AstConnectionNode connectionNode in astIR.AstRootNode.Connections) { physicalIR.PhysicalNodes.Add(connectionNode.Lower()); } foreach (Table.AstTableNode tableNode in astIR.AstRootNode.Tables) { if (tableNode.Emit && !tableNode.AsClassOnly) { Package package = tableNode.Lower().Lower(); package.Type = "Table"; physicalIR.PhysicalNodes.Add(package); foreach (Table.AstTableSourceBaseNode sourceNode in tableNode.Sources) { Table.AstTableDynamicSourceNode dynamicSource = sourceNode as Table.AstTableDynamicSourceNode; if (dynamicSource != null) { Package sourcePackage = dynamicSource.Package.Lower(); sourcePackage.Type = "ETL"; physicalIR.PhysicalNodes.Add(sourcePackage); } } } } } catch (Ssis2008Emitter.SSISEmitterException EmitterException) { StringBuilder err = new StringBuilder(); err.Append("\r\nCompiling "); Exception e = EmitterException; bool bIsNullException = false; while (e != null) { err.AppendFormat("{0}\r\n", e.Message); if (e.InnerException != null) { e = (e.InnerException); err.AppendFormat("-->\t"); } else { if (e is NullReferenceException) { bIsNullException = true; } e = null; } } MessageEngine.Global.Trace(Severity.Error, err.ToString()); if (bIsNullException) { MessageEngine.Global.Trace(Severity.Warning, "Possible reason: an attribute or element is referencing undefined code." + "To solve this issue, fix the mismatched reference or use <Using> to include the definition."); } } return physicalIR; }