public PSWorkflowTimer(PSWorkflowInstance instance, object deserializedTimers) { this.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); this.syncLock = new object(); this.syncElapsedLock = new object(); this._instance = instance; this._timers = new Dictionary<WorkflowTimerType, PSTimer>(); if (deserializedTimers != null) { List<object> objs = (List<object>)deserializedTimers; foreach (object obj in objs) { if (obj == null || obj as Dictionary<string, object> == null) { continue; } PSTimer pSTimer = new PSTimer((Dictionary<string, object>)obj, new WorkflowTimerElapsedHandler(this.Timer_WorkflowTimerElapsed)); this._timers.Add(pSTimer.TimerType, pSTimer); } return; } else { throw new ArgumentNullException("deserializedTimers"); } }
private DefinitionCache() { this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._workflowDetailsCache = new Dictionary<WorkflowJobDefinition, DefinitionCache.WorkflowDetails>(new CompareBasedOnInstanceId()); this._cachedActivities = new ConcurrentDictionary<WorkflowJobDefinition, Activity>(new CompareBasedOnInstanceId()); this._syncObject = new object(); }
public ContainerParentJob(string command, string name, JobIdentifier jobId, string jobType) : base(command, name, jobId) { this._moreData = true; this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._executionError = new PSDataCollection<ErrorRecord>(); base.PSJobTypeName = jobType; }
internal PSWorkflowTimer(PSWorkflowInstance instance) { this.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); this.syncLock = new object(); this.syncElapsedLock = new object(); this._instance = instance; this._timers = new Dictionary<WorkflowTimerType, PSTimer>(); }
internal PSWorkflowTrackingParticipant() { this.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._structuredTracer = new Tracer(); object[] objArray = new object[1]; objArray[0] = "WorkflowTrackingParticipant"; this.Tracer.WriteMessage(string.Format(CultureInfo.InvariantCulture, "{0} Created", objArray)); }
internal LocalRunspaceProvider(int timeoutSeconds, int maxRunspaces, PSLanguageMode? languageMode) { this._requests = new ConcurrentQueue<LocalRunspaceAsyncResult>(); this._callbacks = new ConcurrentQueue<LocalRunspaceAsyncResult>(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._runspaceCache = new TimeBasedCache<Runspace>(timeoutSeconds); this._maxRunspaces = maxRunspaces; this._languageMode = languageMode; }
internal PersistenceVersion(bool enableEncryption, bool enableCompression) { this.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); this.syncLock = new object(); this.StoreVersion = new Version(1, 0); this.CLRVersion = Environment.Version; this.EnableEncryption = enableEncryption; this.EnableCompression = enableCompression; }
static PSWorkflowValidator() { PSWorkflowValidator.Facility = "WorkflowValidation : "; PSWorkflowValidator.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); PSWorkflowValidator._structuredTracer = new Tracer(); List<string> strs = new List<string>(); strs.Add("DynamicActivity"); strs.Add("DoWhile"); strs.Add("ForEach`1"); strs.Add("If"); strs.Add("Parallel"); strs.Add("ParallelForEach`1"); strs.Add("Sequence"); strs.Add("Switch`1"); strs.Add("While"); strs.Add("Assign"); strs.Add("Assign`1"); strs.Add("Delay"); strs.Add("InvokeMethod"); strs.Add("TerminateWorkflow"); strs.Add("WriteLine"); strs.Add("Rethrow"); strs.Add("Throw"); strs.Add("TryCatch"); strs.Add("Literal`1"); strs.Add("VisualBasicValue`1"); strs.Add("VisualBasicReference`1"); strs.Add("LocationReferenceValue`1"); strs.Add("VariableValue`1"); strs.Add("VariableReference`1"); strs.Add("LocationReferenceReference`1"); strs.Add("LambdaValue`1"); strs.Add("Flowchart"); strs.Add("FlowDecision"); strs.Add("FlowSwitch`1"); strs.Add("AddToCollection`1"); strs.Add("ExistsInCollection`1"); strs.Add("RemoveFromCollection`1"); strs.Add("ClearCollection`1"); PSWorkflowValidator.AllowedSystemActivities = strs; HashSet<string> strs1 = new HashSet<string>(); strs1.Add("microsoft.powershell.activities"); strs1.Add("microsoft.powershell.core.activities"); strs1.Add("microsoft.powershell.diagnostics.activities"); strs1.Add("microsoft.powershell.management.activities"); strs1.Add("microsoft.powershell.security.activities"); strs1.Add("microsoft.powershell.utility.activities"); strs1.Add("microsoft.wsman.management.activities"); PSWorkflowValidator.PowerShellActivitiesAssemblies = strs1; PSWorkflowValidator.TestMode = false; PSWorkflowValidator.ObjectCounter = (long)0; }
internal PSChildJobProxy(string command, PSObject o) : base(command) { string str; this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._syncObject = new object(); PSJobProxy.TryGetJobPropertyValue<string>(o, "StatusMessage", out this._statusMessage); PSJobProxy.TryGetJobPropertyValue<string>(o, "Location", out this._location); PSJobProxy.TryGetJobPropertyValue<string>(o, "Name", out str); base.Name = str; base.Output.DataAdded += new EventHandler<DataAddedEventArgs>(this.OutputAdded); base.Error.DataAdded += new EventHandler<DataAddedEventArgs>(this.ErrorAdded); base.Warning.DataAdded += new EventHandler<DataAddedEventArgs>(this.WarningAdded); base.Verbose.DataAdded += new EventHandler<DataAddedEventArgs>(this.VerboseAdded); base.Progress.DataAdded += new EventHandler<DataAddedEventArgs>(this.ProgressAdded); base.Debug.DataAdded += new EventHandler<DataAddedEventArgs>(this.DebugAdded); }
internal OutOfProcessClientSessionTransportManager(Guid runspaceId, NewProcessConnectionInfo connectionInfo, PSRemotingCryptoHelper cryptoHelper) : base(runspaceId, cryptoHelper) { this._processCreated = true; this.onDataAvailableToSendCallback = new System.Management.Automation.Remoting.PrioritySendDataCollection.OnDataAvailableCallback(this.OnDataAvailableCallback); this.cmdTransportManagers = new Dictionary<Guid, OutOfProcessClientCommandTransportManager>(); this.connectionInfo = connectionInfo; this.dataProcessingCallbacks = new OutOfProcessUtils.DataProcessingDelegates(); this.dataProcessingCallbacks.DataPacketReceived = (OutOfProcessUtils.DataPacketReceived) Delegate.Combine(this.dataProcessingCallbacks.DataPacketReceived, new OutOfProcessUtils.DataPacketReceived(this.OnDataPacketReceived)); this.dataProcessingCallbacks.DataAckPacketReceived = (OutOfProcessUtils.DataAckPacketReceived) Delegate.Combine(this.dataProcessingCallbacks.DataAckPacketReceived, new OutOfProcessUtils.DataAckPacketReceived(this.OnDataAckPacketReceived)); this.dataProcessingCallbacks.CommandCreationPacketReceived = (OutOfProcessUtils.CommandCreationPacketReceived) Delegate.Combine(this.dataProcessingCallbacks.CommandCreationPacketReceived, new OutOfProcessUtils.CommandCreationPacketReceived(this.OnCommandCreationPacketReceived)); this.dataProcessingCallbacks.CommandCreationAckReceived = (OutOfProcessUtils.CommandCreationAckReceived) Delegate.Combine(this.dataProcessingCallbacks.CommandCreationAckReceived, new OutOfProcessUtils.CommandCreationAckReceived(this.OnCommandCreationAckReceived)); this.dataProcessingCallbacks.SignalPacketReceived = (OutOfProcessUtils.SignalPacketReceived) Delegate.Combine(this.dataProcessingCallbacks.SignalPacketReceived, new OutOfProcessUtils.SignalPacketReceived(this.OnSignalPacketReceived)); this.dataProcessingCallbacks.SignalAckPacketReceived = (OutOfProcessUtils.SignalAckPacketReceived) Delegate.Combine(this.dataProcessingCallbacks.SignalAckPacketReceived, new OutOfProcessUtils.SignalAckPacketReceived(this.OnSiganlAckPacketReceived)); this.dataProcessingCallbacks.ClosePacketReceived = (OutOfProcessUtils.ClosePacketReceived) Delegate.Combine(this.dataProcessingCallbacks.ClosePacketReceived, new OutOfProcessUtils.ClosePacketReceived(this.OnClosePacketReceived)); this.dataProcessingCallbacks.CloseAckPacketReceived = (OutOfProcessUtils.CloseAckPacketReceived) Delegate.Combine(this.dataProcessingCallbacks.CloseAckPacketReceived, new OutOfProcessUtils.CloseAckPacketReceived(this.OnCloseAckReceived)); base.dataToBeSent.Fragmentor = base.Fragmentor; base.ReceivedDataCollection.MaximumReceivedDataSize = null; base.ReceivedDataCollection.MaximumReceivedObjectSize = 0xa00000; this.closeTimeOutTimer = new Timer(60000.0); this.closeTimeOutTimer.Elapsed += new ElapsedEventHandler(this.OnCloseTimeOutTimerElapsed); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
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"); } }
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"); } }
public ActivityInvoker() { this._syncObject = new object(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
public PSWorkflowFileInstanceStore(PSWorkflowConfigurationProvider configuration, PSWorkflowInstance instance) : base(instance) { this.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); this.Streams = "Str"; this.Error = "Err"; this.Metadatas = "Meta"; this.Definition = "Def"; this.WorkflowState = "Stat"; this.Version_xml = "V.xml"; this.InputStream_xml = "IS.xml"; this.OutputStream_xml = "OS.xml"; this.ErrorStream_xml = "ES.xml"; this.WarningStream_xml = "WS.xml"; this.VerboseStream_xml = "VS.xml"; this.ProgressStream_xml = "PS.xml"; this.DebugStream_xml = "DS.xml"; this.ErrorException_xml = "EE.xml"; this.Input_xml = "I.xml"; this.PSWorkflowCommonParameters_xml = "UI.xml"; this.JobMetadata_xml = "JM.xml"; this.PrivateMetadata_xml = "PM.xml"; this.Timer_xml = "TI.xml"; this.WorkflowInstanceState_xml = "WS.xml"; this.WorkflowDefinition_xaml = "WD.xaml"; this.RuntimeAssembly_dll = "RA.dll"; this.State_xml = "S.xml"; this._syncLock = new object(); if (configuration != null) { if (PSWorkflowFileInstanceStore.TestMode) { Interlocked.Increment(ref PSWorkflowFileInstanceStore.ObjectCounter); } this._configuration = configuration; this.firstTimeStoringDefinition = true; this.SavedComponentLengths = new Dictionary<InternalStoreComponents, long>(); bool flag = true; this._disablePersistenceLimits = true; if (PSSessionConfigurationData.IsServerManager) { flag = false; this._disablePersistenceLimits = false; } this._version = new PersistenceVersion(this._configuration.PersistWithEncryption, flag); Guid id = base.PSWorkflowInstance.Id; this._version.load(Path.Combine(this._configuration.InstanceStorePath, id.ToString(), this.Version_xml)); return; } else { throw new ArgumentNullException("configuration"); } }
public ContainerParentJob(string command, string name, Guid instanceId) : base(command, name, instanceId) { this._moreData = true; this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._executionError = new PSDataCollection<ErrorRecord>(); }
static WorkflowRuntimeCompilation() { WorkflowRuntimeCompilation.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); WorkflowRuntimeCompilation._syncObject = new object(); }
protected Job2(string command, string name, JobIdentifier token) : base(command, name, token) { this._syncobject = new object(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
protected Job2(string command, string name, Guid instanceId) : base(command, name, instanceId) { this._syncobject = new object(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
protected Job2(string command, string name, IList<Job> childJobs) : base(command, name, childJobs) { this._syncobject = new object(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
protected Job2(string command) : base(command) { this._syncobject = new object(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
protected Job2() { this._syncobject = new object(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
public PSActivityContext() { this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this.UserVariables = new Dictionary<string, object>(); this.exceptions = new List<Exception>(); this.errors = new PSDataCollection<ErrorRecord>(); this.AsyncResults = new ConcurrentQueue<IAsyncResult>(); this.SyncRoot = new object(); }
static PSWorkflowJobManager() { PSWorkflowJobManager.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); PSWorkflowJobManager.StructuredTracer = new Tracer(); PSWorkflowJobManager.PerfCountersMgr = PSPerfCountersMgr.Instance; PSWorkflowJobManager._lastGcTime = new DateTime(0x7db, 1, 1); PSWorkflowJobManager._gcStatus = 0; PSWorkflowJobManager.etwTracer = new Tracer(); PSWorkflowJobManager.TestMode = false; PSWorkflowJobManager.ObjectCounter = (long)0; PSWorkflowJobManager.CurrentProcessId = Process.GetCurrentProcess().Id; }
internal PSWorkflowJob(PSWorkflowRuntime runtime, string command, string name, Guid instanceId) : base(command, name, instanceId) { this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._syncObject = new object(); this._resumeErrorSyncObject = new object(); this._statusMessage = string.Empty; this._location = string.Empty; this._resumeErrors = new Dictionary<Guid, Exception>(); this._workflowParameters = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); this._psWorkflowCommonParameters = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); this._jobMetadata = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); this._privateMetadata = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); this.IsSuspendable = null; this.listOfLabels = new List<string>(); this._runtime = runtime; this.CommonInit(); }
internal OutOfProcessClientSessionTransportManagerBase( Guid runspaceId, PSRemotingCryptoHelper cryptoHelper) : base(runspaceId, cryptoHelper) { _onDataAvailableToSendCallback = new PrioritySendDataCollection.OnDataAvailableCallback(OnDataAvailableCallback); _cmdTransportManagers = new Dictionary<Guid, OutOfProcessClientCommandTransportManager>(); _dataProcessingCallbacks = new OutOfProcessUtils.DataProcessingDelegates(); _dataProcessingCallbacks.DataPacketReceived += new OutOfProcessUtils.DataPacketReceived(OnDataPacketReceived); _dataProcessingCallbacks.DataAckPacketReceived += new OutOfProcessUtils.DataAckPacketReceived(OnDataAckPacketReceived); _dataProcessingCallbacks.CommandCreationPacketReceived += new OutOfProcessUtils.CommandCreationPacketReceived(OnCommandCreationPacketReceived); _dataProcessingCallbacks.CommandCreationAckReceived += new OutOfProcessUtils.CommandCreationAckReceived(OnCommandCreationAckReceived); _dataProcessingCallbacks.SignalPacketReceived += new OutOfProcessUtils.SignalPacketReceived(OnSignalPacketReceived); _dataProcessingCallbacks.SignalAckPacketReceived += new OutOfProcessUtils.SignalAckPacketReceived(OnSiganlAckPacketReceived); _dataProcessingCallbacks.ClosePacketReceived += new OutOfProcessUtils.ClosePacketReceived(OnClosePacketReceived); _dataProcessingCallbacks.CloseAckPacketReceived += new OutOfProcessUtils.CloseAckPacketReceived(OnCloseAckReceived); dataToBeSent.Fragmentor = base.Fragmentor; // session transport manager can receive unlimited data..however each object is limited // by maxRecvdObjectSize. this is to allow clients to use a session for an unlimited time.. // also the messages that can be sent to a session are limited and very controlled. // However a command transport manager can be restricted to receive only a fixed amount of data // controlled by maxRecvdDataSizeCommand..This is because commands can accept any number of input // objects. ReceivedDataCollection.MaximumReceivedDataSize = null; ReceivedDataCollection.MaximumReceivedObjectSize = BaseTransportManager.MaximumReceivedObjectSize; // timers initialization _closeTimeOutTimer = new Timer(OnCloseTimeOutTimerElapsed, null, Timeout.Infinite, Timeout.Infinite); _tracer = PowerShellTraceSourceFactory.GetTraceSource(); }
internal ActivityHostProcess(int activityHostTimeoutSec, PSLanguageMode? languageMode) { object obj; this._syncObject = new object(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._languageMode = languageMode; this._useJobIPCProcess = true; this._tracer.WriteMessage("BEGIN Creating new PowerShell process instance"); this._processInstance = new PowerShellProcessInstance(); this._tracer.WriteMessage("END Creating new PowerShell process instance "); this._runspace = this.CreateRunspace(); Guid instanceId = this._runspace.InstanceId; this._tracer.WriteMessage("New runspace created ", instanceId.ToString()); Timer timer = new Timer(); timer.AutoReset = false; timer.Interval = 300000; this._timer = timer; this._timer.Elapsed += new ElapsedEventHandler(this.TimerElapsed); Timer timer1 = this._timer; if (activityHostTimeoutSec > 0) { obj = activityHostTimeoutSec * 0x3e8; } else { obj = 0x493e0; } timer1.Interval = (double)obj; ActivityHostProcess._perfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 21, (long)1, true); }
static ImportWorkflowCommand() { ImportWorkflowCommand.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); ImportWorkflowCommand._structuredTracer = new Tracer(); ImportWorkflowCommand.FunctionCache = new ConcurrentDictionary<string, ImportWorkflowCommand.FunctionDetails>(StringComparer.OrdinalIgnoreCase); ImportWorkflowCommand.compiledAssemblyCache = new ConcurrentDictionary<string, WorkflowRuntimeCompilation>(); }
internal Connection(ConnectionManager manager) { this._syncObject = new object(); this._instanceId = Guid.NewGuid(); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this._structuredTracer = new Tracer(); this._retryInterval = 1; this._manager = manager; this._tracer.WriteMessage("PSW Conn: Creating new connection"); }
static InstanceStoreCryptography() { InstanceStoreCryptography.Tracer = PowerShellTraceSourceFactory.GetTraceSource(); byte[] numArray = new byte[] { 80, 79, 87, 69, 82, 83, 72, 69, 76, 76, 87, 79, 82, 75, 70, 76, 79, 87 }; InstanceStoreCryptography.s_aditionalEntropy = numArray; }
protected PSActivity() { this.psActivityContextImplementationVariable = new Variable<PSActivityContext>("psActivityContextImplementationVariable"); this._tracer = PowerShellTraceSourceFactory.GetTraceSource(); this.noPersistHandle = new Variable<NoPersistHandle>("NoPersistHandle"); this.bookmarking = new Variable<bool>("Bookmarking"); TerminateWorkflow terminateWorkflow = new TerminateWorkflow(); terminateWorkflow.Reason = Resources.RunningTimeExceeded; this.terminateActivity = terminateWorkflow; //base(); Delay delay = new Delay(); ParameterExpression parameterExpression = Expression.Parameter(typeof(ActivityContext), "context"); Expression[] expressionArray = new Expression[3]; expressionArray[0] = Expression.Constant(0, typeof(int)); expressionArray[1] = Expression.Constant(0, typeof(int)); Expression[] expressionArray1 = new Expression[1]; expressionArray1[0] = Expression.Property(Expression.Constant(this, typeof(PSActivity)), (MethodInfo)MethodBase.GetMethodFromHandle(get_PSActionRunningTimeoutSec)); expressionArray[2] = Expression.Convert(Expression.Call(parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(GetValue<int?>), expressionArray1), typeof(int)); ParameterExpression[] parameterExpressionArray = new ParameterExpression[1]; parameterExpressionArray[0] = parameterExpression; //TODO: REVIEW: (ConstructorInfo)MethodBase.GetMethodFromHandle delay.Duration = new InArgument<TimeSpan>(Expression.Lambda<Func<ActivityContext, TimeSpan>>(Expression.New(typeof(TimeSpan).GetConstructor(new System.Type[] { typeof(int), typeof(int), typeof(int) }), expressionArray), parameterExpressionArray)); this.cancelTimer = delay; }