NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Process.Description.NotifyJob Class Reference
Inheritance diagram for Ntp.Analyzer.Process.Description.NotifyJob:
Collaboration diagram for Ntp.Analyzer.Process.Description.NotifyJob:

Public Member Functions

 NotifyJob (NotifyConfiguration config, LogBase log, int pid, string configFile)
 
void Dispose ()
 
- 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 => "Notification mail"
 
override int Priority => 99
 
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...
 

Package Functions

void SetJobList (IEnumerable< Job > items)
 Sets the job list to be monitored. More...
 
- Package Functions inherited from Ntp.Common.Process.JobDescription
void Execute ()
 Perform execution of this instance. More...
 

Private Member Functions

 ~NotifyJob ()
 
string BuildContent ()
 Builds the message content. More...
 
void Dispose (bool disposing)
 

Private Attributes

readonly SmtpClient client
 
readonly NotifyConfiguration config
 
readonly string configFile
 
readonly List< Jobjobs
 
readonly int pid
 

Additional Inherited Members

- 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

Definition at line 35 of file NotifyJob.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Process.Description.NotifyJob.NotifyJob ( NotifyConfiguration  config,
LogBase  log,
int  pid,
string  configFile 
)
inline

Definition at line 37 of file NotifyJob.cs.

References Ntp.Analyzer.Config.Node.NotifyConfiguration.EnableSsl, Ntp.Analyzer.Config.Node.NotifyConfiguration.SmptServer, Ntp.Analyzer.Config.Node.NotifyConfiguration.SmtpPass, Ntp.Analyzer.Config.Node.NotifyConfiguration.SmtpPort, and Ntp.Analyzer.Config.Node.NotifyConfiguration.SmtpUser.

43  : base(config, log)
44  {
45  this.config = config;
46  this.pid = pid;
47  this.configFile = configFile;
48  jobs = new List<Job>();
49 
50  client = new SmtpClient(config.SmptServer, config.SmtpPort);
51 
52  if (config.SmtpUser != null)
53  {
54  client.Credentials = new NetworkCredential(config.SmtpUser, config.SmtpPass ?? string.Empty);
55  }
56 
57  client.EnableSsl = config.EnableSsl;
58  }
readonly NotifyConfiguration config
Definition: NotifyJob.cs:61
Ntp.Analyzer.Process.Description.NotifyJob.~NotifyJob ( )
inlineprivate

Definition at line 119 of file NotifyJob.cs.

120  {
121  Dispose(false);
122  }

Member Function Documentation

string Ntp.Analyzer.Process.Description.NotifyJob.BuildContent ( )
inlineprivate

Builds the message content.

Returns
The content.

Definition at line 97 of file NotifyJob.cs.

References Ntp.Analyzer.Monitor.Server.Billboard.Jobs().

98  {
99  var builder = new StringBuilder();
100  builder.AppendLine("List of running items in NTP Analyzer");
101  builder.Append(Billboard.Jobs(jobs));
102  builder.Append("Using configuration: ");
103  builder.AppendLine(configFile);
104  builder.Append("Running with PID: ");
105  builder.AppendLine(pid.ToString(CultureInfo.InvariantCulture));
106  return builder.ToString();
107  }
static string Jobs(IEnumerable< Job > jobs)
Definition: Billboard.cs:33

Here is the call graph for this function:

void Ntp.Analyzer.Process.Description.NotifyJob.Dispose ( bool  disposing)
inlineprivate

Definition at line 111 of file NotifyJob.cs.

112  {
113  if (disposing)
114  {
115  client.Dispose();
116  }
117  }
void Ntp.Analyzer.Process.Description.NotifyJob.Dispose ( )
inline

Definition at line 124 of file NotifyJob.cs.

125  {
126  Dispose(true);
127  GC.SuppressFinalize(this);
128  }
override void Ntp.Analyzer.Process.Description.NotifyJob.InternalExecute ( )
inlineprotectedvirtual

Implementing method for descendants.

Implements Ntp.Common.Process.JobDescription.

Definition at line 72 of file NotifyJob.cs.

73  {
74  var message = new MailMessage(
75  config.Sender,
76  config.Mail,
78  BuildContent()
79  );
80 
81  client.Send(message);
82  }
readonly NotifyConfiguration config
Definition: NotifyJob.cs:61
string BuildContent()
Builds the message content.
Definition: NotifyJob.cs:97
void Ntp.Analyzer.Process.Description.NotifyJob.SetJobList ( IEnumerable< Job items)
inlinepackage

Sets the job list to be monitored.

Parameters
itemsScheduled items.

Definition at line 88 of file NotifyJob.cs.

89  {
90  jobs.AddRange(items);
91  }

Member Data Documentation

readonly SmtpClient Ntp.Analyzer.Process.Description.NotifyJob.client
private

Definition at line 60 of file NotifyJob.cs.

readonly NotifyConfiguration Ntp.Analyzer.Process.Description.NotifyJob.config
private

Definition at line 61 of file NotifyJob.cs.

readonly string Ntp.Analyzer.Process.Description.NotifyJob.configFile
private

Definition at line 62 of file NotifyJob.cs.

readonly List<Job> Ntp.Analyzer.Process.Description.NotifyJob.jobs
private

Definition at line 63 of file NotifyJob.cs.

override string Ntp.Analyzer.Process.Description.NotifyJob.JobType => "Notification mail"

Definition at line 68 of file NotifyJob.cs.

readonly int Ntp.Analyzer.Process.Description.NotifyJob.pid
private

Definition at line 64 of file NotifyJob.cs.

override int Ntp.Analyzer.Process.Description.NotifyJob.Priority => 99

Definition at line 70 of file NotifyJob.cs.

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

Definition at line 66 of file NotifyJob.cs.


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