Exemplo n.º 1
0
        /// <summary>
        /// Fired when a stage is processed or when a component
        /// is going to be called
        /// </summary>
        /// <param name="sender">stage or component called</param>
        /// <param name="args">stage message</param>
        private void OnCallingStage(object sender, PCallEventArgs args)
        {
            PStage stage = sender as PStage;

            if (stage != null)
            {
                var configure = _pipelineContext as IConfigurePipelineContext;
                if (configure != null)
                {
                    configure.SetCurrentStage(stage.Id);
                }
            }
        }
Exemplo n.º 2
0
        //
        // Protected Methods
        //

        /// <summary>
        /// Finds a stage in the pipeline
        /// </summary>
        /// <param name="stage">Stage definition</param>
        /// <returns>The stage, if found, or a new stage if necessary</returns>
        protected PStage FindStage(PipelineStage stage)
        {
            PStage theStage = null;

            foreach (PStage pstage in _pipeline.Stages)
            {
                if (pstage.Id == stage.ID)
                {
                    theStage = pstage;
                    break;
                }
            }
            if (theStage == null)
            {
                theStage = new PStage(stage.Name, stage.ExecuteMethod, stage.ID, _pipeline);
                _pipeline.Stages.Add(theStage);
            }
            return(theStage);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a component to the specified stage
        /// </summary>
        /// <param name="component">Component to add to the stage</param>
        /// <param name="stage">Stage to add it to</param>
        public void AddComponent(IBaseComponent component, PipelineStage stage)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            if (stage == null)
            {
                throw new ArgumentNullException("stage");
            }

            if (stage.IsReceiveStage != _isReceivePipeline)
            {
                throw new ArgumentException("Invalid Stage", "stage");
            }

            PStage theStage = FindStage(stage);

            theStage.AddComponent(component);
        }