NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Config.Syntax.DatabaseSyntaxNode Class Reference
Inheritance diagram for Ntp.Analyzer.Config.Syntax.DatabaseSyntaxNode:
Collaboration diagram for Ntp.Analyzer.Config.Syntax.DatabaseSyntaxNode:

Public Member Functions

 DatabaseSyntaxNode (string name, int line)
 
- Public Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< DatabaseConfiguration >
void Add (ISyntaxNode node)
 
void Assemble (ISyntaxNode node)
 
Compile ()
 
void CompileNode ()
 
IEnumerator< ISyntaxNodeGetEnumerator ()
 
void Resolve (SymbolTable table)
 
void Validate (SymbolTable table)
 

Protected Member Functions

override DatabaseConfiguration InternalCompile ()
 
override void ValidateMandatories ()
 Override to validates the mandatory types in this syntax node. More...
 
override void ValidateTypes ()
 Override to validates the types in this syntax node. More...
 
- Protected Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< DatabaseConfiguration >
 SyntaxNode (Symbol symbol, string name, int line, bool requirePath=false)
 
void AddError (string message)
 
void AddReferenceNameError (ISyntaxNode node, string keyword, string name)
 
void AddReferenceTypeError (ISyntaxNode node, string keyword, string section, string name)
 
void CheckAllIsPresent (IEnumerable< Symbol > list)
 
void CheckIsUnique (IEnumerable< Symbol > list)
 
Uri CheckLink (string link, string keyword)
 
void CheckOneIsPresent (IEnumerable< Symbol > list)
 
void CheckOnlyOneIsPresent (IEnumerable< Symbol > list)
 
void CheckTypeIs< TU > (Symbol symbol)
 
void CheckTypeIs< TU, TV > (Symbol symbol)
 
virtual void InternalResolve (SymbolTable table)
 Override to resolve references to other syntax nodes from this syntax node. More...
 
virtual void ValidateReferences (SymbolTable table)
 Override to validates the references in this syntax node. More...
 

Additional Inherited Members

- Public Attributes inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< DatabaseConfiguration >
ConfigurationNode CompiledNode
 
IEnumerable< string > Errors
 
bool HasErrors
 
- Properties inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< DatabaseConfiguration >
int Line [get]
 
string Name [get]
 
List< ISyntaxNodeNodes [get]
 
bool RequirePath [get]
 
Symbol Symbol [get]
 

Detailed Description

Definition at line 32 of file DatabaseSyntaxNode.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Config.Syntax.DatabaseSyntaxNode.DatabaseSyntaxNode ( string  name,
int  line 
)
inline

Definition at line 34 of file DatabaseSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.KeywordDatabase.

35  : base(Symbol.KeywordDatabase, name, line)
36  {
37  }

Member Function Documentation

override DatabaseConfiguration Ntp.Analyzer.Config.Syntax.DatabaseSyntaxNode.InternalCompile ( )
inlineprotectedvirtual

Implements Ntp.Analyzer.Config.Syntax.SyntaxNode< DatabaseConfiguration >.

Definition at line 39 of file DatabaseSyntaxNode.cs.

40  {
41  var host = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordIp) as StringSettingNode ??
42  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordHost) as StringSettingNode ??
43  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordAddress) as StringSettingNode ??
44  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordHostAddress) as StringSettingNode;
45  var port = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPort) as IntegerSettingNode;
46  var database = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordName) as StringSettingNode ??
47  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDatabase) as StringSettingNode;
48  var user = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordUser) as StringSettingNode ??
49  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDatabaseUser) as StringSettingNode;
50  var pass = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPass) as StringSettingNode ??
51  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDatabasePass) as StringSettingNode;
52  var create = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordCreate) as BooleanSettingNode;
53  var upgrade = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordUpgrade) as BooleanSettingNode;
54  var import = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordImport) as BooleanSettingNode;
55  var provider = Nodes.Single(n => n.Symbol == Symbol.KeywordDatabaseProvider) as DatabaseProviderNode;
56  var conString = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordConString) as StringSettingNode;
57  var certFile = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordCertFile) as StringSettingNode;
58  var certPass = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordCertPass) as StringSettingNode;
59  var timeout = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordConnectionTimeout) as IntegerSettingNode;
60  var protocol = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordProtocol) as IntegerSettingNode;
61  var ssl = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordEnableSsl) as BooleanSettingNode;
62 
63  if (provider == null || host == null || database == null || user == null || pass == null)
64  {
65  throw new InvalidOperationException(@"Internal compiler error: DatabaseSyntaxNode");
66  }
67 
68  return new DatabaseConfiguration(
69  Name,
70  provider.DatabaseProvider,
71  host.Value,
72  port?.Value,
73  database.Value,
74  user.Value,
75  pass.Value,
76  conString?.Value,
77  certFile?.Value,
78  certPass?.Value,
79  timeout?.Value,
80  protocol?.Value,
81  ssl?.Value,
82  create?.Value,
83  upgrade?.Value,
84  import?.Value
85  );
86  }
override void Ntp.Analyzer.Config.Syntax.DatabaseSyntaxNode.ValidateMandatories ( )
inlineprotectedvirtual

Override to validates the mandatory types in this syntax node.

When overriding this method do not call the base method.

Reimplemented from Ntp.Analyzer.Config.Syntax.SyntaxNode< DatabaseConfiguration >.

Definition at line 88 of file DatabaseSyntaxNode.cs.

89  {
90  CheckIsUnique(new List<Symbol>
91  {
92  Symbol.KeywordDatabaseProvider,
93  Symbol.KeywordName,
94  Symbol.KeywordHost,
95  Symbol.KeywordIp,
96  Symbol.KeywordAddress,
97  Symbol.KeywordHostAddress,
98  Symbol.KeywordPort,
99  Symbol.KeywordUser,
100  Symbol.KeywordPass,
101  Symbol.KeywordCreate,
102  Symbol.KeywordImport,
103  Symbol.KeywordUpgrade,
104  Symbol.KeywordDatabaseName,
105  Symbol.KeywordDatabaseUser,
106  Symbol.KeywordDatabasePass,
107  Symbol.KeywordConString,
108  Symbol.KeywordCertFile,
109  Symbol.KeywordCertPass,
110  Symbol.KeywordConnectionTimeout,
111  Symbol.KeywordProtocol,
112  Symbol.KeywordEnableSsl,
113  Symbol.KeywordSslMode
114  });
115 
116  CheckAllIsPresent(new List<Symbol> {Symbol.KeywordDatabaseProvider});
117 
118  CheckOneIsPresent(new List<Symbol>
119  {
120  Symbol.KeywordIp,
121  Symbol.KeywordHost,
122  Symbol.KeywordAddress,
123  Symbol.KeywordHostAddress
124  });
125 
126  CheckOneIsPresent(new List<Symbol>
127  {
128  Symbol.KeywordName,
129  Symbol.KeywordDatabaseName
130  });
131 
132  CheckOneIsPresent(new List<Symbol>
133  {
134  Symbol.KeywordUser,
135  Symbol.KeywordDatabaseUser
136  });
137 
138  CheckOneIsPresent(new List<Symbol>
139  {
140  Symbol.KeywordPass,
141  Symbol.KeywordDatabasePass
142  });
143  }
override void Ntp.Analyzer.Config.Syntax.DatabaseSyntaxNode.ValidateTypes ( )
inlineprotectedvirtual

Override to validates the types in this syntax node.

When overriding this method do not call the base method.

Reimplemented from Ntp.Analyzer.Config.Syntax.SyntaxNode< DatabaseConfiguration >.

Definition at line 145 of file DatabaseSyntaxNode.cs.

146  {
147  CheckTypeIs<DatabaseProviderNode>(Symbol.KeywordDatabaseProvider);
148  CheckTypeIs<StringSettingNode>(Symbol.KeywordName);
149  CheckTypeIs<StringSettingNode>(Symbol.KeywordIp);
150  CheckTypeIs<StringSettingNode>(Symbol.KeywordHost);
151  CheckTypeIs<StringSettingNode>(Symbol.KeywordAddress);
152  CheckTypeIs<StringSettingNode>(Symbol.KeywordHostAddress);
153  CheckTypeIs<IntegerSettingNode>(Symbol.KeywordPort);
154  CheckTypeIs<StringSettingNode>(Symbol.KeywordUser);
155  CheckTypeIs<StringSettingNode>(Symbol.KeywordPass);
156  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordCreate);
157  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordUpgrade);
158  CheckTypeIs<StringSettingNode>(Symbol.KeywordConString);
159  CheckTypeIs<StringSettingNode>(Symbol.KeywordCertFile);
160  CheckTypeIs<StringSettingNode>(Symbol.KeywordCertPass);
161  CheckTypeIs<IntegerSettingNode>(Symbol.KeywordConnectionTimeout);
162  CheckTypeIs<IntegerSettingNode>(Symbol.KeywordProtocol);
163  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordEnableSsl);
164  }

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