Exemple #1
0
        private void AddBlankComponent(DataFlowComponentVisualisation.Role role)
        {
            DataFlowComponentVisualisation toAdd = new DataFlowComponentVisualisation(role, null, component_shouldAllowDrop);

            toAdd.DragDrop += component_DragDrop;
            flpPipelineDiagram.Controls.Add(toAdd);
        }
        public AdvertisedPipelineComponentTypeUnderContext(Type componentType, IPipelineUseCase useCase)
        {
            _componentType = componentType;

            _role = DataFlowComponentVisualisation.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);
                }
            }
        }
Exemple #3
0
        private void AddPipelineComponent(IPipelineComponent toRealize, DataFlowComponentVisualisation.Role role)
        {
            Exception exConstruction;

            //create the pipeline realization (might fail
            var value = _pipelineFactory.TryCreateComponent(toRealize, out exConstruction);

            if (role != DataFlowComponentVisualisation.Role.Source)
            {
                AddDividerIfReorderingAvailable();
            }

            //create the visualization
            var component = new PipelineComponentVisualisation(toRealize, role, value, exConstruction, component_shouldAllowDrop);

            component.DragDrop += component_DragDrop;
            flpPipelineDiagram.Controls.Add(component);//add the component

            //try to initialize the realization (we do this after creating visualization so that when the events come in we can record where on UI the consumption events happen and also because later on it might be that initialization takes ages and we want to use a Thread)
            if (value != null)
            {
                try
                {
                    if (!_useCase.IsDesignTime)
                    {
                        _useCase.GetContext().PreInitializeGeneric(new ThrowImmediatelyDataLoadEventListener(), value, _useCase.GetInitializationObjects().ToArray());
                        component.Check();
                    }

                    component.CheckMandatoryProperties();
                }
                catch (Exception exInit)
                {
                    //initialization failed
                    component.ExInitialization = exInit;
                }
            }

            component.AllowDrag = AllowReOrdering;

            if (AllowSelection)
            {
                component.AllowSelection     = true;
                component.ComponentSelected += component_Selected;
            }


            //PipelineComponents can never be locked because they are user setup things
            component.IsLocked = false;
        }
Exemple #4
0
 //by ID overload
 private void AddPipelineComponent(int componentID, DataFlowComponentVisualisation.Role role, IRepository repository)
 {
     AddPipelineComponent(repository.GetObjectByID <PipelineComponent>(componentID), role);
 }