create directory on import, version filename
This commit is contained in:
@@ -1,5 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<!-- FIREBIRD SETTINGS -->
|
||||
<add key="FIREBIRD_DATASOURCE" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_NAME" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_USER" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_PASS" value=""/>
|
||||
<!-- END FIREBIRD SETTINGS -->
|
||||
|
||||
<!-- DATASTORE SETTINGS -->
|
||||
<add key="DATASTORE_PATH" value=""/>
|
||||
<!-- END DATASTORE SETTINGS -->
|
||||
|
||||
<!-- CONTAINER SETTINGS -->
|
||||
<add key="CONTAINER_PATH" value=""/>
|
||||
<add key="CONTAINER_PASSWORD" value=""/>
|
||||
<!-- END CONTAINER SETTINGS -->
|
||||
</appSettings>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<source name="System.ServiceModel" switchValue="Information,ActivityTracing" propagateActivity="true">
|
||||
@@ -18,23 +35,6 @@
|
||||
</sharedListeners>
|
||||
<trace autoflush="true"/>
|
||||
</system.diagnostics>
|
||||
<appSettings>
|
||||
<!-- FIREBIRD SETTINGS -->
|
||||
<add key="FIREBIRD_DATASOURCE" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_NAME" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_USER" value=""/>
|
||||
<add key="FIREBIRD_DATABASE_PASS" value=""/>
|
||||
<!-- END FIREBIRD SETTINGS -->
|
||||
|
||||
<!-- DATASTORE SETTINGS -->
|
||||
<add key="DATASTORE_PATH" value=""/>
|
||||
<!-- END DATASTORE SETTINGS -->
|
||||
|
||||
<!-- CONTAINER SETTINGS -->
|
||||
<add key="CONTAINER_PATH" value=""/>
|
||||
<add key="CONTAINER_PASSWORD" value=""/>
|
||||
<!-- END CONTAINER SETTINGS -->
|
||||
</appSettings>
|
||||
<system.serviceModel>
|
||||
<diagnostics wmiProviderEnabled="true">
|
||||
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtTransportLevel="true"/>
|
||||
@@ -42,21 +42,27 @@
|
||||
</diagnostics>
|
||||
<bindings>
|
||||
<netTcpBinding>
|
||||
<binding name="tcpBinding" sendTimeout="00:10:00" transferMode="Buffered" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
|
||||
<binding name="tcpBinding"
|
||||
sendTimeout="00:10:00"
|
||||
transferMode="Buffered"
|
||||
maxBufferSize="10000000"
|
||||
maxBufferPoolSize="40000000"
|
||||
maxReceivedMessageSize="1000000000">
|
||||
<readerQuotas
|
||||
maxDepth="32"
|
||||
maxStringContentLength="2147483647"
|
||||
maxArrayLength="2147483647"
|
||||
maxBytesPerRead="2147483647"
|
||||
maxNameTableCharCount="2147483647"/>
|
||||
<security mode="None">
|
||||
<transport clientCredentialType="None"/>
|
||||
<transport clientCredentialType="Windows"/>
|
||||
</security>
|
||||
</binding>
|
||||
</netTcpBinding>
|
||||
</bindings>
|
||||
<services>
|
||||
<service behaviorConfiguration="DefaultServiceBehavior" name="DigitalData.Services.EDMIService.EDMIService">
|
||||
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpBinding" name="tcpBinding" contract="DigitalData.Services.EDMIService.IEDMIService">
|
||||
<identity>
|
||||
<dns value="localhost"/>
|
||||
</identity>
|
||||
</endpoint>
|
||||
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpBinding" name="tcpBinding" contract="DigitalData.Services.EDMIService.IEDMIService" />
|
||||
<endpoint address="mex" binding="mexTcpBinding" name="MexTcpBinding" contract="IMetadataExchange"/>
|
||||
<host>
|
||||
<baseAddresses>
|
||||
|
||||
@@ -4,6 +4,8 @@ Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports DigitalData.Modules
|
||||
Imports System.IO
|
||||
Imports System.ServiceModel.Description
|
||||
Imports System.ServiceModel.Channels
|
||||
|
||||
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
|
||||
Public Class EDMIService
|
||||
@@ -12,6 +14,7 @@ Public Class EDMIService
|
||||
Public Shared LogConfig As LogConfig
|
||||
Public Shared Database As Firebird
|
||||
Public Shared AppConfig As AppConfig
|
||||
Public Shared Filesystem As Filesystem.File
|
||||
Public Shared EDMIPath As EDMI.File.Path
|
||||
Public Shared EDMIArchive As EDMI.File.Archive
|
||||
|
||||
@@ -298,18 +301,28 @@ Public Class EDMIService
|
||||
#Region "Document"
|
||||
Public Function ImportFile(FileInfo As FileInfo, Contents() As Byte, [Readonly] As Boolean, RetentionPeriod As Integer) As DocumentResult2 Implements IEDMIService.ImportFile
|
||||
Dim oDocumentType As String = "DummyDocumentType"
|
||||
Dim oFilePath = Path.Combine(EDMIPath.GetActivePath(oDocumentType), FileInfo.Name)
|
||||
Dim oDirectoryPath = EDMIPath.GetActivePath(oDocumentType)
|
||||
Dim oFilePath = Path.Combine(oDirectoryPath, FileInfo.Name)
|
||||
Dim oDocument = New DocumentResult2.DocumentObject() With {.FileName = FileInfo.Name}
|
||||
|
||||
Try
|
||||
_logger.Info("Saving file [{0}] to path [{1}]", FileInfo.Name, oFilePath)
|
||||
Using oStream = New FileStream(oFilePath, FileMode.CreateNew)
|
||||
Directory.CreateDirectory(oDirectoryPath)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return New DocumentResult2(ex.Message)
|
||||
End Try
|
||||
|
||||
Try
|
||||
Dim oVersionedFileName As String = Filesystem.GetVersionedFilename(oFilePath)
|
||||
|
||||
_logger.Info("Saving file [{0}] to path [{1}]", FileInfo.Name, oVersionedFileName)
|
||||
Using oStream = New FileStream(oVersionedFileName, FileMode.CreateNew)
|
||||
oStream.Write(Contents, 0, Contents.Length)
|
||||
oStream.Flush(True)
|
||||
oStream.Close()
|
||||
End Using
|
||||
|
||||
EDMIArchive.SetRetention(oFilePath, RetentionPeriod, [Readonly])
|
||||
EDMIArchive.SetRetention(oVersionedFileName, RetentionPeriod, [Readonly])
|
||||
|
||||
Return New DocumentResult2(oDocument)
|
||||
Catch ex As Exception
|
||||
|
||||
@@ -170,6 +170,10 @@
|
||||
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.EDMIAPI\EDMI.API.vbproj">
|
||||
<Project>{25017513-0d97-49d3-98d7-ba76d9b251b0}</Project>
|
||||
<Name>EDMI.API</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Filesystem\Filesystem.vbproj">
|
||||
<Project>{991D0231-4623-496D-8BD0-9CA906029CBC}</Project>
|
||||
<Name>Filesystem</Name>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Imports System.ServiceModel
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
|
||||
<ServiceContract([Namespace]:="http://DigitalData.Services.EDMIService")>
|
||||
<ServiceContract(Name:="IEDMIService", [Namespace]:="http://DigitalData.Services.EDMIService")>
|
||||
Interface IEDMIService
|
||||
|
||||
#Region "Heartbeat"
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports System.ServiceProcess
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules
|
||||
Imports System.ServiceModel.Description
|
||||
|
||||
Public Class WindowsService
|
||||
Inherits ServiceBase
|
||||
@@ -17,6 +18,7 @@ Public Class WindowsService
|
||||
Private _config As AppConfig
|
||||
Private _Path As EDMI.File.Path
|
||||
Private _Archive As EDMI.File.Archive
|
||||
Private _filesystem As Filesystem.File
|
||||
|
||||
Public Sub New()
|
||||
ServiceName = SERVICE_NAME
|
||||
@@ -53,6 +55,7 @@ Public Class WindowsService
|
||||
|
||||
_Path = New EDMI.File.Path(_logConfig, AppConfig.DatastorePath)
|
||||
_Archive = New EDMI.File.Archive(_logConfig)
|
||||
_filesystem = New Filesystem.File(_logConfig)
|
||||
|
||||
_logger.Debug("EDMI Functions initialized.")
|
||||
|
||||
@@ -61,6 +64,7 @@ Public Class WindowsService
|
||||
EDMIService.AppConfig = _config
|
||||
EDMIService.EDMIArchive = _Archive
|
||||
EDMIService.EDMIPath = _Path
|
||||
EDMIService.Filesystem = _filesystem
|
||||
|
||||
_logger.Debug("Starting WCF ServiceHost...")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user