コード例 #1
0
        private void SetPipelineOptions(ICatalogueRepository repository)
        {
            if (_pipelineOptionsSet)
            {
                throw new Exception("CreateDatabase SetPipelineOptions has already been called, it should only be called once per instance lifetime");
            }


            _pipelineOptionsSet = true;

            _pipelineSelectionUI = new PipelineSelectionUI(Activator, _useCase, repository)
            {
                Dock = DockStyle.Fill
            };
            _pipelineSelectionUI.PipelineChanged += _pipelineSelectionUI_PipelineChanged;
            _pipelineSelectionUI.PipelineDeleted += () => pipelineDiagram1.Clear();

            _pipelineSelectionUI.CollapseToSingleLineMode();

            pPipelineSelection.Controls.Add(_pipelineSelectionUI);

            //setup factory
            PipelineFactory = new DataFlowPipelineEngineFactory(_useCase, repository.MEF);

            _pipelineOptionsSet = true;

            RefreshDiagram();
        }
コード例 #2
0
ファイル: PipelineUseCase.cs プロジェクト: 24418863/rdm
        /// <inheritdoc/>
        public virtual IDataFlowPipelineEngine GetEngine(IPipeline pipeline, IDataLoadEventListener listener)
        {
            var engine = new DataFlowPipelineEngineFactory(this, pipeline).Create(pipeline, listener);

            engine.Initialize(GetInitializationObjects().ToArray());

            return(engine);
        }
コード例 #3
0
        private void ddPipeline_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataFlowPipelineEngineFactory factory = GetFactory();

            var p = ddPipeline.SelectedItem as Pipeline;

            if (p == null)
            {
                return;
            }
            try
            {
                var source = factory.CreateSourceIfExists(p);
                ((IPipelineRequirement <FlatFileToLoad>)source).PreInitialize(new FlatFileToLoad(_selectedFile), new FromCheckNotifierToDataLoadEventListener(ragSmileyFile));
                ((ICheckable)source).Check(ragSmileyFile);
            }
            catch (Exception exception)
            {
                ragSmileyFile.Fatal(exception);
            }
        }
コード例 #4
0
        public void TestNestedDemandsGetPutIntoDatabaseAndCanBeBroughtBack()
        {
            var pipe = new Pipeline(CatalogueRepository, "NestedPipe");
            var pc   = new PipelineComponent(CatalogueRepository, pipe, typeof(BasicDataReleaseDestination), -1,
                                             "Coconuts");

            pipe.DestinationPipelineComponent_ID = pc.ID;
            pipe.SaveToDatabase();

            //some of the DemandsInitialization on BasicDataReleaseDestination should be nested
            var f = new ArgumentFactory();

            Assert.True(
                f.GetRequiredProperties(typeof(BasicDataReleaseDestination)).Any(r => r.ParentPropertyInfo != null));

            //new pc should have no arguments
            Assert.That(pc.GetAllArguments(), Is.Empty);

            //we create them (the root and nested ones!)
            var args = pc.CreateArgumentsForClassIfNotExists <BasicDataReleaseDestination>();

            //and get all arguments / create arguments for class should have handled that
            Assert.That(pc.GetAllArguments().Any());

            var match = args.Single(a => a.Name == "ReleaseSettings.DeleteFilesOnSuccess");

            match.SetValue(true);
            match.SaveToDatabase();

            var useCase = ReleaseUseCase.DesignTime();

            var factory      = new DataFlowPipelineEngineFactory(useCase, RepositoryLocator.CatalogueRepository.MEF);
            var destInstance = factory.CreateDestinationIfExists(pipe);

            Assert.AreEqual(true, ((BasicDataReleaseDestination)destInstance).ReleaseSettings.DeleteFilesOnSuccess);
        }
コード例 #5
0
        public void SetTo(IPipeline pipeline, IPipelineUseCase useCase)
        {
            _useCase = useCase;

            _pipeline = pipeline;
            if (_pipeline != null)
            {
                _pipeline.ClearAllInjections();
            }

            //clear the diagram
            flpPipelineDiagram.Controls.Clear();

            pipelineSmiley.Reset();

            try
            {
                //if there is a pipeline
                if (_pipeline != null)
                {
                    try
                    {
                        _pipelineFactory = new DataFlowPipelineEngineFactory(_useCase, _pipeline);

                        //create it
                        IDataFlowPipelineEngine pipelineInstance = _pipelineFactory.Create(pipeline, new ThrowImmediatelyDataLoadEventListener());

                        //initialize it (unless it is design time)
                        if (!_useCase.IsDesignTime)
                        {
                            pipelineInstance.Initialize(_useCase.GetInitializationObjects().ToArray());
                        }
                    }
                    catch (Exception ex)
                    {
                        pipelineSmiley.Fatal(ex);
                    }

                    //There is a pipeline set but we might have been unable to fully realize it so setup stuff based on PipelineComponents

                    //was there an explicit instance?
                    if (_useCase.ExplicitSource != null)
                    {
                        AddExplicit(_useCase.ExplicitSource);//if so add it
                    }
                    else
                    //there wasn't an explicit one so there was a PipelineComponent maybe? albiet one that might be broken?
                    if (pipeline.SourcePipelineComponent_ID != null)
                    {
                        AddPipelineComponent((int)pipeline.SourcePipelineComponent_ID, DataFlowComponentVisualisation.Role.Source, pipeline.Repository);    //add the possibly broken PipelineComponent to the diagram
                    }
                    else
                    {
                        AddBlankComponent(DataFlowComponentVisualisation.Role.Source);    //the user hasn't put one in yet
                    }
                    foreach (var middleComponent in pipeline.PipelineComponents.Where(c => c.ID != pipeline.SourcePipelineComponent_ID && c.ID != pipeline.DestinationPipelineComponent_ID).OrderBy(comp => comp.Order))
                    {
                        AddPipelineComponent(middleComponent, DataFlowComponentVisualisation.Role.Middle);//add the possibly broken PipelineComponent to the diagram
                    }
                    //was there an explicit instance?
                    if (_useCase.ExplicitDestination != null)
                    {
                        AddDividerIfReorderingAvailable();
                        AddExplicit(_useCase.ExplicitDestination);//if so add it
                    }
                    else
                    //there wasn't an explicit one so there was a PipelineComponent maybe? albiet one that might be broken?
                    if (pipeline.DestinationPipelineComponent_ID != null)
                    {
                        AddPipelineComponent((int)pipeline.DestinationPipelineComponent_ID, DataFlowComponentVisualisation.Role.Destination, pipeline.Repository);    //add the possibly broken PipelineComponent to the diagram
                    }
                    else
                    {
                        AddDividerIfReorderingAvailable();
                        AddBlankComponent(DataFlowComponentVisualisation.Role.Destination);    //the user hasn't put one in yet
                    }


                    return;
                }


                //Fallback
                //user has not picked a pipeline yet, show him the shell (factory)
                //factory has no source, add empty source
                if (_useCase.ExplicitSource == null)
                {
                    AddBlankComponent(DataFlowComponentVisualisation.Role.Source);
                }
                else
                {
                    AddExplicit(_useCase.ExplicitSource);
                }


                //factory has no source, add empty source
                if (_useCase.ExplicitDestination == null)
                {
                    AddBlankComponent(DataFlowComponentVisualisation.Role.Destination);
                }
                else
                {
                    AddExplicit(_useCase.ExplicitDestination);
                }
            }
            finally
            {
                Invalidate();
            }
        }