/// <summary>
        /// Processes the activity given to the plugin.
        /// </summary>
        /// <param name="executionData"></param>
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            _executionData = executionData;
            HpacServerConfigurationActivityData activityData = _executionData.GetMetadata <HpacServerConfigurationActivityData>();

            if (executionData.Assets.Count > 0)
            {
                activityData.DeviceData.Asset = (IDeviceInfo)executionData.Assets.FirstOrDefault();
            }

            PluginExecutionResult result = new PluginExecutionResult(PluginResult.Passed);



            try
            {
                _hpacServer = _executionData.Servers.First();
                _hostName   = _hpacServer.HostName;
                if (!_hostName.Contains(executionData.Environment.UserDnsDomain))
                {
                    _hostName += "." + executionData.Environment.UserDnsDomain;
                }
                LogUsageData(_hpacServer);
            }
            catch (ArgumentNullException ex)
            {
                return(new PluginExecutionResult(PluginResult.Error, ex));
            }
            catch (InvalidOperationException ex)
            {
                return(new PluginExecutionResult(PluginResult.Error, ex));
            }

            if (_hpacController == null)
            {
                _hpacController = new HpacServerConfigurationController(_executionData.Environment.UserDnsDomain, _hostName, _hpacServer.Address, _executionData.Credential);
            }

            UpdateUI(_hostName, activityData.HpacConfigTile.ToString());
            UpdateStatus("Starting HPAC Server Configuring  Activity...");

            var retryManager = new PluginRetryManager(executionData, UpdateStatus);

            result = retryManager.Run(() => ExecuteTask(activityData));

            return(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HpacServerConfigurationTask" /> class.
 /// </summary>
 /// <param name="controller">controller.</param>
 /// <param name="activityData">HpacServer Configuration ActivityData.</param>
 public HpacServerConfigurationTask(HpacServerConfigurationController controller, HpacServerConfigurationActivityData activityData)
     : base()
 {
     _hpacController = controller;
     _taskConfig     = activityData;
 }