Ejemplo n.º 1
0
        protected void AddReadResourceDataSettings(ItemModel source, PipelineStep pipelineStep)
        {
            var readResourceDataSettings = new ReadResourceDataSettings
            {
                PathExpression = this.GetStringValue(source, ReadResourceDataPipelineStepItemModel.PathExpression)
            };

            pipelineStep.Plugins.Add(readResourceDataSettings);
        }
        public override void Process(PipelineStep pipelineStep, PipelineContext pipelineContext)
        {
            var logger = pipelineContext.PipelineBatchContext.Logger;

            if (!this.CanProcess(pipelineStep, pipelineContext))
            {
                logger.Error("Pipeline step processing will abort because the pipeline step cannot be processed. (pipeline step: {0})", pipelineStep.Name);
            }
            else
            {
                EndpointSettings endpointSettings = pipelineStep.GetEndpointSettings();
                if (endpointSettings == null)
                {
                    logger.Error("Pipeline step processing will abort because the pipeline step is missing a plugin. (pipeline step: {0}, plugin: {1})", pipelineStep.Name,
                                 typeof(EndpointSettings).FullName);
                }
                else
                {
                    ReadResourceDataSettings readDataSettings = pipelineStep.GetReadResourceDataSettings();
                    if (readDataSettings == null)
                    {
                        this.Log(logger.Error, pipelineContext, "Pipeline step processing will abort because the pipeline step is missing a plugin.", string.Format("plugin: {0}", typeof(ReadResourceDataSettings).FullName));
                    }
                    else
                    {
                        Endpoint endpointFrom = endpointSettings.EndpointFrom;
                        if (endpointFrom == null)
                        {
                            logger.Error(
                                "Pipeline step processing will abort because the pipeline step is missing an endpoint to read from. (pipeline step: {0}, plugin: {1}, property: {2})",
                                pipelineStep.Name, typeof(EndpointSettings).FullName, "EndpointFrom");
                        }
                        else if (!this.IsEndpointValid(endpointFrom, pipelineStep, pipelineContext))
                        {
                            logger.Error("Pipeline step processing will abort because the endpoint to read from is not valid. (pipeline step: {0}, endpoint: {1})",
                                         pipelineStep.Name,
                                         endpointFrom.Name);
                        }
                        else
                        {
                            logger.Info("Pipeline step reading data. (pipeline step: {0}, plugin: {1})", pipelineStep.Name, typeof(EndpointSettings).FullName);

                            var dataRead = Task.Run <bool>(async() => await this.ReadData(endpointFrom, pipelineStep, pipelineContext)).Result;

                            logger.Info("Pipeline context has iterable data? {0} (pipeline step: {1}, plugin: {2})", pipelineContext.HasIterableDataSettings(), pipelineStep.Name, typeof(EndpointSettings).FullName);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected override void ProcessPipelineStep(PipelineStep pipelineStep, PipelineContext pipelineContext, ILogger logger)
        {
            EndpointSettings endpointSettings = pipelineStep.GetEndpointSettings();

            if (endpointSettings == null)
            {
                logger.Error("Pipeline step processing will abort because the pipeline step is missing a plugin. (pipeline step: {0}, plugin: {1})", pipelineStep.Name,
                             typeof(EndpointSettings).FullName);
            }
            else
            {
                ReadResourceDataSettings readDataSettings = pipelineStep.GetReadResourceDataSettings();
                if (readDataSettings == null)
                {
                    this.Log(logger.Error, pipelineContext, "Pipeline step processing will abort because the pipeline step is missing a plugin.", string.Format("plugin: {0}", typeof(ReadResourceDataSettings).FullName));
                }
                else
                {
                    Endpoint endpointFrom = endpointSettings.EndpointFrom;
                    if (endpointFrom == null)
                    {
                        logger.Error(
                            "Pipeline step processing will abort because the pipeline step is missing an endpoint to read from. (pipeline step: {0}, plugin: {1}, property: {2})",
                            pipelineStep.Name, typeof(EndpointSettings).FullName, Templates.BaseEndpointPipelineStep.FieldNames.EndpointFrom);
                    }
                    else if (!this.IsEndpointValid(endpointFrom, pipelineStep, pipelineContext, logger))
                    {
                        logger.Error("Pipeline step processing will abort because the endpoint to read from is not valid. (pipeline step: {0}, endpoint: {1})",
                                     pipelineStep.Name,
                                     endpointFrom.Name);
                    }
                    else
                    {
                        logger.Info("Pipeline step reading data. (pipeline step: {0}, plugin: {1})", pipelineStep.Name, typeof(EndpointSettings).FullName);

                        var dataRead = Task.Run <bool>(async() => await this.ReadData(endpointFrom, pipelineStep, pipelineContext, logger)).Result;

                        logger.Info("Pipeline context has data? {0} (pipeline step: {1}, plugin: {2})", pipelineContext.HasIterableDataSettings(), pipelineStep.Name, typeof(EndpointSettings).FullName);
                    }
                }
            }
        }