NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Page.DefaultHostPageBuilder Class Reference

Build a HTML status page showing the state of a hosted NTP server. More...

Inheritance diagram for Ntp.Analyzer.Page.DefaultHostPageBuilder:
Collaboration diagram for Ntp.Analyzer.Page.DefaultHostPageBuilder:

Public Member Functions

 DefaultHostPageBuilder (HostPageConfiguration config, IEnumerable< StatusLine > lines)
 Initializes a new instance of the Ntp.Analyzer.Page.DefaultHostPageBuilder class. More...
 
override Stream Generate ()
 

Public Attributes

override IEnumerable< StreamDestinationDestinations => config.Destinations.Destinations
 

Private Attributes

readonly HostPageConfiguration config
 
readonly List< StatusLinelines
 

Additional Inherited Members

- Protected Member Functions inherited from Ntp.Analyzer.Page.PageBuilderBase
Stream ToStream (string text)
 
- Properties inherited from Ntp.Analyzer.Page.PageBuilderBase
abstract IEnumerable< StreamDestinationDestinations [get]
 
- Properties inherited from Ntp.Analyzer.Export.IStreamGenerator
IEnumerable< StreamDestinationDestinations [get]
 

Detailed Description

Build a HTML status page showing the state of a hosted NTP server.

Definition at line 37 of file DefaultHostPageBuilder.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Page.DefaultHostPageBuilder.DefaultHostPageBuilder ( HostPageConfiguration  config,
IEnumerable< StatusLine lines 
)
inline

Initializes a new instance of the Ntp.Analyzer.Page.DefaultHostPageBuilder class.

Parameters
configConfig.
linesLines.

Definition at line 44 of file DefaultHostPageBuilder.cs.

47  {
48  this.config = config;
49  this.lines = new List<StatusLine>(lines);
50  }

Member Function Documentation

override Stream Ntp.Analyzer.Page.DefaultHostPageBuilder.Generate ( )
inlinevirtual

Implements Ntp.Analyzer.Page.PageBuilderBase.

Definition at line 57 of file DefaultHostPageBuilder.cs.

References Ntp.Analyzer.Data.DataFace.Hosts, Ntp.Analyzer.Data.DataFace.Instance, and Ntp.Analyzer.Objects.Host.Ip.

58  {
59  Host host = DataFace.Instance.Hosts.Single(h => h.Id == config.HostId);
60 
61  // Create page and table
62  var hostPage = new DefaultHostPageRender(config, host.Ip, config.Frequency*60);
63 
64  var statusTable = new DefaultHostTableRender(config);
65  hostPage.Add(statusTable);
66 
67  // Create table content
68  foreach (StatusLine line in lines)
69  {
70  statusTable.Add(new HostLineRender(line, config.PeerPage));
71  }
72 
73  // Create graph links
75 
76  // Generate HTML
77  var htmlRender = new HtmlRenderer(hostPage);
78  string html = htmlRender.Render();
79 
80  return ToStream(html);
81  }
HostDatabaseMapper Hosts
Gets the host mapper.
Definition: DataFace.cs:57
int HostId
Gets the host identifier in the HostSubConfiguration.
PeerPageConfiguration PeerPage
Gets the peer pages linked to this page.
IEnumerable< GraphSetConfiguration > Graphs
Gets the graphs to be displayed on this page.
Uri WebPath
Gets the web path in the HostSubConfiguration.
Renders IHtmlObjects into plain text for display in browsers.
Definition: HtmlRenderer.cs:31
A status line for an NTP Server containing information about configuration, peer and server details...
Definition: StatusLine.cs:28
Singleton facade class used to access memory persistent data.
Definition: DataFace.cs:30
static DataFace Instance
Gets the Singleton instance.
Definition: DataFace.cs:51

Member Data Documentation

readonly HostPageConfiguration Ntp.Analyzer.Page.DefaultHostPageBuilder.config
private

Definition at line 52 of file DefaultHostPageBuilder.cs.

override IEnumerable<StreamDestination> Ntp.Analyzer.Page.DefaultHostPageBuilder.Destinations => config.Destinations.Destinations

Definition at line 55 of file DefaultHostPageBuilder.cs.

readonly List<StatusLine> Ntp.Analyzer.Page.DefaultHostPageBuilder.lines
private

Definition at line 53 of file DefaultHostPageBuilder.cs.


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