|
using System;
using JetBrains.Annotations;
using Kaleida.ServiceMonitor.Model.Runtime;
namespace Kaleida.ServiceMonitor.Model.ScriptDirectives
{
public class OrderDirective : IScriptDirective
{
private readonly string executionOrder;
public OrderDirective([NotNull] string executionOrder)
{
if (executionOrder == null) throw new ArgumentNullException("executionOrder");
var orderType = executionOrder.ToLowerInvariant();
if (orderType != "round-robin" && orderType != "random")
throw new ArgumentOutOfRangeException("executionOrder", executionOrder, "Expected value to be \"round-robin\" or \"random\"");
this.executionOrder = orderType;
}
public void Apply([NotNull] CompiledScript script)
{
if (script == null) throw new ArgumentNullException("script");
script.ExecutionOrder = executionOrder == "round-robin" ? OperationOrder.RoundRobin : OperationOrder.Random;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Stuart Wheelwright is the Principal Architect and Software Developer at
BlackJet Software Ltd.
He has over 16 years commercial experience producing robust, maintainable, web-based solutions and bespoke systems for Microsoft platforms.
His latest project is
Shopping UK, an elegantly simple shopping list for iPhone.