public WorkflowContainerContext(IState persistentState)
        {
            var state = persistentState as WorkflowContextState;

            if (state == null)
            {
                throw new WorkflowEngineException("WorkflowContainerContext must be loaded with an object of type WorkflowContextState");
            }
            ExecutionContext  = new ExecutionContext(state.ExecutionContext);
            ContainerInputs   = new PluginInputs(state.ContainerInputs, ExecutionContext);
            RootPluginContext = new PluginContext(state.RootPluginContext);

            // Sync Root Plugin Context with Execution Context (Pointer Swizzling)
            RootPluginContext = ExecutionContext.GetPluginContextFromId(RootPluginContext.PluginId);
            Executed          = state.Executed;
            Variants          = state.Variants;
        }
Пример #2
0
        private T GetOrCreatePluginInternal <T>(string id)
            where T : Plugin, new()
        {
            var           currentPluginContext         = _executionContext.CurrentPluginContext;
            var           currentedPluginNestedPlugins = currentPluginContext.Plugins;
            PluginContext pluginContext = null;

            if (currentedPluginNestedPlugins.ContainsKey(id))
            {
                var pluginId = currentedPluginNestedPlugins[id];
                pluginContext = _executionContext.GetPluginContextFromId(pluginId);
            }

            var plugin = new T();

            plugin.Initialize(_executionContext, pluginContext);
            currentedPluginNestedPlugins[id] = plugin.PluginId;

            return(plugin);
        }
Пример #3
0
        internal void Initialize(ExecutionContext executionContext, PluginContext pluginContext)
        {
            _executionContext = executionContext ?? throw new WorkflowEngineException("Cannot initalize plugin with a null execution context");

            if (pluginContext != null)
            {
                PluginContext = pluginContext;
            }
            else
            {
                PluginContext = new PluginContext
                {
                    PluginId   = new PluginId(),
                    PluginName = ExecInfo.PluginName,
                    Version    = ExecInfo.Version
                };
                _executionContext.AddPluginContext(PluginContext);
            }
            _isInitialized = true;
        }
Пример #4
0
 /// <summary>
 /// Updates the consumers list for the inputs of this plugin to include the plugin
 /// </summary>
 public void UpdateInputConsumers(PluginContext pluginContext)
 {
     _dependencyGraph.UpdateInputsConsumers(pluginContext);
 }
Пример #5
0
 /// <summary>
 /// Signals that a plugin is going to execute now
 /// </summary>
 /// <param name="pluginContext">ExecutionContext of the plugin about to execute</param>
 public void StartPluginExecution(PluginContext pluginContext)
 {
     _pluginRuntimeStack.Push(pluginContext.PluginId);
 }
Пример #6
0
 public void AddPluginContext(PluginContext pluginContext)
 {
     _pluginContexts[pluginContext.PluginId] = pluginContext;
 }
Пример #7
0
 public bool PluginExecuted(PluginContext pluginContext)
 {
     return(_dependencyGraph.PluginHasExecuted(pluginContext.PluginId));
 }