NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Process.Description.HostStatJob Class Reference

Job which read statistics about an ntp host and saves the result to a database. More...

Inheritance diagram for Ntp.Analyzer.Process.Description.HostStatJob:
Collaboration diagram for Ntp.Analyzer.Process.Description.HostStatJob:

Public Member Functions

 HostStatJob (StatConfiguration config, LogBase log)
 
- Public Member Functions inherited from Ntp.Common.Process.JobDescription
override string ToString ()
 Returns a string that represents the current JobDescription. More...
 

Public Attributes

override string JobType => "Host statistics"
 
override int Priority => 2
 
override ThreadType ThreadType => ThreadType.MultiThreaded
 
- Public Attributes inherited from Ntp.Common.Process.JobDescription
string Name => Configuration.ConfigName
 Gets the name. More...
 

Protected Member Functions

override void InternalExecute ()
 Implementing method for descendants. More...
 
- Protected Member Functions inherited from Ntp.Common.Process.JobDescription
 JobDescription (IJobConfiguration config, LogBase log)
 Initializes a new instance of the JobDescription class. More...
 

Private Attributes

readonly StatConfiguration config
 

Additional Inherited Members

- Package Functions inherited from Ntp.Common.Process.JobDescription
void Execute ()
 Perform execution of this instance. More...
 
- Properties inherited from Ntp.Common.Process.JobDescription
IJobConfiguration Configuration [get]
 Gets the configuration for the job. More...
 
abstract string JobType [get]
 Gets the type of the job as text. More...
 
LogBase Log [get]
 Gets the log to use when registering events. More...
 
abstract int Priority [get]
 Gets the priority to use when scheduling jobs. More...
 
abstract ThreadType ThreadType [get]
 Gets a value indicating whether this JobDescription should run as a single thread. More...
 

Detailed Description

Job which read statistics about an ntp host and saves the result to a database.

Definition at line 37 of file HostStatJob.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Process.Description.HostStatJob.HostStatJob ( StatConfiguration  config,
LogBase  log 
)
inline

Definition at line 39 of file HostStatJob.cs.

40  : base(config, log)
41  {
42  this.config = config;
43  }

Member Function Documentation

override void Ntp.Analyzer.Process.Description.HostStatJob.InternalExecute ( )
inlineprotectedvirtual

Implementing method for descendants.

Implements Ntp.Common.Process.JobDescription.

Definition at line 53 of file HostStatJob.cs.

References b, Ntp.Analyzer.Import.ImportFactory.CreateHostImporter(), e, Ntp.Analyzer.Import.Importer< T >.Execute(), Ntp.Analyzer.Data.DataFace.HostReadings, Ntp.Analyzer.Data.DataFace.Hosts, Ntp.Analyzer.Data.DataFace.Instance, and Ntp.Analyzer.Data.DataFace.ReadingBulks.

54  {
55  var host = DataFace.Instance.Hosts.SingleOrDefault(h => h.Id == config.HostId);
56  if (host == null)
57  {
58  Log.HostNotFound(config.HostId);
59  return;
60  }
61 
62  var bulk = config.Bulk == null
63  ? new ReadingBulk(host.Name, config.TimeStamp)
64  : DataFace.Instance.ReadingBulks.Single(b => b.Name == config.Bulk.Name);
65 
67 
68  try
69  {
70  importer.Execute();
71  }
72  catch (Exception e)
73  {
74  Log.HostImportError(e);
75  return;
76  }
77 
78  foreach (var reading in importer)
79  {
80  DataFace.Instance.HostReadings.Save(reading);
81  }
82  }
static Importer< HostReading > CreateHostImporter(string address, ServerType type, Host host, ReadingBulk bulk, LogBase log)
string ServerName
Gets the name of the server in the HostSubConfiguration.
HostDatabaseMapper Hosts
Gets the host mapper.
Definition: DataFace.cs:57
HostReadingDatabaseMapper HostReadings
Gets the host reading mapper.
Definition: DataFace.cs:75
LogBase Log
Gets the log to use when registering events.
int HostId
Gets the host identifier in the HostSubConfiguration.
var e
Definition: bootstrap.min.js:6
Singleton facade class used to access memory persistent data.
Definition: DataFace.cs:30
static DataFace Instance
Gets the Singleton instance.
Definition: DataFace.cs:51
ServerType ServerType
Gets the type of the server in the HostSubConfiguration.
var b
Definition: bootstrap.min.js:6

Here is the call graph for this function:

Member Data Documentation

readonly StatConfiguration Ntp.Analyzer.Process.Description.HostStatJob.config
private

Definition at line 45 of file HostStatJob.cs.

override string Ntp.Analyzer.Process.Description.HostStatJob.JobType => "Host statistics"

Definition at line 49 of file HostStatJob.cs.

override int Ntp.Analyzer.Process.Description.HostStatJob.Priority => 2

Definition at line 51 of file HostStatJob.cs.

override ThreadType Ntp.Analyzer.Process.Description.HostStatJob.ThreadType => ThreadType.MultiThreaded

Definition at line 47 of file HostStatJob.cs.


The documentation for this class was generated from the following file: