NTP Analyzer  0.8.2
Analyze the operation of time servers
HostPageConfiguration.cs
Go to the documentation of this file.
1 //
2 // Copyright (c) 2013-2017 Carsten Sonne Larsen <cs@innolan.net>
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to deal
6 // in the Software without restriction, including without limitation the rights
7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 // copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 // THE SOFTWARE.
21 
22 using System;
23 using System.Collections.Generic;
28 using Ntp.Analyzer.Config.Table;
29 using Ntp.Common.Process;
30 
31 namespace Ntp.Analyzer.Config.Node.Page
32 {
37  {
39  string configName,
40  int? frequency,
41  bool? initialRun,
42  bool? fixedRun,
43  DateTimeKind? showUtc,
44  PageTheme? theme,
45  string title,
46  bool? poolMember,
47  bool? queryDirect,
48  Uri link,
49  PeerPageConfiguration peerPage,
50  IEnumerable<GraphSetConfiguration> graphs,
51  SummaryCollection summaries,
52  FileCollection destinations)
53  : base(configName, destinations, link)
54  {
55  this.frequency = frequency;
56  this.initialRun = initialRun;
57  this.fixedRun = fixedRun;
58  this.showUtc = showUtc;
59  this.theme = theme;
60  this.poolMember = poolMember;
61  this.queryDirect = queryDirect;
62  this.graphs = new List<GraphSetConfiguration>(graphs);
63  graphPages = new List<HostGraphPageConfiguration>();
64  Title = title;
65  PeerPage = peerPage;
66  PeerSummaries = summaries;
67  ConfigLink = link;
68  }
69 
70  private readonly bool? fixedRun;
71  private readonly int? frequency;
72  private readonly List<HostGraphPageConfiguration> graphPages;
73  private readonly List<GraphSetConfiguration> graphs;
74  private readonly bool? initialRun;
75  private readonly bool? poolMember;
76  private readonly bool? queryDirect;
77  private readonly DateTimeKind? showUtc;
78  private readonly PageTheme? theme;
79 
80  [NtpaIndex(16)]
81  [NtpaSetting(Symbol.KeywordPoolMember, false)]
82  public bool PoolMember => poolMember ?? false;
83 
84  [NtpaIndex(4)]
85  [NtpaSetting(Symbol.KeywordQueryDirect, false)]
86  public bool QueryDirect => queryDirect ?? false;
87 
88  [NtpaIndex(11)]
89  [NtpaSetting(Symbol.KeywordPageTemplate, PageTheme.Default)]
90  public override PageTheme Theme => theme ?? PageTheme.Default;
91 
92  [NtpaIndex(12)]
93  [NtpaSetting(Symbol.KeywordPageTime, DateTimeKind.Utc)]
94  public DateTimeKind ShowUtc => showUtc ?? DateTimeKind.Utc;
95 
96  [NtpaIndex(10)]
97  [NtpaSetting(Symbol.KeywordPageTitle, Layout = Layout.Quoted)]
98  public override string Title { get; }
99 
104  [NtpaIndex(15)]
105  [NtpaReference(Symbol.KeywordPeerPage)]
106  public PeerPageConfiguration PeerPage { get; }
107 
112  [NtpaIndex(30)]
113  [NtpaSettingsCollection(Symbol.KeywordGraphSet)]
114  public IEnumerable<GraphSetConfiguration> Graphs => graphs;
115 
120  [NtpaIndex(40)]
121  [NtpaSetting(Symbol.KeywordSummaries)]
122  public SummaryCollection PeerSummaries { get; }
123 
124  [NtpaIndex(20)]
125  [NtpaSetting(Symbol.KeywordLink)]
126  public Uri ConfigLink { get; }
127 
132  public IEnumerable<HostGraphPageConfiguration> GraphPages => graphPages;
133 
134  [NtpaIndex(1)]
135  [NtpaSetting(Symbol.KeywordFrequency, 5)]
136  public int Frequency => frequency ?? 5;
137 
138  [NtpaIndex(2)]
139  [NtpaSetting(Symbol.KeywordInitialRun, true)]
140  public bool InitialRun => initialRun ?? true;
141 
142  [NtpaIndex(3)]
143  [NtpaSetting(Symbol.KeywordFixedRun, true)]
144  public bool FixedRun => fixedRun ?? true;
145 
147  {
148  graphPages.Add(graphPage);
149  }
150  }
151 }
readonly List< HostGraphPageConfiguration > graphPages
readonly List< GraphSetConfiguration > graphs
HostPageConfiguration(string configName, int?frequency, bool?initialRun, bool?fixedRun, DateTimeKind?showUtc, PageTheme?theme, string title, bool?poolMember, bool?queryDirect, Uri link, PeerPageConfiguration peerPage, IEnumerable< GraphSetConfiguration > graphs, SummaryCollection summaries, FileCollection destinations)
void AttachGraphPage(HostGraphPageConfiguration graphPage)
Configuration for a HTML page showing status and graphs for a hosted NTP server.