示例#1
0
 public EventHandler(AstTaskEventHandlerNode astNode, Executable hostExecutable)
     : base(astNode.EventType.ToString()) 
 {
     _astTaskEventHandlerNode = astNode;
     _hostExecutable = hostExecutable;
     _eventName = _astTaskEventHandlerNode.EventType.ToString();
 }
示例#2
0
文件: Container.cs 项目: japj/vulcan
        public void ProcessTaskBinding(Executable executable)
        {
            if (executable.BindingList != null && executable.BindingList.Count > 0)
            {
                foreach (var binding in executable.BindingList)
                {
                    var parentExecutable = DtsSequence.Executables[((AST.AstNamedNode)binding.AstTaskflowInput.OutputPath.ParentItem).Name];
                    if (parentExecutable == null)
                    {
                        throw new InvalidOperationException("Could not find " + binding.AstTaskflowInput.OutputPath.Name);
                    }

                    var constraint = DtsSequence.PrecedenceConstraints.Add(parentExecutable, executable.DtsExecutable);
                    constraint.Name = GetPrecedenceConstraintEmissionName(binding.AstTaskflowPrecedenceConstraints, binding.AstTaskflowInput);
                    switch (binding.AstTaskflowInput.EvaluationOperation)
                    {
                        case TaskEvaluationOperationType.Constraint:
                            constraint.EvalOp = Microsoft.SqlServer.Dts.Runtime.DTSPrecedenceEvalOp.Constraint;
                            break;
                        case TaskEvaluationOperationType.Expression:
                            constraint.EvalOp = Microsoft.SqlServer.Dts.Runtime.DTSPrecedenceEvalOp.Expression;
                            constraint.Expression = binding.AstTaskflowInput.Expression;
                            break;
                        case TaskEvaluationOperationType.ExpressionAndConstraint:
                            constraint.EvalOp = Microsoft.SqlServer.Dts.Runtime.DTSPrecedenceEvalOp.ExpressionAndConstraint;
                            constraint.Expression = binding.AstTaskflowInput.Expression;
                            break;
                        case TaskEvaluationOperationType.ExpressionOrConstraint:
                            constraint.EvalOp = Microsoft.SqlServer.Dts.Runtime.DTSPrecedenceEvalOp.ExpressionOrConstraint;
                            constraint.Expression = binding.AstTaskflowInput.Expression;
                            break;
                        default:
                            throw new NotImplementedException(String.Format(CultureInfo.InvariantCulture, "TaskEvaluationOperationType {0} is not supported.", binding.AstTaskflowInput.EvaluationOperation));
                    }

                    switch (binding.AstTaskflowInput.EvaluationValue)
                    {
                        case TaskEvaluationOperationValue.Completion:
                            constraint.Value = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Completion;
                            break;
                        case TaskEvaluationOperationValue.Failure:
                            constraint.Value = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure;
                            break;
                        case TaskEvaluationOperationValue.Success:
                            constraint.Value = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success;
                            break;
                        default:
                            throw new NotImplementedException(String.Format(CultureInfo.InvariantCulture, "EvaluationValue {0} is not supported.", binding.AstTaskflowInput.EvaluationValue));
                    }

                    switch (binding.AstTaskflowPrecedenceConstraints.LogicalType)
                    {
                        case LogicalOperationType.And:
                            constraint.LogicalAnd = true;
                            break;
                        case LogicalOperationType.Or:
                            constraint.LogicalAnd = false;
                            break;
                        default:
                            break;
                    }
                }
            }
            else
            {
                if (ConstraintMode == ContainerConstraintMode.Linear)
                {
                    if (_lastExecutable != null)
                    {
                        var constraint = DtsSequence.PrecedenceConstraints.Add(_lastExecutable, executable.DtsExecutable);
                        constraint.Name = String.Format(CultureInfo.InvariantCulture, "__DefaultLinear_Sink_{0}", executable.Name);
                    }

                    if (DtsSequence.Executables.Count > 0)
                    {
                        _lastExecutable = executable.DtsExecutable;
                    }
                }
            }
        }
示例#3
0
        public static void LowerEventHandlers(AstTask.AstTaskNode astTaskNode, Executable parentExecutable, LoweringContext context)
        {
            foreach (AstTask.AstTaskEventHandlerNode astTaskEventHandler in astTaskNode.Events)
            {
                PhysicalTask.EventHandler e = new IR.Tasks.EventHandler(astTaskEventHandler, parentExecutable);
                context.ParentObject.Children.Add(e);

                foreach (AstTask.AstTaskNode task in astTaskEventHandler.Tasks)
                {
                    context = new TaskLoweringContext(e);
                    PhysicalLoweringProcessor.Lower(task, context);
                }
            }
        }