EDMI Service: WIP

This commit is contained in:
Jonathan Jenne
2020-04-09 16:23:39 +02:00
parent 7abf47c2fc
commit bb9dd66d1f
20 changed files with 185 additions and 86 deletions

View File

@@ -13,8 +13,10 @@ Public Class WindowsService
Private _logConfig As LogConfig
Private _logger As Logger
Private _db As Firebird
Private _clientsConnected As Integer = 0
Private _firebird As Firebird
Private _mssql As MSSQLServer
Private _config As AppConfig
Private _Path As EDMI.File.Path
Private _Archive As EDMI.File.Archive
@@ -39,17 +41,28 @@ Public Class WindowsService
_logger = _logConfig.GetLogger()
_logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
_logger.Debug("Connecting to database...")
_db = New Firebird(
_logConfig,
AppConfig.FirebirdDataSource,
AppConfig.FirebirdDatabase,
AppConfig.FirebirdUser,
AppConfig.FirebirdPassword
)
If AppConfig.IsFirebirdConfigured() Then
_logger.Debug("Connecting to Firebird...")
_firebird = New Firebird(
_logConfig,
AppConfig.FirebirdDataSource,
AppConfig.FirebirdDatabase,
AppConfig.FirebirdUser,
AppConfig.FirebirdPassword
)
_logger.Info("Database connection established.")
Else
_logger.Info("Firebird is not configured, will not be used!")
End If
_logger.Info("Database connection established.")
If AppConfig.IsMSSQLConfigured() Then
_logger.Debug("Connecting to MSSQL...")
_mssql = New MSSQLServer(_logConfig, AppConfig.MSSQLConnectionString)
_logger.Info("Database connection established.")
Else
_logger.Info("MSSQL is not configured, will not be used!")
End If
_logger.Debug("Initializing EDMI Functions")
@@ -57,9 +70,10 @@ Public Class WindowsService
_Archive = New EDMI.File.Archive(_logConfig)
_filesystem = New Filesystem.File(_logConfig)
_logger.Debug("EDMI Functions initialized.")
_logger.Info("EDMI Functions initialized.")
EDMIService.Database = _db
EDMIService.MSSQL = _mssql
EDMIService.Firebird = _firebird
EDMIService.LogConfig = _logConfig
EDMIService.AppConfig = _config
EDMIService.EDMIArchive = _Archive
@@ -71,7 +85,7 @@ Public Class WindowsService
_serviceHost = New ServiceHost(GetType(EDMIService))
_serviceHost.Open()
_logger.Debug("WCF ServiceHost started.")
_logger.Info("WCF ServiceHost started.")
_logger.Info("Service {0} successfully started.", SERVICE_DISPLAY_NAME)
Catch ex As Exception