示例#1
0
        /// <summary>
        /// Workflow instance constructor.
        /// </summary>
        /// <param name="runtime"></param>
        /// <param name="definition">The workflow definition.</param>
        /// <param name="metadata">The metadata which includes parameters etc.</param>
        /// <param name="pipelineInput">This is input coming from pipeline, which is added to the input stream.</param>
        /// <param name="job"></param>
        internal PSWorkflowApplicationInstance(
                                        PSWorkflowRuntime runtime, 
                                        PSWorkflowDefinition definition,
                                        PSWorkflowContext metadata,
                                        PSDataCollection<PSObject> pipelineInput,                                        
                                        PSWorkflowJob job)
        {
            Tracer.WriteMessage("Creating Workflow instance.");
            InitializePSWorkflowApplicationInstance(runtime);
            this._definition = definition;
            this._metadatas = metadata;
            this._streams = new PowerShellStreams<PSObject, PSObject>(pipelineInput);
            RegisterHandlersForDataAdding(_streams);
            this._timers = new PSWorkflowTimer(this);           
            this.creationMode = WorkflowInstanceCreationMode.Normal;

            _job = job;
            _stores = Runtime.Configuration.CreatePSWorkflowInstanceStore(this);

            this._remoteActivityState = new PSWorkflowRemoteActivityState(_stores);
        }
		internal PSWorkflowApplicationInstance(PSWorkflowRuntime runtime, PSWorkflowId instanceId)
		{
			this.Tracer = PowerShellTraceSourceFactory.GetTraceSource();
			this.wfAppNeverLoaded = true;
			this.ReactivateSync = new object();
			if (runtime != null)
			{
				this.Tracer.WriteMessage("Creating Workflow instance after crash and shutdown workflow.");
				this._definition = null;
				this._metadatas = null;
				this._streams = null;
				this._timers = null;
				this.id = instanceId.Guid;
				this.creationMode = WorkflowInstanceCreationMode.AfterCrashOrShutdown;
				this.PersistAfterNextPSActivity = false;
				this.suspendAtNextCheckpoint = false;
				base.Runtime = runtime;
				this._stores = base.Runtime.Configuration.CreatePSWorkflowInstanceStore(this);
				this.asyncExecutionCollection = new Dictionary<string, PSActivityContext>();
				base.ForceDisableStartOrEndPersistence = false;
				return;
			}
			else
			{
				throw new ArgumentNullException("runtime");
			}
		}
示例#3
0
        /// <summary>
        /// Workflow instance constructor for shutdown or crashed workflows.
        /// </summary>
        /// <param name="runtime"></param>
        /// <param name="instanceId"></param>
        internal PSWorkflowApplicationInstance(PSWorkflowRuntime runtime, PSWorkflowId instanceId)
        {
            Tracer.WriteMessage("Creating Workflow instance after crash and shutdown workflow.");
            InitializePSWorkflowApplicationInstance(runtime);
            this._definition = null;
            this._metadatas = null;
            this._streams = null;
            this._timers = null;
            this.id = instanceId.Guid;
            this.creationMode = WorkflowInstanceCreationMode.AfterCrashOrShutdown;

            _stores = Runtime.Configuration.CreatePSWorkflowInstanceStore(this);
            this._remoteActivityState = null;            
        }
		internal PSWorkflowApplicationInstance(PSWorkflowRuntime runtime, PSWorkflowDefinition definition, PSWorkflowContext metadata, PSDataCollection<PSObject> pipelineInput, PSWorkflowJob job)
		{
			this.Tracer = PowerShellTraceSourceFactory.GetTraceSource();
			this.wfAppNeverLoaded = true;
			this.ReactivateSync = new object();
			if (runtime != null)
			{
				this.Tracer.WriteMessage("Creating Workflow instance.");
				this._definition = definition;
				this._metadatas = metadata;
				this._streams = new PowerShellStreams<PSObject, PSObject>(pipelineInput);
				this.RegisterHandlersForDataAdding(this._streams);
				this._timers = new PSWorkflowTimer(this);
				this.creationMode = WorkflowInstanceCreationMode.Normal;
				this.PersistAfterNextPSActivity = false;
				this.suspendAtNextCheckpoint = false;
				this._job = job;
				base.Runtime = runtime;
				this._stores = base.Runtime.Configuration.CreatePSWorkflowInstanceStore(this);
				this.asyncExecutionCollection = new Dictionary<string, PSActivityContext>();
				base.ForceDisableStartOrEndPersistence = false;
				return;
			}
			else
			{
				throw new ArgumentNullException("runtime");
			}
		}