public PluginPipelineUser(RequiredPropertyInfo demand, ArgumentValueUIArgs args, object demanderInstance) : base(new Type[] { }) //makes it a design time use case { Getter = () => { var p = (Pipeline)args.InitialValue; return(p); }; Setter = v => args.Setter(v); var pipeDemander = demanderInstance as IDemandToUseAPipeline; if (pipeDemander == null) { throw new NotSupportedException("Class " + demanderInstance.GetType().Name + " does not implement interface IDemandToUseAPipeline despite having a property which is a Pipeline"); } _useCase = pipeDemander.GetDesignTimePipelineUseCase(demand); ExplicitSource = _useCase.ExplicitSource; ExplicitDestination = _useCase.ExplicitDestination; foreach (var o in _useCase.GetInitializationObjects()) { AddInitializationObject(o); } GenerateContext(); }
public AdvertisedPipelineComponentTypeUnderContext(Type componentType, IPipelineUseCase useCase) { _componentType = componentType; _role = PipelineComponent.GetRoleFor(componentType); var context = useCase.GetContext(); _allowableUnderContext = context.IsAllowable(componentType, out _allowableReason); Type[] initializationTypes; var initializationObjects = useCase.GetInitializationObjects(); //it is permitted to specify only Types as initialization objects if it is design time and the user hasn't picked any objects to execute the use case under if (useCase.IsDesignTime && initializationObjects.All(t => t is Type)) { initializationTypes = initializationObjects.Cast <Type>().ToArray(); } else { initializationTypes = useCase.GetInitializationObjects().Select(o => o.GetType()).ToArray(); } foreach (var requiredInputType in context.GetIPipelineRequirementsForType(componentType)) { //if there are no initialization objects that are instances of an IPipelineRequirement<T> then we cannot satisfy the components pipeline requirements (e.g. a component DelimitedFlatFileDataFlowSource requires a FlatFileToLoad but pipeline is trying to load from a database reference) if (!initializationTypes.Any(available => requiredInputType == available || requiredInputType.IsAssignableFrom(available))) { unmetRequirements.Add(requiredInputType); } } }
public override IPipelineRunner GetPipelineRunner(IPipelineUseCase useCase, IPipeline pipeline) { ConfigureAndExecutePipelineUI configureAndExecuteDialog = new ConfigureAndExecutePipelineUI(useCase, this); configureAndExecuteDialog.Dock = DockStyle.Fill; return(configureAndExecuteDialog); }
public PipelineSelectionUIFactory(ICatalogueRepository repository, RequiredPropertyInfo requirement, ArgumentValueUIArgs args, object demanderInstance) { _repository = repository; var pluginUserAndCase = new PluginPipelineUser(requirement, args, demanderInstance); _user = pluginUserAndCase; _useCase = pluginUserAndCase; }
public PipelineWorkAreaUI(IActivateItems activator, IPipeline pipeline, IPipelineUseCase useCase, ICatalogueRepository catalogueRepository) { _activator = activator; _pipeline = pipeline; _useCase = useCase; _catalogueRepository = catalogueRepository; InitializeComponent(); olvComponents.BuildGroups(olvRole, SortOrder.Ascending); olvComponents.AlwaysGroupByColumn = olvRole; olvComponents.FullRowSelect = true; _pipelineDiagram = new PipelineDiagramUI(); _pipelineDiagram.AllowSelection = true; _pipelineDiagram.AllowReOrdering = true; _pipelineDiagram.SelectedComponentChanged += _pipelineDiagram_SelectedComponentChanged; _pipelineDiagram.Dock = DockStyle.Fill; diagramPanel.Controls.Add(_pipelineDiagram); _arumentsCollection1 = new ArgumentCollectionUI(); _arumentsCollection1.Dock = DockStyle.Fill; gbArguments.Controls.Add(_arumentsCollection1); olvComponents.RowFormatter += RowFormatter; var context = _useCase.GetContext(); try { //middle and destination components var allComponentTypes = _catalogueRepository.MEF.GetGenericTypes(typeof(IDataFlowComponent <>), context.GetFlowType()); //source components (list of all types with MEF exports of ) var allSourceTypes = _catalogueRepository.MEF.GetGenericTypes(typeof(IDataFlowSource <>), context.GetFlowType()); _allComponents = new List <AdvertisedPipelineComponentTypeUnderContext>(); _allComponents.AddRange(allComponentTypes.Select(t => new AdvertisedPipelineComponentTypeUnderContext(t, _useCase)).ToArray()); _allComponents.AddRange(allSourceTypes.Select(t => new AdvertisedPipelineComponentTypeUnderContext(t, useCase)).ToArray()); RefreshComponentList(); } catch (Exception exception) { ExceptionViewer.Show("Failed to get list of supported MEF components that could be added to the pipeline ", exception); } gbArguments.Enabled = false; RDMPCollectionCommonFunctionality.SetupColumnTracking(olvComponents, olvCompatible, new Guid("1b8737cb-75d6-401b-b8a2-441e3e4322ac")); RDMPCollectionCommonFunctionality.SetupColumnTracking(olvComponents, olvNamespace, new Guid("35c0497e-3c04-46be-a6d6-eb02111aadb3")); RDMPCollectionCommonFunctionality.SetupColumnTracking(olvComponents, olvRole, new Guid("fb1205f3-049e-4fe3-89c5-d07b55fa2e17")); RDMPCollectionCommonFunctionality.SetupColumnTracking(olvComponents, olvName, new Guid("b7e797e8-ef6a-45d9-b51d-c2f12dbacead")); }
/// <summary> /// Creates a new factory which can translate <see cref="IPipeline"/> blueprints into runnable <see cref="IDataFlowPipelineEngine"/> instances. /// </summary> /// <param name="useCase">The use case which describes which <see cref="IPipeline"/> are compatible, which objects are available for hydration/preinitialization etc</param> /// <param name="mefPlugins">Class for generating Types by name, use <see cref="ICatalogueRepository.MEF"/> to get this </param> public DataFlowPipelineEngineFactory(IPipelineUseCase useCase, MEF mefPlugins) { _mefPlugins = mefPlugins; _context = useCase.GetContext(); _useCase = useCase; _flowType = _context.GetFlowType(); _constructor = new ObjectConstructor(); _engineType = typeof(DataFlowPipelineEngine <>).MakeGenericType(_flowType); }
public ConfigureAndExecutePipelineUI(IPipelineUseCase useCase, IActivateItems activator) { _useCase = useCase; InitializeComponent(); //designer mode if (useCase == null && activator == null) { return; } SetItemActivator(activator); progressUI1.ApplyTheme(activator.Theme); pipelineDiagram1 = new PipelineDiagramUI(); pipelineDiagram1.Dock = DockStyle.Fill; panel_pipelineDiagram1.Controls.Add(pipelineDiagram1); fork = new ForkDataLoadEventListener(progressUI1); var context = useCase.GetContext(); if (context.GetFlowType() != typeof(DataTable)) { throw new NotSupportedException("Only DataTable flow contexts can be used with this class"); } foreach (var o in useCase.GetInitializationObjects()) { var de = o as DatabaseEntity; if (o is DatabaseEntity) { CommonFunctionality.Add(new ExecuteCommandShow(activator, de, 0, true)); } else { CommonFunctionality.Add(o.ToString()); } _initializationObjects.Add(o); } SetPipelineOptions(activator.RepositoryLocator.CatalogueRepository); lblTask.Text = "Task: " + UsefulStuff.PascalCaseStringToHumanReadable(useCase.GetType().Name); }
//IMPORTANT:Do not change this method signature, it is used in reflection (See ArgumentValuePipelineUI.cs for one) public PipelineSelectionUI(IPipelineUseCase useCase, ICatalogueRepository repository) { _useCase = useCase; _repository = repository; InitializeComponent(); if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) //dont connect to database in design mode { return; } RefreshPipelineList(); tt.SetToolTip(cbOnlyShowCompatiblePipelines, "Untick to show all pipelines, even if they are not compatible with the current operation."); tt.SetToolTip(btnClonePipeline, "Create a new copy of the selected pipeline"); tt.SetToolTip(btnEditPipeline, "Change which components are run in the Pipeline and with what settings"); }
public PipelineWorkAreaUI(IActivateItems activator, IPipeline pipeline, IPipelineUseCase useCase, ICatalogueRepository catalogueRepository) { _activator = activator; _pipeline = pipeline; _useCase = useCase; _catalogueRepository = catalogueRepository; InitializeComponent(); olvComponents.BuildGroups(olvRole, SortOrder.Ascending); olvComponents.AlwaysGroupByColumn = olvRole; _pipelineDiagram = new PipelineDiagramUI(); _pipelineDiagram.AllowSelection = true; _pipelineDiagram.AllowReOrdering = true; _pipelineDiagram.SelectedComponentChanged += _pipelineDiagram_SelectedComponentChanged; _pipelineDiagram.Dock = DockStyle.Fill; diagramPanel.Controls.Add(_pipelineDiagram); _arumentsCollection1 = new ArgumentCollectionUI(); _arumentsCollection1.Dock = DockStyle.Fill; gbArguments.Controls.Add(_arumentsCollection1); olvComponents.RowFormatter += RowFormatter; var context = _useCase.GetContext(); try { //middle and destination components var allComponentTypes = _catalogueRepository.MEF.GetGenericTypes(typeof(IDataFlowComponent <>), context.GetFlowType()); //source components (list of all types with MEF exports of ) var allSourceTypes = _catalogueRepository.MEF.GetGenericTypes(typeof(IDataFlowSource <>), context.GetFlowType()); olvComponents.AddObjects(allComponentTypes.Select(t => new AdvertisedPipelineComponentTypeUnderContext(t, _useCase)).ToArray()); olvComponents.AddObjects(allSourceTypes.Select(t => new AdvertisedPipelineComponentTypeUnderContext(t, useCase)).ToArray()); } catch (Exception exception) { ExceptionViewer.Show("Failed to get list of supported MEF components that could be added to the pipeline ", exception); } gbArguments.Enabled = false; }
public ConfigurePipelineUI(IActivateItems activator, IPipeline pipeline, IPipelineUseCase useCase, ICatalogueRepository repository) { _pipeline = pipeline; _useCase = useCase; InitializeComponent(); _workArea = new PipelineWorkAreaUI(activator, pipeline, useCase, repository) { Dock = DockStyle.Fill }; panelWorkArea.Controls.Add(_workArea); tbName.Text = pipeline.Name; tbDescription.Text = pipeline.Description; RefreshUIFromDatabase(); KeyPreview = true; }
public PipelineSelectionUI(IActivateItems activator, IPipelineUseCase useCase, ICatalogueRepository repository) { _activator = activator; _useCase = useCase; _repository = repository; InitializeComponent(); if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) //dont connect to database in design mode { return; } RefreshPipelineList(); tt.SetToolTip(btnClonePipeline, "Create a new copy of the selected pipeline"); tt.SetToolTip(btnEditPipeline, "Change which components are run in the Pipeline and with what settings"); ddPipelines.DrawMode = DrawMode.OwnerDrawFixed; ddPipelines.DrawItem += new DrawItemEventHandler(cmb_Type_DrawItem); }
public ConsoleGuiRunPipeline(IBasicActivateItems activator, IPipelineUseCase useCase, IPipeline pipeline) { Modal = true; this.activator = activator; this._useCase = useCase; this._pipeline = pipeline; ColorScheme = ConsoleMainWindow.ColorScheme; _compatiblePipelines = useCase.FilterCompatiblePipelines(activator.RepositoryLocator.CatalogueRepository.GetAllObjects <Pipeline>()).ToArray(); Width = Dim.Fill(); Height = Dim.Fill(); if (pipeline == null && _compatiblePipelines.Length == 1) { this._pipeline = _compatiblePipelines[0]; } Add(_lblPipeline = new Label("Pipeline:" + (this._pipeline?.Name ?? "<<NOT SELECTED>>")) { Width = Dim.Fill() - 20 }); var btnChoose = new Button("Choose Pipeline") { X = Pos.Right(_lblPipeline) }; btnChoose.Clicked += BtnChoose_Clicked; Add(btnChoose); var btnRun = new Button("Run") { Y = 1 }; btnRun.Clicked += BtnRun_Clicked; Add(btnRun); var btnCancel = new Button("Cancel") { Y = 1, X = Pos.Right(btnRun) }; btnCancel.Clicked += BtnCancel_Clicked; Add(btnCancel); var btnClose = new Button("Close") { Y = 1, X = Pos.Right(btnCancel) }; btnClose.Clicked += () => Application.RequestStop(); Add(btnClose); Add(_tableView = new TableView() { Y = 2, Width = Dim.Fill(), Height = 7 }); _tableView.Style.ShowHorizontalHeaderOverline = false; _tableView.Style.AlwaysShowHeaders = true; _tableView.Style.ShowVerticalCellLines = true; _tableView.Style.ShowHorizontalHeaderUnderline = false; progressDataTable = new DataTable(); progressDataTable.Columns.Add("Name"); progressDataTable.Columns.Add("Progress", typeof(int)); _tableView.Table = progressDataTable; Add(_results = new ListView(this) { Y = Pos.Bottom(_tableView), Width = Dim.Fill(), Height = Dim.Fill() }); _results.KeyPress += Results_KeyPress; }
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(); } }
public PipelineSelectionUIFactory(ICatalogueRepository repository, IPipelineUser user, IPipelineUseCase useCase) { _repository = repository; _user = user; _useCase = useCase; }
public PipelineRunner(IPipelineUseCase useCase, IPipeline pipeline) { UseCase = useCase; Pipeline = pipeline; }
public override IPipelineRunner GetPipelineRunner(IPipelineUseCase useCase, IPipeline pipeline) { return(new ConsoleGuiRunPipeline(this, useCase, pipeline)); }
public void SetTo(IPipeline pipeline, IPipelineUseCase useCase) { _pipelineDiagram.SetTo(pipeline, useCase); }
/// <inheritdoc/> public virtual IPipelineRunner GetPipelineRunner(IPipelineUseCase useCase, IPipeline pipeline) { return(new PipelineRunner(useCase, pipeline)); }
/// <inheritdoc/> public DataFlowPipelineEngineFactory(IPipelineUseCase useCase, IPipeline pipeline) : this(useCase, ((ICatalogueRepository)pipeline.Repository).MEF) { }
public ExecuteCommandAddPipelineComponent(IBasicActivateItems activator, IPipeline pipeline, IPipelineUseCase useCaseIfAny) : base(activator) { _pipeline = pipeline; _useCaseIfAny = useCaseIfAny; }