mirror of https://bitbucket.org/anguist/ntpa
Fix spelling mistakes
This commit is contained in:
parent
893648bbe8
commit
0376c0a7cd
|
@ -66,7 +66,7 @@ protected string FetchHtml(string url, int orgId)
|
|||
if (html != null)
|
||||
return html;
|
||||
|
||||
Log.TimeServerNotRecieved(orgId);
|
||||
Log.TimeServerNotReceived(orgId);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ internal static void TimeServerNotFound(this LogBase log, string provider, int o
|
|||
log.WriteLine($"Time server not found at {provider}. ID: {orgId}", Severity.Info);
|
||||
}
|
||||
|
||||
internal static void TimeServerNotRecieved(this LogBase log, int orgId)
|
||||
internal static void TimeServerNotReceived(this LogBase log, int orgId)
|
||||
{
|
||||
log.WriteLine($"Nothing received for time server ID {orgId}.", Severity.Debug);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ public override IPAddress Address
|
|||
public int Successes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// How many times we have failed to contact thsi server.
|
||||
/// How many times we have failed to contact this server.
|
||||
/// </summary>
|
||||
[JsonProperty("failures")]
|
||||
public int Failures { get; set; }
|
||||
|
|
|
@ -64,7 +64,7 @@ protected override void InternalExecute()
|
|||
{
|
||||
try
|
||||
{
|
||||
Initalize();
|
||||
Initialize();
|
||||
Import();
|
||||
SaveResult();
|
||||
}
|
||||
|
@ -141,11 +141,11 @@ private void Import()
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initalize database context.
|
||||
/// Initialize database context.
|
||||
/// </summary>
|
||||
private void Initalize()
|
||||
private void Initialize()
|
||||
{
|
||||
// Clear any previouse readings
|
||||
// Clear any previous readings
|
||||
entries.Clear();
|
||||
readings.Clear();
|
||||
activities.Clear();
|
||||
|
|
|
@ -56,7 +56,7 @@ public sealed class Initializer
|
|||
/// <param name="pid">Process ID.</param>
|
||||
/// <param name="pidFile">Where to write Process ID file.</param>
|
||||
/// <param name="name">Name of process ID. Used when shutting down.</param>
|
||||
/// <param name="initlog">Log used during intitialization.</param>
|
||||
/// <param name="initlog">Log used during initialization.</param>
|
||||
public Initializer(string configFile, int pid, string pidFile, string name, LogGroup initlog)
|
||||
{
|
||||
this.configFile = configFile;
|
||||
|
@ -109,7 +109,7 @@ public void Run()
|
|||
if (proceed)
|
||||
{
|
||||
InitializeApplication();
|
||||
InitializeListerners();
|
||||
InitializeListeners();
|
||||
InitializeCluster();
|
||||
InitializeScheduler();
|
||||
proceed = InitializeDatabase();
|
||||
|
@ -337,9 +337,9 @@ private bool InitializeDatabase()
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the listerners.
|
||||
/// Initializes the listeners.
|
||||
/// </summary>
|
||||
private void InitializeListerners()
|
||||
private void InitializeListeners()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ public sealed class LogConfiguration : ConfigurationNode, ILogConfiguration
|
|||
internal LogConfiguration(
|
||||
string name,
|
||||
LogType? logType,
|
||||
Severity? treshold,
|
||||
Severity? threshold,
|
||||
bool? showTimestamp,
|
||||
bool? showSeverity,
|
||||
string timeFormat,
|
||||
|
@ -38,7 +38,7 @@ string file
|
|||
) : base(name)
|
||||
{
|
||||
this.logType = logType;
|
||||
this.treshold = treshold;
|
||||
this.threshold = threshold;
|
||||
this.showTimestamp = showTimestamp;
|
||||
this.showSeverity = showSeverity;
|
||||
this.timeFormat = timeFormat;
|
||||
|
@ -49,7 +49,7 @@ string file
|
|||
private readonly bool? showSeverity;
|
||||
private readonly bool? showTimestamp;
|
||||
private readonly string timeFormat;
|
||||
private readonly Severity? treshold;
|
||||
private readonly Severity? threshold;
|
||||
|
||||
[NtpaIndex(1)]
|
||||
[NtpaSetting(Symbol.KeywordFile)]
|
||||
|
@ -57,7 +57,7 @@ string file
|
|||
|
||||
[NtpaIndex(21)]
|
||||
[NtpaSetting(Symbol.KeywordSeverity, Severity.Info)]
|
||||
public Severity Treshold => treshold ?? Severity.Info;
|
||||
public Severity Threshold => threshold ?? Severity.Info;
|
||||
|
||||
[NtpaIndex(1)]
|
||||
[NtpaSetting(Symbol.KeywordType, LogType.File)]
|
||||
|
|
|
@ -111,11 +111,11 @@ protected override void ValidateReferences(SymbolTable table)
|
|||
else if (owner == Symbol.KeywordHostPage &&
|
||||
!(reference is HostGraphSyntaxNode || reference is TrafficGraphSyntaxNode))
|
||||
{
|
||||
AddRefrenceTypeError(graph, keyword, keyword, graph.Value);
|
||||
AddReferenceTypeError(graph, keyword, keyword, graph.Value);
|
||||
}
|
||||
else if (owner == Symbol.KeywordPeerPage && !(reference is PeerGraphSyntaxNode))
|
||||
{
|
||||
AddRefrenceTypeError(graph, keyword, peerGraphWord, graph.Value);
|
||||
AddReferenceTypeError(graph, keyword, peerGraphWord, graph.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ protected override void ValidateReferences(SymbolTable table)
|
|||
else if (!(reference is HostPageSyntaxNode))
|
||||
{
|
||||
string hostPageKeyword = Keyword.Find(Symbol.KeywordHostPage).Name;
|
||||
AddRefrenceTypeError(pageName, keyword, hostPageKeyword, pageName.Value);
|
||||
AddReferenceTypeError(pageName, keyword, hostPageKeyword, pageName.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ protected override void ValidateReferences(SymbolTable table)
|
|||
if (reference == null)
|
||||
AddReferenceNameError(pageName, keyword, pageName.Value);
|
||||
else if (!(reference is PeerPageSyntaxNode))
|
||||
AddRefrenceTypeError(pageName, keyword, keyword, pageName.Value);
|
||||
AddReferenceTypeError(pageName, keyword, keyword, pageName.Value);
|
||||
}
|
||||
|
||||
var link = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordLink) as StringSettingNode;
|
||||
|
|
|
@ -39,7 +39,7 @@ public LogSyntaxNode(string name, int line)
|
|||
protected override LogConfiguration InternalCompile()
|
||||
{
|
||||
var logType = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordType) as LogTypeNode;
|
||||
var treshold = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordSeverity) as SeverityNode;
|
||||
var threshold = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordSeverity) as SeverityNode;
|
||||
var showTime = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordShowTimestamp) as BooleanSettingNode;
|
||||
var showSeverity = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordShowSeverity) as BooleanSettingNode;
|
||||
var timeFormat = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordTimeFormat) as StringSettingNode;
|
||||
|
@ -48,7 +48,7 @@ protected override LogConfiguration InternalCompile()
|
|||
return new LogConfiguration(
|
||||
Name,
|
||||
logType?.LogType,
|
||||
treshold?.Severity,
|
||||
threshold?.Severity,
|
||||
showTime?.Value,
|
||||
showSeverity?.Value,
|
||||
timeFormat?.Value,
|
||||
|
|
|
@ -100,7 +100,7 @@ protected override void ValidateReferences(SymbolTable table)
|
|||
else if (!(reference is PeerPageSyntaxNode))
|
||||
{
|
||||
string peerPageKeyword = Keyword.Find(Symbol.KeywordPeerPage).Name;
|
||||
AddRefrenceTypeError(pageName, keyword, peerPageKeyword, pageName.Value);
|
||||
AddReferenceTypeError(pageName, keyword, peerPageKeyword, pageName.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ protected override void ValidateReferences(SymbolTable table)
|
|||
}
|
||||
else if (!(reference is PeerPageSyntaxNode))
|
||||
{
|
||||
AddRefrenceTypeError(pageName, keyword, keyword, pageName.Value);
|
||||
AddReferenceTypeError(pageName, keyword, keyword, pageName.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ protected override void ValidateReferences(SymbolTable table)
|
|||
}
|
||||
else if (!(reference is ReadingSyntaxNode))
|
||||
{
|
||||
AddRefrenceTypeError(freqName, keyword, name, freqName.Value);
|
||||
AddReferenceTypeError(freqName, keyword, name, freqName.Value);
|
||||
}
|
||||
|
||||
if (Symbol == Symbol.KeywordDriftStats || Nodes.Count(n => n.Symbol == Symbol.KeywordFile) == 0)
|
||||
|
|
|
@ -73,7 +73,7 @@ protected override void ValidateReferences(SymbolTable table)
|
|||
}
|
||||
else if (!(reference is PeerSummaryPageSyntaxNode))
|
||||
{
|
||||
AddRefrenceTypeError(page, keyword, pageKeyword, page.Value);
|
||||
AddReferenceTypeError(page, keyword, pageKeyword, page.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ protected virtual void ValidateReferences(SymbolTable table)
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// OVerride to resolve references to other syntax nodes from this syntax node.
|
||||
/// Override to resolve references to other syntax nodes from this syntax node.
|
||||
/// </summary>
|
||||
/// <remarks>When overriding this method do not call the base method.</remarks>
|
||||
/// <param name="table">Table.</param>
|
||||
|
@ -396,7 +396,7 @@ protected Uri CheckLink(string link, string keyword)
|
|||
if ((text.StartsWith("http://") ||
|
||||
text.StartsWith("https://") ||
|
||||
text.StartsWith("ftp://") ||
|
||||
text.StartsWith("maito:") ||
|
||||
text.StartsWith("mailto:") ||
|
||||
text.StartsWith("javascript:")) &&
|
||||
Uri.TryCreate(link, UriKind.Absolute, out uri))
|
||||
return uri;
|
||||
|
@ -438,7 +438,7 @@ protected void AddReferenceNameError(ISyntaxNode node, string keyword, string na
|
|||
AddError(b.ToString());
|
||||
}
|
||||
|
||||
protected void AddRefrenceTypeError(ISyntaxNode node, string keyword, string section, string name)
|
||||
protected void AddReferenceTypeError(ISyntaxNode node, string keyword, string section, string name)
|
||||
{
|
||||
var b = new StringBuilder();
|
||||
if (node.Line != 0)
|
||||
|
|
|
@ -54,12 +54,12 @@ protected static void ApplyPermissions(string file, LogBase log)
|
|||
{
|
||||
if (!Permission.ChangeFileMode(file, FileMask))
|
||||
{
|
||||
log.DestinationPermissonError(file);
|
||||
log.DestinationPermissionError(file);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.DestinationPermissonError(file, e);
|
||||
log.DestinationPermissionError(file, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ internal static void DestinationPathError(this LogBase log, string file, Excepti
|
|||
}
|
||||
}
|
||||
|
||||
internal static void DestinationPermissonError(this LogBase log, string file, Exception e = null)
|
||||
internal static void DestinationPermissionError(this LogBase log, string file, Exception e = null)
|
||||
{
|
||||
log.WriteLine(
|
||||
$"Could not change permission on file {file}",
|
||||
|
|
|
@ -26,13 +26,13 @@ namespace Ntp.Common.Log
|
|||
{
|
||||
public sealed class ConsoleLog : TextLog
|
||||
{
|
||||
internal ConsoleLog(Severity treshold, string timeFormat)
|
||||
: base(treshold, timeFormat)
|
||||
internal ConsoleLog(Severity threshold, string timeFormat)
|
||||
: base(threshold, timeFormat)
|
||||
{
|
||||
}
|
||||
|
||||
internal ConsoleLog(Severity treshold)
|
||||
: base(treshold, null)
|
||||
internal ConsoleLog(Severity threshold)
|
||||
: base(threshold, null)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace Ntp.Common.Log
|
|||
{
|
||||
public sealed class EventLog : LogBase
|
||||
{
|
||||
public EventLog(string name, Severity treshold)
|
||||
: base(treshold, true)
|
||||
public EventLog(string name, Severity threshold)
|
||||
: base(threshold, true)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public override void WriteLine(string text, Severity severity)
|
|||
if (!initialized)
|
||||
Initialize();
|
||||
|
||||
if (severity < Treshold)
|
||||
if (severity < Threshold)
|
||||
return;
|
||||
|
||||
WriteEventLogEntry(text, GetEventLogEntryType(severity), 0);
|
||||
|
@ -76,13 +76,13 @@ public override void WriteLine(Exception exception, Severity severity)
|
|||
if (!initialized)
|
||||
Initialize();
|
||||
|
||||
if (severity < Treshold)
|
||||
if (severity < Threshold)
|
||||
return;
|
||||
|
||||
if (!initialized)
|
||||
Initialize();
|
||||
|
||||
if (severity < Treshold)
|
||||
if (severity < Threshold)
|
||||
return;
|
||||
|
||||
WriteEventLogEntry(exception.ToString(), GetEventLogEntryType(severity), 0);
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace Ntp.Common.Log
|
|||
{
|
||||
public sealed class FileLog : TextLog, IDisposable
|
||||
{
|
||||
internal FileLog(string file, Severity treshold, string timeFormat)
|
||||
: base(treshold, timeFormat)
|
||||
internal FileLog(string file, Severity threshold, string timeFormat)
|
||||
: base(threshold, timeFormat)
|
||||
{
|
||||
this.file = file;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Ntp.Common.Log
|
|||
public interface ILogConfiguration
|
||||
{
|
||||
string File { get; }
|
||||
Severity Treshold { get; }
|
||||
Severity Threshold { get; }
|
||||
LogType LogType { get; }
|
||||
bool ShowTimestamp { get; }
|
||||
bool ShowSeverity { get; }
|
||||
|
|
|
@ -25,13 +25,13 @@ namespace Ntp.Common.Log
|
|||
{
|
||||
public abstract class LogBase
|
||||
{
|
||||
protected LogBase(Severity treshold, bool isSysLog = false)
|
||||
protected LogBase(Severity threshold, bool isSysLog = false)
|
||||
{
|
||||
Treshold = treshold;
|
||||
Threshold = threshold;
|
||||
IsSysLog = isSysLog;
|
||||
}
|
||||
|
||||
public Severity Treshold { get; }
|
||||
public Severity Threshold { get; }
|
||||
|
||||
public bool IsSysLog { get; }
|
||||
|
||||
|
|
|
@ -111,17 +111,17 @@ private static LogBase CreateLogInternal(ILogConfiguration config)
|
|||
{
|
||||
case LogType.Unknown:
|
||||
case LogType.Console:
|
||||
return new ConsoleLog(config.Treshold, config.TimeFormat)
|
||||
return new ConsoleLog(config.Threshold, config.TimeFormat)
|
||||
{
|
||||
ShowSeverity = config.ShowSeverity,
|
||||
ShowTimeStamp = config.ShowTimestamp
|
||||
};
|
||||
case LogType.Syslog:
|
||||
return new SysLog(ApplicationName, config.Treshold);
|
||||
return new SysLog(ApplicationName, config.Threshold);
|
||||
case LogType.EventLog:
|
||||
return new EventLog(ApplicationName, config.Treshold);
|
||||
return new EventLog(ApplicationName, config.Threshold);
|
||||
case LogType.File:
|
||||
return new FileLog(config.File, config.Treshold, config.TimeFormat)
|
||||
return new FileLog(config.File, config.Threshold, config.TimeFormat)
|
||||
{
|
||||
ShowSeverity = config.ShowSeverity,
|
||||
ShowTimeStamp = config.ShowTimestamp
|
||||
|
|
|
@ -42,7 +42,7 @@ private LogBase SysLog
|
|||
{
|
||||
return logs.
|
||||
Where(l => l.IsSysLog).
|
||||
OrderBy(l => l.Treshold).
|
||||
OrderBy(l => l.Threshold).
|
||||
FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ private LogBase ConsoleLog
|
|||
{
|
||||
return logs.
|
||||
Where(l => l is ConsoleLog).
|
||||
OrderBy(l => l.Treshold).
|
||||
OrderBy(l => l.Threshold).
|
||||
FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace Ntp.Common.Log
|
|||
{
|
||||
public sealed class SysLog : LogBase
|
||||
{
|
||||
public SysLog(string name, Severity treshold)
|
||||
: base(treshold, true)
|
||||
public SysLog(string name, Severity threshold)
|
||||
: base(threshold, true)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public override void WriteLine(string text, Severity severity)
|
|||
if (initialized)
|
||||
Initialize();
|
||||
|
||||
if (severity < Treshold)
|
||||
if (severity < Threshold)
|
||||
return;
|
||||
|
||||
Syscall.syslog(Facility, GetSyslogLevel(severity), text);
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace Ntp.Common.Log
|
|||
{
|
||||
public abstract class TextLog : LogBase
|
||||
{
|
||||
protected TextLog(Severity treshold, string timeFormat)
|
||||
: base(treshold)
|
||||
protected TextLog(Severity threshold, string timeFormat)
|
||||
: base(threshold)
|
||||
{
|
||||
this.timeFormat = timeFormat;
|
||||
Initialized = false;
|
||||
|
@ -104,7 +104,7 @@ public override void WriteLine(string text, Severity severity)
|
|||
}
|
||||
}
|
||||
|
||||
if (severity < Treshold)
|
||||
if (severity < Threshold)
|
||||
return;
|
||||
|
||||
string severityText = string.Empty;
|
||||
|
@ -173,7 +173,7 @@ public override void WriteLine(Exception exception)
|
|||
|
||||
public override void WriteLine(Exception exception, Severity severity)
|
||||
{
|
||||
if (severity < Treshold)
|
||||
if (severity < Threshold)
|
||||
return;
|
||||
|
||||
WriteLine(exception.Message, severity);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
namespace Ntp.Common.Process
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for jobs following the GoF Command Pattern.½
|
||||
/// Base class for jobs following the GoF Command Pattern.
|
||||
/// </summary>
|
||||
public abstract class JobDescription
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ public abstract class JobDescription
|
|||
/// Initializes a new instance of the <see cref="JobDescription" /> class.
|
||||
/// </summary>
|
||||
/// <param name="config">Configuration for the job.</param>
|
||||
/// <param name="log">Log to use when registrering events.</param>
|
||||
/// <param name="log">Log to use when registering events.</param>
|
||||
protected JobDescription(IJobConfiguration config, LogBase log)
|
||||
{
|
||||
Configuration = config;
|
||||
|
@ -70,7 +70,7 @@ protected JobDescription(IJobConfiguration config, LogBase log)
|
|||
public IJobConfiguration Configuration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the log to use when registrering events.
|
||||
/// Gets the log to use when registering events.
|
||||
/// </summary>
|
||||
/// <value>The log.</value>
|
||||
protected LogBase Log { get; }
|
||||
|
@ -85,7 +85,7 @@ public override string ToString()
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementing method for descendents.
|
||||
/// Implementing method for descendants.
|
||||
/// </summary>
|
||||
protected abstract void InternalExecute();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public JobScheduleDescription(bool initialRun, bool fixedRun, int frequency)
|
|||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this <see cref="JobScheduleDescription" /> has
|
||||
/// a fixed schedule frequence, eg. cannot be moved.
|
||||
/// a fixed schedule frequency, eg. cannot be moved.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if fixed run; otherwise, <c>false</c>.</value>
|
||||
public bool FixedRun { get; }
|
||||
|
@ -83,10 +83,10 @@ public DateTime CalculateNextRun(DateTime start)
|
|||
return start;
|
||||
|
||||
int multiplier = Convert.ToInt32(Math.Truncate((double) (start.Hour*60 + start.Minute)/Frequency));
|
||||
int startMinuttes = multiplier*Frequency;
|
||||
int startMinutes = multiplier*Frequency;
|
||||
|
||||
int hour = (startMinuttes + Frequency)/60;
|
||||
int minute = (startMinuttes + Frequency)%60;
|
||||
int hour = (startMinutes + Frequency)/60;
|
||||
int minute = (startMinutes + Frequency)%60;
|
||||
|
||||
if (hour >= 24)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue