MONSTER: Rename Monorepo to Modules, only keep Projects under Modules.*
This commit is contained in:
64
EDMIAPI/Client/Channel.vb
Normal file
64
EDMIAPI/Client/Channel.vb
Normal file
@@ -0,0 +1,64 @@
|
||||
Imports System.ServiceModel
|
||||
Imports System.Xml
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Channel
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly ChannelFactory As ChannelFactory(Of IEDMIServiceChannel)
|
||||
|
||||
Public Event Reconnect As EventHandler
|
||||
|
||||
Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding
|
||||
Return New NetTcpBinding() With {
|
||||
.MaxReceivedMessageSize = Constants.ChannelSettings.MAX_RECEIVED_MESSAGE_SIZE,
|
||||
.MaxBufferSize = Constants.ChannelSettings.MAX_BUFFER_SIZE,
|
||||
.MaxBufferPoolSize = Constants.ChannelSettings.MAX_BUFFER_POOL_SIZE,
|
||||
.TransferMode = TransferMode.Streamed,
|
||||
.Security = New NetTcpSecurity() With {
|
||||
.Mode = SecurityMode.Transport,
|
||||
.Transport = New TcpTransportSecurity() With {
|
||||
.ClientCredentialType = AuthenticationMode
|
||||
}
|
||||
},
|
||||
.ReaderQuotas = New XmlDictionaryReaderQuotas() With {
|
||||
.MaxArrayLength = Constants.ChannelSettings.MAX_ARRAY_LENGTH,
|
||||
.MaxStringContentLength = Constants.ChannelSettings.MAX_STRING_CONTENT_LENGTH
|
||||
}
|
||||
}
|
||||
End Function
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pServerAddress As ServerAddressStruct)
|
||||
MyBase.New(pLogConfig)
|
||||
ChannelFactory = GetChannelFactory(pServerAddress)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Creates a channel and adds a Faulted-Handler
|
||||
''' </summary>
|
||||
''' <returns>A channel object</returns>
|
||||
Public Function GetChannel() As IEDMIServiceChannel
|
||||
Try
|
||||
Logger.Debug("Creating channel.")
|
||||
Dim oChannel = ChannelFactory.CreateChannel()
|
||||
|
||||
AddHandler oChannel.Faulted, Sub() RaiseEvent Reconnect(Me, Nothing)
|
||||
|
||||
Return oChannel
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetChannelFactory(pServerAddress As ServerAddressStruct) As ChannelFactory(Of IEDMIServiceChannel)
|
||||
Dim oBinding = GetBinding()
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{pServerAddress.Host}:{pServerAddress.Port}/DigitalData/Services/Main")
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
Return oFactory
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
31
EDMIAPI/Client/Connection.vb
Normal file
31
EDMIAPI/Client/Connection.vb
Normal file
@@ -0,0 +1,31 @@
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Connection
|
||||
Public Function ParseServiceAddress(pHost As String, pPort As Integer) As ServerAddressStruct
|
||||
Dim oAddress As ServerAddressStruct
|
||||
|
||||
oAddress.Host = pHost
|
||||
oAddress.Port = pPort
|
||||
|
||||
Return oAddress
|
||||
End Function
|
||||
|
||||
Public Function ParseServiceAddress(pAddress As String) As ServerAddressStruct
|
||||
Dim oAddressList As List(Of String)
|
||||
Dim oAddress As ServerAddressStruct
|
||||
|
||||
If pAddress.Contains(";"c) Then
|
||||
oAddressList = pAddress.Split(";"c).ToList
|
||||
ElseIf pAddress.Contains(":"c) Then
|
||||
oAddressList = pAddress.Split(":"c).ToList
|
||||
Else
|
||||
oAddressList = New List(Of String) From {pAddress, Constants.DEFAULT_SERVICE_PORT}
|
||||
End If
|
||||
|
||||
oAddress.Host = oAddressList.First()
|
||||
oAddress.Port = oAddressList.Item(1)
|
||||
|
||||
Return oAddress
|
||||
End Function
|
||||
End Class
|
||||
11
EDMIAPI/Client/NewFile.vb
Normal file
11
EDMIAPI/Client/NewFile.vb
Normal file
@@ -0,0 +1,11 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class NewFile
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly Logger As Logger
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
LogConfig = pLogConfig
|
||||
Logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
End Class
|
||||
78
EDMIAPI/Client/Options.vb
Normal file
78
EDMIAPI/Client/Options.vb
Normal file
@@ -0,0 +1,78 @@
|
||||
Public Class Options
|
||||
|
||||
Public MustInherit Class BaseOptions
|
||||
''' <summary>
|
||||
''' Windows username of the user responsible for the request. Defaults to the currently logged in user.
|
||||
''' </summary>
|
||||
Public Property Username As String = Environment.UserName
|
||||
|
||||
''' <summary>
|
||||
''' Language code of the client responsible for the request. Defaults to the language of the current client.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Property Language As String = Threading.Thread.CurrentThread.CurrentUICulture.Name
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
''' Import options for NewFileAsync.
|
||||
''' </summary>
|
||||
Public Class NewFileOptions
|
||||
Inherits BaseOptions
|
||||
|
||||
''' <summary>
|
||||
''' Date when the file was imported. Can be in the past. Defaults to now.
|
||||
''' </summary>
|
||||
Public Property DateImported As Date = Date.Now
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
''' Import options for NewFileAsync.
|
||||
''' </summary>
|
||||
Public Class CheckOutInOptions
|
||||
Inherits BaseOptions
|
||||
End Class
|
||||
|
||||
Public Class UpdateFileOptions
|
||||
Inherits BaseOptions
|
||||
|
||||
''' <summary>
|
||||
''' Should the changes in the file result in a new version? Otherwise the old file will be overridden.
|
||||
''' </summary>
|
||||
Public Property CreateNewFileVersion As Boolean = False
|
||||
End Class
|
||||
|
||||
Public Class ImportFileOptions
|
||||
Inherits BaseOptions
|
||||
|
||||
''' <summary>
|
||||
''' Date when the file was imported. Can be in the past. Defaults to now.
|
||||
''' </summary>
|
||||
Public Property DateImported As Date = Date.Now
|
||||
End Class
|
||||
|
||||
Public Class SetObjectStateOptions
|
||||
Inherits BaseOptions
|
||||
|
||||
''' <summary>
|
||||
''' Date when the file was imported. Can be in the past. Defaults to now.
|
||||
''' </summary>
|
||||
Public Property DateImported As Date = Date.Now
|
||||
End Class
|
||||
|
||||
Public Class SetAttributeValueOptions
|
||||
Inherits BaseOptions
|
||||
End Class
|
||||
|
||||
|
||||
Public Class GetVariableValueOptions
|
||||
Inherits BaseOptions
|
||||
End Class
|
||||
|
||||
Public Class SetVariableValueOptions
|
||||
Inherits BaseOptions
|
||||
End Class
|
||||
|
||||
Public Class NewObjectOptions
|
||||
Inherits BaseOptions
|
||||
End Class
|
||||
End Class
|
||||
7
EDMIAPI/Client/Rights.vb
Normal file
7
EDMIAPI/Client/Rights.vb
Normal file
@@ -0,0 +1,7 @@
|
||||
Public Class Rights
|
||||
Public Enum AccessRight
|
||||
VIEW_ONLY = 1
|
||||
VIEW_EXPORT = 2
|
||||
FULL = 4
|
||||
End Enum
|
||||
End Class
|
||||
4
EDMIAPI/Client/ServerAddressStruct.vb
Normal file
4
EDMIAPI/Client/ServerAddressStruct.vb
Normal file
@@ -0,0 +1,4 @@
|
||||
Public Structure ServerAddressStruct
|
||||
Public Host As String
|
||||
Public Port As Integer
|
||||
End Structure
|
||||
Reference in New Issue
Block a user