diff --git a/GUIs.Test.TestGUI/My Project/AssemblyInfo.vb b/GUIs.Test.TestGUI/My Project/AssemblyInfo.vb index fd6066e0..f25037ee 100644 --- a/GUIs.Test.TestGUI/My Project/AssemblyInfo.vb +++ b/GUIs.Test.TestGUI/My Project/AssemblyInfo.vb @@ -10,9 +10,9 @@ Imports System.Runtime.InteropServices - + - + diff --git a/GUIs.Test.TestGUI/My Project/licenses.licx b/GUIs.Test.TestGUI/My Project/licenses.licx index 78d6cc83..05ac291a 100644 --- a/GUIs.Test.TestGUI/My Project/licenses.licx +++ b/GUIs.Test.TestGUI/My Project/licenses.licx @@ -1 +1,2 @@ +DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraSpreadsheet.SpreadsheetControl, DevExpress.XtraSpreadsheet.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/GUIs.Test.TestGUI/frmFilesystem.vb b/GUIs.Test.TestGUI/frmFilesystem.vb index 6b1eda90..4eddc498 100644 --- a/GUIs.Test.TestGUI/frmFilesystem.vb +++ b/GUIs.Test.TestGUI/frmFilesystem.vb @@ -6,11 +6,12 @@ Imports DigitalData.GUIs.Common Imports DigitalData.Modules.Base.IDB.Constants Imports DigitalData.Modules.Database Imports DigitalData.Modules.EDMI.API -Imports DigitalData.Modules.EDMI.API.EDMIServiceReference Imports DigitalData.Modules.Logging Imports DigitalData.Modules.ZooFlow.State Imports DigitalData.Services.EDMIService Imports DigitalData.Services.EDMIService.GlobalState +Imports DigitalData.Services.EDMIService.Methods.GlobalIndexer.ImportFile +Imports DigitalData.Services.EDMIService.Methods.IDB Public Class frmFilesystem Private EDMIClient As Client @@ -26,35 +27,18 @@ Public Class frmFilesystem Public Property ServiceOnline As Boolean = False Private LogConfig As LogConfig Private MYDD_Filesystem As DigitalData.Modules.Filesystem.File + Private _globalState As GlobalState Private ShortName As String = "E:\some_test_file.txt" - Private LongName As String = "E:\some_test_file_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more.txt" + Private LongName As String = "E:\some_test_file_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more.txt" Private Sub frmFilesystem_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try LogConfig = New LogConfig(LogConfig.PathType.Temp) Logger = LogConfig.GetLogger() MYDD_Filesystem = New DigitalData.Modules.Filesystem.File(LogConfig) - - - 'Using oWriter = IO.File.CreateText("E:\some_test_file.txt") - ' oWriter.WriteLine("bla bla bla") - 'End Using - - 'IO.File.Copy(ShortName, LongName) - - 'Dim oVersion1 = Filesystem.GetVersionedFilename(LongName) - 'IO.File.Copy(ShortName, oVersion1) - - 'Dim oVersion2 = Filesystem.GetVersionedFilename(LongName) - 'IO.File.Copy(ShortName, oVersion2) - Catch ex As Exception - - Finally - 'IO.File.Delete(ShortName) - 'IO.File.Delete(LongName) + Catch End Try - End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click @@ -63,15 +47,11 @@ Public Class frmFilesystem Private Sub Button3_Click(sender As Object, e As EventArgs) If SaveFileDialog1.ShowDialog = DialogResult.OK Then - ' Fallback: einfache Textdatei schreiben System.IO.File.WriteAllText(SaveFileDialog1.FileName, "Some text data") End If End Sub Public Class SecureStorageHandler - - - End Class Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click @@ -84,7 +64,7 @@ Public Class frmFilesystem txtStatus.Text = STATUS_CONNECTING Dim oResult = EDMIClient.Connect() - If oResult = True Then + If oResult Then ServiceAddress = $"{oIPAddress}:{oPort}" ServiceOnline = True txtStatus.Text = STATUS_CONNECTED @@ -101,37 +81,39 @@ Public Class frmFilesystem Logger.Debug("Establishing Database connection with fallback..") My.Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) + + InitializeGlobalState() Else ServiceAddress = "" ServiceOnline = True txtStatus.Text = STATUS_FAILED txtStatus.BackColor = Color.LightCoral - ' TODO: Make a connection test that is as elaborate as this one :D - 'Select Case oResult - ' Case ClassService.ConnectionTestResult.NotFound - ' lblStatus.Text = "Dienst konnte nicht gefunden werden. Bitte überprüfen sie Addresse und Port." - ' Case ClassService.ConnectionTestResult.EmptyURI - ' lblStatus.Text = "Bitte tragen Sie eine gültige Dienst Adresse ein." - ' Case ClassService.ConnectionTestResult.Authentication - ' lblStatus.Text = "Authentifizierungsfehler. Prüfen Sie, ob sich Ihr Gerät in der korrekten Domäne befindet." - ' Case Else - ' lblStatus.Text = "Unbekannter Fehler." - 'End Select + _globalState = Nothing End If Catch ex As Exception + _globalState = Nothing If Logger IsNot Nothing Then Logger.Error(ex) MsgBox("Fehler beim Verbindungsaufbau", MsgBoxStyle.Critical, Text) End Try End Sub - Private Sub Button2_ClickAsync(sender As Object, e As EventArgs) Handles btnStreamSimpleFile.Click - ' Import a file via EDMI Globix ImportFile API to test Service.EDMIService ImportFileMethod + Private Sub btnStreamSimpleFile_ClickAsync(sender As Object, e As EventArgs) Handles btnStreamSimpleFile.Click Try If EDMIClient Is Nothing OrElse ServiceOnline = False Then MsgBox("Bitte zuerst Verbindung zum EDMI Service herstellen.", MsgBoxStyle.Exclamation, Text) Return End If + If My.DatabaseIDB Is Nothing OrElse My.DatabaseECM Is Nothing Then + MsgBox("Bitte zuerst die Datenbankverbindungen herstellen.", MsgBoxStyle.Exclamation, Text) + Return + End If + + If _globalState Is Nothing Then + MsgBox("GlobalState konnte nicht initialisiert werden.", MsgBoxStyle.Exclamation, Text) + Return + End If + Using ofd As New OpenFileDialog() ofd.Title = "Datei für Import wählen" ofd.Filter = "Alle Dateien (*.*)|*.*" @@ -143,8 +125,7 @@ Public Class frmFilesystem Dim fi As New FileInfo(oFilePath) Dim fileBytes As Byte() = IO.File.ReadAllBytes(oFilePath) - ' Basic user context for testing - Dim user As New DigitalData.Modules.ZooFlow.State.UserState() With { + Dim oUser As New UserState With { .UserName = Environment.UserName, .Language = "de-DE", .LanguageId = 1031 @@ -154,8 +135,7 @@ Public Class frmFilesystem Dim oIDBDoctypeId As Long = 1 Dim oObjectKind As String = "DOC" Dim oProfileId As Integer = 1 - Dim oAttributes As List(Of UserAttributeValue) = Nothing - Dim oOptions As New Options.ImportFileOptions + Dim oAttributes As New List(Of UserAttributeValue) Logger.Debug("FilePath: [{0}]", oFilePath) Logger.Debug("ObjectStore: [{0}]", oObjectStore) @@ -163,11 +143,71 @@ Public Class frmFilesystem Logger.Debug("ProfileId: [{0}]", oProfileId) Logger.Debug("IDB DoctypeId: [{0}]", oIDBDoctypeId) + Dim oChecksum As String + Using oSha256 As SHA256 = SHA256.Create() + oChecksum = BitConverter.ToString(oSha256.ComputeHash(fileBytes)).Replace("-", String.Empty) + End Using + Dim oFileProperties As New FileProperties With { + .FileName = fi.FullName, + .FileCreatedAt = fi.CreationTimeUtc.ToString("O"), + .FileChangedAt = fi.LastWriteTimeUtc.ToString("O"), + .FileImportedAt = DateTime.UtcNow, + .FileContents = fileBytes, + .FileChecksum = oChecksum, + .FileInfoRaw = fi + } + + Dim oRequest As New Globix_ImportFileRequest With { + .File = oFileProperties, + .ProfileId = oProfileId, + .IDBDoctypeId = oIDBDoctypeId, + .KindType = oObjectKind, + .StoreName = oObjectStore, + .AttributeValues = oAttributes, + .User = oUser + } + + Dim oImportMethod = New ImportFileMethod(LogConfig, My.DatabaseIDB, My.DatabaseECM, _globalState) + Dim oResponse = oImportMethod.Run(oRequest) + + If oResponse IsNot Nothing AndAlso oResponse.ObjectId > 0 Then + Logger.Info("Import erfolgreich abgeschlossen. ObjectId [{0}]", oResponse.ObjectId) + MsgBox($"Import erfolgreich. ObjectId: {oResponse.ObjectId}", MsgBoxStyle.Information, Text) + Else + Logger.Warn("ImportFile lieferte kein erfolgreiches Ergebnis.") + MsgBox("Import konnte nicht durchgeführt werden.", MsgBoxStyle.Exclamation, Text) + End If End Using Catch ex As Exception If Logger IsNot Nothing Then Logger.Error(ex) MsgBox("Fehler beim Datei-Import.", MsgBoxStyle.Critical, Text) End Try End Sub + + Private Sub InitializeGlobalState() + Try + _globalState = New GlobalState(LogConfig, My.DatabaseIDB, My.DatabaseECM) + _globalState.LoadObjectStores() + _globalState.LoadConnections() + _globalState.LoadDoctypes() + + Dim oConfig As New Config With { + .ClientConfig = New Config.ClientConfiguration With { + .ForceDirectDatabaseAccess = True + } + } + + _globalState.LoadClientConfig(oConfig) + + Logger.Info("GlobalState init: ObjectStores [{0}], Connections [{1}], Doctypes [{2}]", + _globalState.ObjectStores.Count, + _globalState.Connections.Count, + _globalState.Doctypes.Count) + Catch ex As Exception + _globalState = Nothing + Logger.Error(ex) + MsgBox("GlobalState konnte nicht initialisiert werden.", MsgBoxStyle.Exclamation, Text) + End Try + End Sub End Class \ No newline at end of file diff --git a/Service.EDMIService/EDMIService - Kopie.vbproj b/Service.EDMIService/EDMIService - Kopie.vbproj new file mode 100644 index 00000000..745690ba --- /dev/null +++ b/Service.EDMIService/EDMIService - Kopie.vbproj @@ -0,0 +1,297 @@ + + + + + Debug + AnyCPU + {A8C3F298-76AB-4359-AB3C-986E313B4336} + Exe + DigitalData.Services.EDMIService.WindowsService + DigitalData.Services.EDMIService + EDMIService + 512 + Console + v4.6.2;net8.0 + true + false + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + x64 + true + full + true + true + bin\Debug\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + false + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + ..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll + + + ..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll + + + ..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll + + + ..\..\DDModules\EDMIAPI\bin\Debug\DigitalData.Modules.EDMI.API.dll + + + P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Digital Data\DigitalData.Modules.Filesystem.dll + + + P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Digital Data\DigitalData.Modules.Language.dll + + + ..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll + + + ..\..\DDModules\Patterns\bin\Debug\DigitalData.Modules.Patterns.dll + + + ..\..\DDModules\ZooFlow\bin\Debug\DigitalData.Modules.ZooFlow.dll + + + ..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll + + + + ..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll + + + ..\packages\NLog.5.0.5\lib\net46\NLog.dll + + + ..\packages\Quartz.3.5.0\lib\net462\Quartz.dll + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + + + + ..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component + + + + + True + Application.myapp + True + + + True + True + Resources.resx + + + True + Settings.settings + True + + + Component + + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + ProjectInstaller.vb + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + PreserveNewest + Designer + + + + + + False + Microsoft .NET Framework 4.6.1 %28x86 und x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + \ No newline at end of file diff --git a/Service.EDMIService/EDMIService1.vbproj b/Service.EDMIService/EDMIService1.vbproj new file mode 100644 index 00000000..e78b1303 --- /dev/null +++ b/Service.EDMIService/EDMIService1.vbproj @@ -0,0 +1,297 @@ + + + + + Debug + AnyCPU + {A8C3F298-76AB-4359-AB3C-986E313B4336} + Exe + DigitalData.Services.EDMIService.WindowsService + DigitalData.Services.EDMIService + EDMIService + 512 + Console + net8.0 + true + false + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + x64 + true + full + true + true + bin\Debug\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + false + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + + + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + ..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll + + + ..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll + + + ..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll + + + ..\..\DDModules\EDMIAPI\bin\Debug\DigitalData.Modules.EDMI.API.dll + + + P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Digital Data\DigitalData.Modules.Filesystem.dll + + + P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Digital Data\DigitalData.Modules.Language.dll + + + ..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll + + + ..\..\DDModules\Patterns\bin\Debug\DigitalData.Modules.Patterns.dll + + + ..\..\DDModules\ZooFlow\bin\Debug\DigitalData.Modules.ZooFlow.dll + + + ..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll + + + + ..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll + + + ..\packages\NLog.5.0.5\lib\net46\NLog.dll + + + ..\packages\Quartz.3.5.0\lib\net462\Quartz.dll + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + + + + ..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component + + + + + True + Application.myapp + True + + + True + True + Resources.resx + + + True + Settings.settings + True + + + Component + + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + ProjectInstaller.vb + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + PreserveNewest + Designer + + + + + + False + Microsoft .NET Framework 4.6.1 %28x86 und x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + \ No newline at end of file