예제 #1
0
        public IBaseMessage GetNextOutputMessage(IPipelineContext pipelineContext)
        {
            if (pipelineContext == null)
            {
                throw new ArgumentNullException("pipelineContext");
            }
            if (!this.IsDisassemblingStage())
            {
                throw new NotSupportedException("This call is legal only for the disassembling stage");
            }
            IBaseMessage outputMessage = null;

            if (this.components.Count == 0)
            {
                outputMessage      = this.outputMessage;
                this.outputMessage = null;
                return(outputMessage);
            }
            IBaseComponent         sender     = this.components[this.currentDisassembler] as IBaseComponent;
            IDisassemblerComponent component2 = this.components[this.currentDisassembler] as IDisassemblerComponent;

            this.FireCalling(sender, "GetNext");
            if (component2 != null)
            {
                outputMessage = component2.GetNext(pipelineContext);
            }
            this.FireCalled(sender, "GetNext");
            return(outputMessage);
        }
예제 #2
0
        public static Microsoft.BizTalk.Message.Interop.IBaseMessage Disassemble(IDisassemblerComponent disassembler, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg, Microsoft.BizTalk.Component.Interop.IPipelineContext pc)
        {
            disassembler.Disassemble(pc, inmsg);
            IBaseMessage message = disassembler.GetNext(pc);

            pc.ResourceTracker.AddResource(message);

            return(message);
        }
예제 #3
0
        public IBaseMessage Execute(IPipelineContext pipelineContext, IBaseMessage inputMessage)
        {
            IBaseMessage pInMsg = inputMessage;

            if (!this.IsDisassemblingStage())
            {
                if (this.executeMethod != ExecuteMethod.All)
                {
                    throw new NotSupportedException("Execution method is not supported");
                }
                foreach (IComponent component4 in this.components)
                {
                    this.FireCalling(component4 as IBaseComponent, "Execute");
                    pInMsg = component4.Execute(pipelineContext, pInMsg);
                    this.FireCalled(component4 as IBaseComponent, "Execute");
                }
                return(pInMsg);
            }
            if (this.executeMethod != ExecuteMethod.FirstMatch)
            {
                throw new NotSupportedException("Execution method is invalid for the disassembling stage");
            }
            if (this.components.Count <= 0)
            {
                this.outputMessage = pInMsg;
                return(pInMsg);
            }
            bool flag = false;

            for (int i = 0; i < this.components.Count; i++)
            {
                IBaseComponent sender   = this.components[i] as IBaseComponent;
                IProbeMessage  message2 = this.components[i] as IProbeMessage;
                if (message2 != null)
                {
                    this.FireCalling(sender, "Probe");
                    flag = message2.Probe(pipelineContext, pInMsg);
                    this.FireCalled(sender, "Probe");
                }
                else
                {
                    flag = true;
                }
                if (flag)
                {
                    this.currentDisassembler = i;
                    IDisassemblerComponent component2 = this.components[this.currentDisassembler] as IDisassemblerComponent;
                    if (component2 != null)
                    {
                        this.FireCalling(sender, "Disassemble");
                        component2.Disassemble(pipelineContext, pInMsg);
                        this.FireCalled(sender, "Disassemble");
                    }
                    else
                    {
                        IComponent component3 = this.components[this.currentDisassembler] as IComponent;
                        if (component3 == null)
                        {
                            throw new InvalidOperationException("Pipeline component doesn't implement IDisassemblerComponent nor IComponent interfaces");
                        }
                        this.FireCalling(sender, "Execute");
                        pInMsg = component3.Execute(pipelineContext, pInMsg);
                        this.FireCalled(sender, "Execute");
                    }
                    break;
                }
            }
            if (!flag)
            {
                throw new InvalidOperationException("None of the disassembler components could recognize a data");
            }
            return(pInMsg);
        }