NTP Analyzer  0.8.2
Analyze the operation of time servers
DatabaseConfiguration.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 
23 using Ntp.Analyzer.Config.Table;
24 using Ntp.Data;
25 
26 namespace Ntp.Analyzer.Config.Node
27 {
29  {
31  string configName,
32  SqlDatabaseProvider provider,
33  string host,
34  int? port,
35  string name,
36  string user,
37  string pass,
38  string connString,
39  string certFile,
40  string certPass,
41  int? connectionTimeout,
42  int? protocol,
43  bool? ssl,
44  bool? initialize,
45  bool? upgrade,
46  bool? import
47  )
48  : base(configName)
49  {
50  Provider = provider;
51  Host = host;
52  Port = port;
53  Name = name;
54  User = user;
55  Pass = pass;
56  ConnectionString = connString;
57  CertificateFile = certFile;
58  CertificatePassword = certPass;
59  Protocol = protocol;
60  ConnectionTimeout = connectionTimeout;
61  this.ssl = ssl;
62  this.initialize = initialize;
63  this.upgrade = upgrade;
64  this.import = import;
65  }
66 
67  private readonly bool? import;
68 
69  private readonly bool? initialize;
70  private readonly bool? ssl;
71  private readonly bool? upgrade;
72 
73  [NtpaIndex(50)]
74  [NtpaSetting(Symbol.KeywordCreate, false)]
75  public bool Initialize => initialize ?? false;
76 
77  [NtpaIndex(51)]
78  [NtpaSetting(Symbol.KeywordUpgrade, false)]
79  public bool Upgrade => upgrade ?? false;
80 
81  [NtpaIndex(52)]
82  [NtpaSetting(Symbol.KeywordImport, true)]
83  public bool Import => import ?? true;
84 
85  [NtpaIndex(2)]
86  [NtpaSetting(Symbol.KeywordConString)]
87  public string ConnectionString { get; }
88 
89  [NtpaIndex(15)]
90  [NtpaSetting(Symbol.KeywordEnableSsl, false)]
91  public bool EnableSsl => ssl ?? false;
92 
93  /*
94  new Keyword("SslMode", Symbol.KeywordSslMode),
95  new Keyword("Required", Symbol.KeywordRequired),
96  new Keyword("Preferred", Symbol.KeywordPreferred),
97  */
98 
99  [NtpaIndex(17)]
100  [NtpaSetting(Symbol.KeywordProtocol)]
101  public int? Protocol { get; }
102 
103  [NtpaIndex(30)]
104  [NtpaSetting(Symbol.KeywordCertFile)]
105  public string CertificateFile { get; }
106 
107 
108  [NtpaIndex(31)]
109  [NtpaSetting(Symbol.KeywordCertPass)]
110  public string CertificatePassword { get; }
111 
116  [NtpaIndex(40)]
117  [NtpaSetting(Symbol.KeywordConnectionTimeout)]
118  public int? ConnectionTimeout { get; }
119 
120  [NtpaIndex(1)]
121  [NtpaSetting(Symbol.KeywordDatabaseProvider)]
122  public SqlDatabaseProvider Provider { get; }
123 
124  [NtpaIndex(10)]
125  [NtpaSetting(Symbol.KeywordHost)]
126  public string Host { get; }
127 
128  [NtpaIndex(11)]
129  [NtpaSetting(Symbol.KeywordPort)]
130  public int? Port { get; }
131 
132  [NtpaIndex(12)]
133  [NtpaSetting(Symbol.KeywordName)]
134  public string Name { get; }
135 
136  [NtpaIndex(13)]
137  [NtpaSetting(Symbol.KeywordUser)]
138  public string User { get; }
139 
140  [NtpaIndex(14)]
141  [NtpaSetting(Symbol.KeywordPass, Layout = Layout.Quoted)]
142  public string Pass { get; }
143  }
144 }
DatabaseConfiguration(string configName, SqlDatabaseProvider provider, string host, int?port, string name, string user, string pass, string connString, string certFile, string certPass, int?connectionTimeout, int?protocol, bool?ssl, bool?initialize, bool?upgrade, bool?import)