MS Integration Services und fileOps
This commit is contained in:
79
SERVICES/DDEDM_NetworkService/App.config
Normal file
79
SERVICES/DDEDM_NetworkService/App.config
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<source propagateActivity="true" name="System.ServiceModel" switchValue="Warning, ActivityTracing">
|
||||
<listeners>
|
||||
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
|
||||
<filter type="" />
|
||||
</add>
|
||||
</listeners>
|
||||
</source>
|
||||
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
|
||||
<listeners>
|
||||
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
|
||||
<filter type="" />
|
||||
</add>
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<sharedListeners>
|
||||
<add initializeData="E:\EDMService\Trace.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
name="Xml" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
|
||||
<filter type="" />
|
||||
</add>
|
||||
</sharedListeners>
|
||||
<trace autoflush="true" />
|
||||
</system.diagnostics>
|
||||
<appSettings>
|
||||
<add key="FIREBIRD_DATASOURCE" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_NAME" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_USER" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_PASS" value=""/>
|
||||
<add key="CONTAINER_PATH" value=""/>
|
||||
<add key="CONTAINER_PASSWORD" value=""/>
|
||||
</appSettings>
|
||||
<system.serviceModel>
|
||||
<diagnostics wmiProviderEnabled="true">
|
||||
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
|
||||
</diagnostics>
|
||||
<bindings>
|
||||
<netTcpBinding>
|
||||
<binding
|
||||
name="tcpBinding"
|
||||
sendTimeout="00:10:00"
|
||||
maxReceivedMessageSize="2147483647"
|
||||
maxBufferSize="2147483647"
|
||||
transferMode="Streamed"
|
||||
>
|
||||
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" />
|
||||
</binding>
|
||||
</netTcpBinding>
|
||||
</bindings>
|
||||
<services>
|
||||
<service behaviorConfiguration="DefaultServiceBehavior" name="DigitalData.Services.EDMService.EDMService">
|
||||
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpBinding"
|
||||
name="tcpBinding" contract="DigitalData.Services.EDMService.IEDMService">
|
||||
<identity>
|
||||
<dns value="localhost" />
|
||||
</identity>
|
||||
</endpoint>
|
||||
<endpoint address="mex" binding="mexTcpBinding" name="MexTcpBinding"
|
||||
contract="IMetadataExchange" />
|
||||
<host>
|
||||
<baseAddresses>
|
||||
<add baseAddress="net.tcp://localhost:9000/DigitalData/Services/Main" />
|
||||
</baseAddresses>
|
||||
</host>
|
||||
</service>
|
||||
</services>
|
||||
<behaviors>
|
||||
<serviceBehaviors>
|
||||
<behavior name="DefaultServiceBehavior">
|
||||
<serviceMetadata httpGetEnabled="false" />
|
||||
<serviceDebug includeExceptionDetailInFaults="true" />
|
||||
</behavior>
|
||||
</serviceBehaviors>
|
||||
</behaviors>
|
||||
</system.serviceModel>
|
||||
</configuration>
|
||||
21
SERVICES/DDEDM_NetworkService/AppConfig.vb
Normal file
21
SERVICES/DDEDM_NetworkService/AppConfig.vb
Normal file
@@ -0,0 +1,21 @@
|
||||
Imports System.Configuration
|
||||
|
||||
Public Class AppConfig
|
||||
Public Shared FirebirdDataSource As String
|
||||
Public Shared FirebirdDatabase As String
|
||||
Public Shared FirebirdUser As String
|
||||
Public Shared FirebirdPassword As String
|
||||
Public Shared ContainerPath As String
|
||||
Public Shared ContainerPassword As String
|
||||
|
||||
Public Shared Sub Load()
|
||||
With ConfigurationManager.AppSettings
|
||||
FirebirdDataSource = .Item("FIREBIRD_DATASOURCE")
|
||||
FirebirdDatabase = .Item("FIREBIRD_DATABASE_NAME")
|
||||
FirebirdUser = .Item("FIREBIRD_DATABASE_USER")
|
||||
FirebirdPassword = .Item("FIREBIRD_DATABASE_PASS")
|
||||
ContainerPath = .Item("CONTAINER_PATH")
|
||||
ContainerPassword = .Item("CONTAINER_PASSWORD")
|
||||
End With
|
||||
End Sub
|
||||
End Class
|
||||
18
SERVICES/DDEDM_NetworkService/ContainerResult.vb
Normal file
18
SERVICES/DDEDM_NetworkService/ContainerResult.vb
Normal file
@@ -0,0 +1,18 @@
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
|
||||
<Serializable>
|
||||
Public Class ContainerResult
|
||||
Public ReadOnly OK As Boolean
|
||||
Public ReadOnly ErrorMessage As String
|
||||
Public Container As FileContainerInner
|
||||
|
||||
Public Sub New()
|
||||
OK = True
|
||||
ErrorMessage = Nothing
|
||||
End Sub
|
||||
|
||||
Public Sub New(ErrorMessage As String)
|
||||
OK = False
|
||||
Me.ErrorMessage = ErrorMessage
|
||||
End Sub
|
||||
End Class
|
||||
150
SERVICES/DDEDM_NetworkService/DDEDMService.vbproj
Normal file
150
SERVICES/DDEDM_NetworkService/DDEDMService.vbproj
Normal file
@@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A8C3F298-76AB-4359-AB3C-986E313B4336}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<StartupObject>DigitalData.Services.EDMService.EDMWindowsService</StartupObject>
|
||||
<RootNamespace>DigitalData.Services.EDMService</RootNamespace>
|
||||
<AssemblyName>EDMService</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Console</MyType>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>EDMService.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>EDMService.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Filesystem">
|
||||
<HintPath>..\..\DDMonorepo\Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FirebirdSql.Data.FirebirdClient">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\FirebirdSql.Data.FirebirdClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AppConfig.vb" />
|
||||
<Compile Include="ContainerResult.vb" />
|
||||
<Compile Include="Exceptions.vb" />
|
||||
<Compile Include="Session.vb" />
|
||||
<Compile Include="DatabaseResult.vb" />
|
||||
<Compile Include="EDMService.vb" />
|
||||
<Compile Include="EDMWindowsService.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IEDMService.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="ProjectInstaller.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Request.vb" />
|
||||
<Compile Include="SettingsModule.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ProjectInstaller.resx">
|
||||
<DependentUpon>ProjectInstaller.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="App.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
51
SERVICES/DDEDM_NetworkService/DatabaseResult.vb
Normal file
51
SERVICES/DDEDM_NetworkService/DatabaseResult.vb
Normal file
@@ -0,0 +1,51 @@
|
||||
Imports System.Runtime.Serialization
|
||||
|
||||
<Serializable>
|
||||
<DataContract>
|
||||
Public Class TableResult
|
||||
<DataMember>
|
||||
Public Property OK As Boolean
|
||||
<DataMember>
|
||||
Public Property ErrorMessage As String
|
||||
<DataMember>
|
||||
Public Property Table As DataTable
|
||||
|
||||
Public Sub New(OK As Boolean, Table As DataTable, ErrorMessage As String)
|
||||
Me.OK = OK
|
||||
Me.ErrorMessage = ErrorMessage
|
||||
Me.Table = Table
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
<Serializable>
|
||||
<DataContract>
|
||||
Public Class ScalarResult
|
||||
<DataMember>
|
||||
Public Property OK As Boolean
|
||||
<DataMember>
|
||||
Public Property ErrorMessage As String
|
||||
<DataMember>
|
||||
Public Property Scalar As Object
|
||||
|
||||
Public Sub New(OK As Boolean, Scalar As Object, ErrorMessage As String)
|
||||
Me.OK = OK
|
||||
Me.ErrorMessage = ErrorMessage
|
||||
Me.Scalar = Scalar
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
<Serializable>
|
||||
<DataContract>
|
||||
Public Class NonQueryResult
|
||||
<DataMember>
|
||||
Public Property OK As Boolean
|
||||
<DataMember>
|
||||
Public Property ErrorMessage As String
|
||||
|
||||
Public Sub New(OK As Boolean, ErrorMessage As String)
|
||||
Me.OK = OK
|
||||
Me.ErrorMessage = ErrorMessage
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
195
SERVICES/DDEDM_NetworkService/EDMService.vb
Normal file
195
SERVICES/DDEDM_NetworkService/EDMService.vb
Normal file
@@ -0,0 +1,195 @@
|
||||
Imports System.ServiceModel
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports System.IO
|
||||
Imports DigitalData.Services.EDMService
|
||||
|
||||
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
|
||||
Public Class EDMService
|
||||
Implements IEDMService
|
||||
Implements IDisposable
|
||||
|
||||
Public Shared Event ClientConnectedEvent As EventHandler(Of Session)
|
||||
Public Shared Event ClientDisconnectedEvent As EventHandler(Of Session)
|
||||
|
||||
Public Shared LogConfig As LogConfig
|
||||
Public Shared Database As Firebird
|
||||
Public Shared AppConfig As AppConfig
|
||||
|
||||
Private ReadOnly _session As Session
|
||||
Private ReadOnly _logger As Logger
|
||||
|
||||
Private _request As Request = Nothing
|
||||
Private _debug As Boolean = False
|
||||
|
||||
Public Sub New()
|
||||
Dim oOperationContext As OperationContext = OperationContext.Current
|
||||
Dim oInstanceContext As InstanceContext = oOperationContext.InstanceContext
|
||||
Dim oUsername = oOperationContext.ServiceSecurityContext.WindowsIdentity.Name
|
||||
|
||||
_logger = LogConfig.GetLogger()
|
||||
_session = New Session(oUsername)
|
||||
|
||||
RaiseEvent ClientConnectedEvent(Me, _session)
|
||||
End Sub
|
||||
|
||||
Public Sub Dispose() Implements IDisposable.Dispose
|
||||
RaiseEvent ClientDisconnectedEvent(Me, _session)
|
||||
End Sub
|
||||
|
||||
#Region "Request"
|
||||
Public Function CreateDatabaseRequest(Name As String, Optional Debug As Boolean = False) As String Implements IEDMService.CreateDatabaseRequest
|
||||
_request = New Request(Name, _session.Username, Database, Debug)
|
||||
_debug = Debug
|
||||
|
||||
_logger.Info("Creating request {0}/{1}", _request.Name, _request.RequestId)
|
||||
|
||||
Return _request.Name
|
||||
End Function
|
||||
|
||||
Public Sub CloseDatabaseRequest() Implements IEDMService.CloseDatabaseRequest
|
||||
If IsNothing(_request) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
_logger.Info("Closing request {0}", _request.ToString)
|
||||
_request.Connection.Close()
|
||||
_request = Nothing
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
#Region "Database"
|
||||
Private Sub TestRequestCreated()
|
||||
If IsNothing(_request) Then
|
||||
Throw New Exceptions.NoRequestException()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function ReturnDatatable(SQL As String) As TableResult Implements IEDMService.ReturnDatatable
|
||||
Try
|
||||
TestRequestCreated()
|
||||
|
||||
_logger.Info($"ReturnDatatable, SQL: {SQL}")
|
||||
_request.LogDebug($"ReturnDatatable, SQL: {SQL}")
|
||||
|
||||
Dim oResult As DataTable = Database.GetDatatableWithConnection(SQL, _request.Connection)
|
||||
Return New TableResult(True, oResult, Nothing)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_request.LogError(ex.Message)
|
||||
Return New TableResult(False, Nothing, ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ReturnScalar(SQL As String) As ScalarResult Implements IEDMService.ReturnScalar
|
||||
Try
|
||||
TestRequestCreated()
|
||||
|
||||
_logger.Info($"ReturnScalar, SQL: {SQL}")
|
||||
_request.LogDebug($"ReturnScalar, SQL: {SQL}")
|
||||
|
||||
Dim oResult As Object = Database.GetScalarValueWithConnection(SQL, _request.Connection)
|
||||
Return New ScalarResult(True, oResult, Nothing)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_request.LogError(ex.Message)
|
||||
Return New ScalarResult(False, Nothing, ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ExecuteNonQuery(SQL As String) As NonQueryResult Implements IEDMService.ExecuteNonQuery
|
||||
Try
|
||||
TestRequestCreated()
|
||||
|
||||
_logger.Info($"ExecuteNonQuery, SQL: {SQL}")
|
||||
_request.LogDebug($"ExecuteNonQuery, SQL: {SQL}")
|
||||
|
||||
Dim oResult As Boolean = Database.ExecuteNonQueryWithConnection(SQL, _request.Connection)
|
||||
Return New NonQueryResult(True, Nothing)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_request.LogError(ex.Message)
|
||||
Return New NonQueryResult(False, ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
#Region "FileContainer"
|
||||
Private Function GetFilePath(ContainerId As String) As String
|
||||
Return Path.Combine(AppConfig.ContainerPath, ContainerId & ".enc")
|
||||
End Function
|
||||
Private Sub TestFileExists(ContainerId)
|
||||
Dim oContainerPath = GetFilePath(ContainerId)
|
||||
|
||||
If Not IO.File.Exists(oContainerPath) Then
|
||||
Throw New FileNotFoundException("Container existiert nicht", oContainerPath)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function GetFile(ContainerId As String) As ContainerResult Implements IEDMService.GetFile
|
||||
Try
|
||||
TestFileExists(ContainerId)
|
||||
|
||||
Dim oContainerPath = GetFilePath(ContainerId)
|
||||
Dim oContainer As FileContainer = FileContainer.Load(LogConfig, AppConfig.ContainerPassword, oContainerPath)
|
||||
|
||||
Dim oResult As New ContainerResult With {
|
||||
.Container = oContainer.GetFile()
|
||||
}
|
||||
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return New ContainerResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CreateFile(Contents() As Byte, Extension As String) As String Implements IEDMService.CreateFile
|
||||
Try
|
||||
Dim oContainer As FileContainer = FileContainer.Create(LogConfig, AppConfig.ContainerPassword)
|
||||
Dim oContainerId As String = oContainer.FileId
|
||||
|
||||
oContainer.SetFile(Contents, Extension)
|
||||
oContainer.SaveAs(GetFilePath(oContainerId))
|
||||
|
||||
Return oContainerId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function UpdateFile(FileId As String, Contents() As Byte) As String Implements IEDMService.UpdateFile
|
||||
Try
|
||||
TestFileExists(FileId)
|
||||
|
||||
Dim oFilePath = GetFilePath(FileId)
|
||||
Dim oFileContainer As FileContainer = FileContainer.Load(LogConfig, AppConfig.ContainerPassword, oFilePath)
|
||||
|
||||
oFileContainer.SetFile(Contents, oFileContainer.Extension)
|
||||
oFileContainer.Save()
|
||||
|
||||
Return oFileContainer.FileId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function DeleteFile(FileId As String) As Boolean Implements IEDMService.DeleteFile
|
||||
Try
|
||||
TestFileExists(FileId)
|
||||
|
||||
Dim oFilePath = GetFilePath(FileId)
|
||||
IO.File.Delete(oFilePath)
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
#End Region
|
||||
End Class
|
||||
89
SERVICES/DDEDM_NetworkService/EDMWindowsService.vb
Normal file
89
SERVICES/DDEDM_NetworkService/EDMWindowsService.vb
Normal file
@@ -0,0 +1,89 @@
|
||||
Imports System.ServiceModel
|
||||
Imports System.ServiceProcess
|
||||
Imports System.Configuration
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Database.Exceptions
|
||||
|
||||
Public Class EDMWindowsService
|
||||
Inherits ServiceBase
|
||||
|
||||
Private _serviceHost As ServiceHost = Nothing
|
||||
Private _edmService As EDMService = Nothing
|
||||
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _db As Firebird
|
||||
Private _clientsConnected As Integer = 0
|
||||
Private _clients As New List(Of Session)
|
||||
Private _config As AppConfig
|
||||
|
||||
Public Sub New()
|
||||
ServiceName = SERVICE_NAME
|
||||
End Sub
|
||||
|
||||
Public Shared Sub Main()
|
||||
Run(New EDMWindowsService())
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnStart(ByVal args As String())
|
||||
Try
|
||||
AppConfig.Load()
|
||||
|
||||
_logConfig = New LogConfig(LogConfig.PathType.CustomPath, "E:\EDMService")
|
||||
_logger = _logConfig.GetLogger()
|
||||
|
||||
_logger.Info("Service {0} is starting", SERVICE_DISPLAY_NAME)
|
||||
_logger.Info("Connecting to database")
|
||||
|
||||
_db = New Firebird(
|
||||
_logConfig,
|
||||
AppConfig.FirebirdDataSource,
|
||||
AppConfig.FirebirdDatabase,
|
||||
AppConfig.FirebirdUser,
|
||||
AppConfig.FirebirdPassword
|
||||
)
|
||||
|
||||
_logger.Info("Successfully connected to database!")
|
||||
|
||||
AddHandler EDMService.ClientConnectedEvent, AddressOf EDMService_ClientConnected
|
||||
AddHandler EDMService.ClientDisconnectedEvent, AddressOf EDMService_ClientDisonnected
|
||||
|
||||
EDMService.Database = _db
|
||||
EDMService.LogConfig = _logConfig
|
||||
EDMService.AppConfig = _config
|
||||
|
||||
_logger.Info("Starting the WCF Service")
|
||||
|
||||
_serviceHost = New ServiceHost(GetType(EDMService))
|
||||
_serviceHost.Open()
|
||||
|
||||
_logger.Info("Successfully started the WCF Service!")
|
||||
|
||||
_logger.Info("Service {0} successfully started!", SERVICE_DISPLAY_NAME)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex, "Failed to start the service host!")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub EDMService_ClientDisonnected(sender As Object, e As Session)
|
||||
_clientsConnected -= 1
|
||||
_clients.Remove(e)
|
||||
_logger.Info("Client {0}/{1} disconnected! Total {2}", e.Username, e.SessionId, _clientsConnected)
|
||||
End Sub
|
||||
|
||||
Private Sub EDMService_ClientConnected(sender As Object, e As Session)
|
||||
_clientsConnected += 1
|
||||
_clients.Add(e)
|
||||
_logger.Info("Client {0}/{1} connected! Total {2}", e.Username, e.SessionId, _clientsConnected)
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnStop()
|
||||
If _serviceHost IsNot Nothing Then
|
||||
_serviceHost.Close()
|
||||
_serviceHost = Nothing
|
||||
End If
|
||||
_logger.Info("Service {0} is stopping!", SERVICE_DISPLAY_NAME)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
7
SERVICES/DDEDM_NetworkService/Exceptions.vb
Normal file
7
SERVICES/DDEDM_NetworkService/Exceptions.vb
Normal file
@@ -0,0 +1,7 @@
|
||||
Public Class Exceptions
|
||||
|
||||
Public Class NoRequestException
|
||||
Inherits ApplicationException
|
||||
End Class
|
||||
|
||||
End Class
|
||||
38
SERVICES/DDEDM_NetworkService/IEDMService.vb
Normal file
38
SERVICES/DDEDM_NetworkService/IEDMService.vb
Normal file
@@ -0,0 +1,38 @@
|
||||
Imports System.ServiceModel
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
|
||||
<ServiceContract([Namespace]:="http://DigitalData.Services.EDMService")>
|
||||
Interface IEDMService
|
||||
|
||||
#Region "Database"
|
||||
<OperationContract>
|
||||
Function CreateDatabaseRequest(Name As String, Optional Debug As Boolean = False) As String
|
||||
|
||||
<OperationContract>
|
||||
Sub CloseDatabaseRequest()
|
||||
|
||||
<OperationContract>
|
||||
Function ReturnDatatable(SQL As String) As TableResult
|
||||
|
||||
<OperationContract>
|
||||
Function ReturnScalar(SQL As String) As ScalarResult
|
||||
|
||||
<OperationContract>
|
||||
Function ExecuteNonQuery(SQL As String) As NonQueryResult
|
||||
#End Region
|
||||
|
||||
#Region "FileContainer"
|
||||
<OperationContract>
|
||||
Function CreateFile(Contents As Byte(), Extension As String) As String
|
||||
|
||||
<OperationContract>
|
||||
Function UpdateFile(ContainerId As String, Contents As Byte()) As String
|
||||
|
||||
<OperationContract>
|
||||
Function GetFile(ContainerId As String) As ContainerResult
|
||||
|
||||
<OperationContract>
|
||||
Function DeleteFile(ContainerId As String) As Boolean
|
||||
#End Region
|
||||
|
||||
End Interface
|
||||
13
SERVICES/DDEDM_NetworkService/My Project/Application.Designer.vb
generated
Normal file
13
SERVICES/DDEDM_NetworkService/My Project/Application.Designer.vb
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
10
SERVICES/DDEDM_NetworkService/My Project/Application.myapp
Normal file
10
SERVICES/DDEDM_NetworkService/My Project/Application.myapp
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>2</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
35
SERVICES/DDEDM_NetworkService/My Project/AssemblyInfo.vb
Normal file
35
SERVICES/DDEDM_NetworkService/My Project/AssemblyInfo.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
' die einer Assembly zugeordnet sind.
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("EDMService")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("EDMService")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2018")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("46d157e2-ffc2-4b40-a73b-2fd76aa7049b")>
|
||||
|
||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
'
|
||||
' Hauptversion
|
||||
' Nebenversion
|
||||
' Buildnummer
|
||||
' Revision
|
||||
'
|
||||
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
63
SERVICES/DDEDM_NetworkService/My Project/Resources.Designer.vb
generated
Normal file
63
SERVICES/DDEDM_NetworkService/My Project/Resources.Designer.vb
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
'''<summary>
|
||||
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Services.EDMService.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
SERVICES/DDEDM_NetworkService/My Project/Resources.resx
Normal file
117
SERVICES/DDEDM_NetworkService/My Project/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
73
SERVICES/DDEDM_NetworkService/My Project/Settings.Designer.vb
generated
Normal file
73
SERVICES/DDEDM_NetworkService/My Project/Settings.Designer.vb
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Automatische My.Settings-Speicherfunktion"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.DigitalData.Services.EDMService.My.MySettings
|
||||
Get
|
||||
Return Global.DigitalData.Services.EDMService.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
123
SERVICES/DDEDM_NetworkService/ProjectInstaller.resx
Normal file
123
SERVICES/DDEDM_NetworkService/ProjectInstaller.resx
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
24
SERVICES/DDEDM_NetworkService/ProjectInstaller.vb
Normal file
24
SERVICES/DDEDM_NetworkService/ProjectInstaller.vb
Normal file
@@ -0,0 +1,24 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Configuration.Install
|
||||
Imports System.ServiceProcess
|
||||
|
||||
<RunInstaller(True)>
|
||||
Public Class ProjectInstaller
|
||||
Inherits Installer
|
||||
|
||||
Private ReadOnly process As ServiceProcessInstaller
|
||||
Private ReadOnly components As IContainer
|
||||
Private ReadOnly service As ServiceInstaller
|
||||
|
||||
Public Sub New()
|
||||
process = New ServiceProcessInstaller With {
|
||||
.Account = ServiceAccount.NetworkService
|
||||
}
|
||||
service = New ServiceInstaller With {
|
||||
.ServiceName = SERVICE_NAME,
|
||||
.DisplayName = SERVICE_DISPLAY_NAME
|
||||
}
|
||||
Installers.Add(process)
|
||||
Installers.Add(service)
|
||||
End Sub
|
||||
End Class
|
||||
40
SERVICES/DDEDM_NetworkService/Request.vb
Normal file
40
SERVICES/DDEDM_NetworkService/Request.vb
Normal file
@@ -0,0 +1,40 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports FirebirdSql.Data.FirebirdClient
|
||||
|
||||
Public Class Request
|
||||
Public Name As String
|
||||
Public Username As String
|
||||
Public RequestId As String
|
||||
Public Connection As FbConnection
|
||||
Public Database As Firebird
|
||||
Public Debug As Boolean
|
||||
|
||||
Public Sub New(Name As String, Username As String, Database As Firebird, Debug As Boolean)
|
||||
Me.Username = Username
|
||||
Me.Name = Name
|
||||
Me.RequestId = Guid.NewGuid().ToString()
|
||||
Me.Connection = Database.GetConnection()
|
||||
Me.Database = Database
|
||||
Me.Debug = Debug
|
||||
|
||||
Dim oSql = $"INSERT INTO TBEDM_REQUEST_USER (REQUEST_GUID, USER_NAME) VALUES ('{RequestId}', '{Username}')"
|
||||
|
||||
Database.ExecuteNonQueryWithConnection(oSql, Connection)
|
||||
End Sub
|
||||
|
||||
Public Sub LogDebug(Message As String)
|
||||
If Debug Then
|
||||
Dim oSqlCommand = $"INSERT INTO TBEDM_REQUEST_LOG (REQUEST_GUID, LOG_MSG, DEBUG) VALUES ('{RequestId}','{Message}', True)"
|
||||
Database.ExecuteNonQueryWithConnection(oSqlCommand, Connection)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub LogError(Message As String)
|
||||
Dim oSqlCommand = $"INSERT INTO TBEDM_REQUEST_LOG (REQUEST_GUID, LOG_MSG, ERROR) VALUES ('{RequestId}','{Message}', True)"
|
||||
Database.ExecuteNonQueryWithConnection(oSqlCommand, Connection)
|
||||
End Sub
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"<Name={Name},RequestId={RequestId}>"
|
||||
End Function
|
||||
End Class
|
||||
9
SERVICES/DDEDM_NetworkService/Session.vb
Normal file
9
SERVICES/DDEDM_NetworkService/Session.vb
Normal file
@@ -0,0 +1,9 @@
|
||||
Public Class Session
|
||||
Public Username As String
|
||||
Public SessionId As String
|
||||
|
||||
Public Sub New(username As String)
|
||||
Me.Username = username
|
||||
Me.SessionId = Guid.NewGuid.ToString
|
||||
End Sub
|
||||
End Class
|
||||
4
SERVICES/DDEDM_NetworkService/SettingsModule.vb
Normal file
4
SERVICES/DDEDM_NetworkService/SettingsModule.vb
Normal file
@@ -0,0 +1,4 @@
|
||||
Module SettingsModule
|
||||
Public Const SERVICE_NAME As String = "DDEDMSvc"
|
||||
Public Const SERVICE_DISPLAY_NAME As String = "Digital Data EDM Service"
|
||||
End Module
|
||||
Reference in New Issue
Block a user