diff --git a/src/Soloplan.WhatsON.Jenkins/JenkinsProject.cs b/src/Soloplan.WhatsON.Jenkins/JenkinsProject.cs
index e0ea08a..81fbb3c 100644
--- a/src/Soloplan.WhatsON.Jenkins/JenkinsProject.cs
+++ b/src/Soloplan.WhatsON.Jenkins/JenkinsProject.cs
@@ -9,6 +9,7 @@
[SubjectType("Jenkins Project Status", Description = "Retrieve the current status of a Jenkins project.")]
[ConfigurationItem(ProjectName, typeof(string), Optional = false, Priority = 300)]
[ConfigurationItem(RedirectPlugin, typeof(bool), Priority = 400)] // defines use of Display URL API Plugin https://wiki.jenkins.io/display/JENKINS/Display+URL+API+Plugin
+ [ConfigurationItem(ServerPort, typeof(int), Priority = 200)]
public class JenkinsProject : ServerSubject
{
public const string ProjectName = "ProjectName";
@@ -18,6 +19,11 @@ public class JenkinsProject : ServerSubject
///
public const string RedirectPlugin = "RedirectPlugin";
+ ///
+ /// The server port.
+ ///
+ public const string ServerPort = "Port";
+
///
/// API class for accessing Jenkins.
///
@@ -36,12 +42,10 @@ public JenkinsProject(SubjectConfiguration configuration, IJenkinsApi api)
public string Project => this.GetProject();
- private JenkinsStatus PreviousCheckStatus { get; set; }
-
///
/// Gets the port number.
///
- public override int Port
+ public int Port
{
get
{
@@ -55,6 +59,8 @@ public override int Port
}
}
+ private JenkinsStatus PreviousCheckStatus { get; set; }
+
///
/// Gets the project.
///
@@ -64,6 +70,15 @@ public string GetProject()
return this.SubjectConfiguration.GetConfigurationByKey(JenkinsProject.ProjectName).Value;
}
+ ///
+ /// Gets the port.
+ ///
+ /// The port number.
+ public string GetPort()
+ {
+ return this.SubjectConfiguration.GetConfigurationByKey(ServerPort).Value;
+ }
+
protected override async Task ExecuteQuery(CancellationToken cancellationToken, params string[] args)
{
var job = await this.api.GetJenkinsJob(this, cancellationToken);
diff --git a/src/Soloplan.WhatsON.ServerBase/ServerSubject.cs b/src/Soloplan.WhatsON.ServerBase/ServerSubject.cs
index c39820b..e4247de 100644
--- a/src/Soloplan.WhatsON.ServerBase/ServerSubject.cs
+++ b/src/Soloplan.WhatsON.ServerBase/ServerSubject.cs
@@ -1,11 +1,9 @@
namespace Soloplan.WhatsON.ServerBase
{
[ConfigurationItem(ServerAddress, typeof(string), Optional = false, Priority = 100)]
- [ConfigurationItem(ServerPort, typeof(int), Priority = 200)]
public abstract class ServerSubject : Subject
{
public const string ServerAddress = "Address";
- public const string ServerPort = "Port";
///
/// Initializes a new instance of the class.
@@ -24,24 +22,5 @@ public string Address
get => this.SubjectConfiguration.GetConfigurationByKey(ServerAddress).Value;
set => this.SubjectConfiguration.GetConfigurationByKey(ServerAddress).Value = value;
}
-
- ///
- /// Gets or sets the port.
- ///
- public virtual int Port
- {
- get
- {
- var configItem = this.SubjectConfiguration.GetConfigurationByKey(ServerPort);
- if (configItem != null)
- {
- return int.TryParse(configItem.Value, out var port) ? port : 0;
- }
-
- return 0;
- }
-
- set => this.SubjectConfiguration.GetConfigurationByKey(ServerPort).Value = value.ToString();
- }
}
}
diff --git a/src/Soloplan.WhatsON.ServerBase/SubjectExtensions.cs b/src/Soloplan.WhatsON.ServerBase/SubjectExtensions.cs
index 68bd93d..24df90e 100644
--- a/src/Soloplan.WhatsON.ServerBase/SubjectExtensions.cs
+++ b/src/Soloplan.WhatsON.ServerBase/SubjectExtensions.cs
@@ -6,10 +6,5 @@ public static string GetAddress(this ServerSubject subject)
{
return subject.SubjectConfiguration.GetConfigurationByKey(ServerSubject.ServerAddress).Value;
}
-
- public static string GetPort(this ServerSubject subject)
- {
- return subject.SubjectConfiguration.GetConfigurationByKey(ServerSubject.ServerPort).Value;
- }
}
}
\ No newline at end of file