/// <summary> /// Defines and executes the PluginCollectDeviceJobInfo workflow. /// </summary> /// <param name="executionData">Information used in the execution of this workflow.</param> /// <returns>The result of executing the workflow.</returns> public PluginExecutionResult Execute(PluginExecutionData executionData) { _data = executionData.GetMetadata <CollectDeviceJobInfoActivityData>(); _collectDeviceJobInfoEngine = new CollectDeviceJobInfoEngine(executionData); UpdateStatus("Starting the execution of job collection plugin..."); // iterate through each applicable asset, acquire the lock and take the memory snapshot, then proceed to next var devices = executionData.Assets.OfType <IDeviceInfo>(); Parallel.ForEach(devices, device => { UpdateStatus("Collecting Job Info on Asset ID '" + device.AssetId + "'."); try { _collectDeviceJobInfoEngine.ProcessJobCollectionByDevice(device); } catch (Exception ex) { _collectDeviceJobInfoEngine.ProblemDevices.Add(device.Address, ex.ToString()); } }); PluginExecutionResult result; if (_collectDeviceJobInfoEngine.ProblemDevices.Any()) { var msg = $"Failed to collect on {string.Join(",", _collectDeviceJobInfoEngine.ProblemDevices.ToArray())}"; ExecutionServices.SystemTrace.LogError(msg); result = new PluginExecutionResult(PluginResult.Failed, msg, "Job info collection error."); UpdateStatus(msg); } else { result = new PluginExecutionResult(PluginResult.Passed); } UpdateStatus($"Execution complete. Result = {result.Result}"); return(result); }
/// <summary> /// Initializes the configuration control with the supplied configuration settings. /// </summary> /// <param name="configuration">Pre-configured plugin settings.</param> /// <param name="environment">Domain and plugin specific environment data.</param> public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment) { // Deserialize the plugin specific configuration settings. _data = configuration.GetMetadata <CollectDeviceJobInfoActivityData>(); assetSelectionControl.Initialize(configuration.Assets, Framework.Assets.AssetAttributes.None); }
/// <summary> /// Initializes the configuration control to default values. /// </summary> /// <param name="environment">Domain and plugin specific environment data.</param> public void Initialize(PluginEnvironment environment) { _data = new CollectDeviceJobInfoActivityData(); assetSelectionControl.Initialize(Framework.Assets.AssetAttributes.None); }