Class EbicsFileSpoolerFolder

Namespace
Subsembly.EBICS
Assembly
Subsembly.EBICS.Core.dll

Root folder and organizer of a EbicsFileSpooler storage folder tree.

public class EbicsFileSpoolerFolder : EbicsFileFolder
Inheritance
EbicsFileSpoolerFolder
Inherited Members

Remarks

Starting at a given root folder, the EbicsFileSpooler maintains sub-folders for each EBICS Host ID. In every Host ID folder another folder is created for each EBICS Partner ID. Inside of the partner folder the following folders are maintained to manage uploads and downloads:

pathdescription
BOX_CAMT053 This folder receives the unzipped and maybe converted CAMT 053 Customer Statement downloads. By strictly enforcing the EbicsFileName convention, every file is uniquely identified and there will not be any duplicate data.
BOX_CAMT052 This folder receives the unzipped and maybe converted CAMT 052 Customer Account Report downloads. By strictly enforcing the EbicsFileName convention, every file is uniquely identified and there will not be any duplicate data.
BOX_CAMT054 This folder receives the unzipped and maybe converted CAMT 054 Customer Debit/Credit Notification downloads. By strictly enforcing the EbicsFileName convention, every file is uniquely identified and there will not be any duplicate data.
BOX_DOCS This folder receives the unzipped documents that were received by an EBICS document download (BKA, BKI, or other). The bank supplied file names must be unique, as the file name is used to avoid duplicates.
BOX_OUTBOX

Files that shall be uploaded to the EBICS server must be placed in this folder. The file name must obey the EbicsFileName convention. In particular, the order type contained in the file name is used as the upload order type for this file. The additional data must contain a unique serial number so that all file names are unique.

After a file was uploaded, or attempted to be uploaded, it is renamed with a special file name prefix that shows the business return code of the EBICS transaction. In addition a result file with a leading dot followed by the base file name and the file name suffix .result is created which contains the XML from the EbicsFileTransferResult that was returned from the UploadFile(EbicsContact, IEbicsSecurityMedium, string, string, EbicsAuthorisationLevel).

Constructors

EbicsFileSpoolerFolder(string, EbicsFileSpoolerCredentials)

public EbicsFileSpoolerFolder(string sSpoolerFolder, EbicsFileSpoolerCredentials aUserCredentials = null)

Parameters

sSpoolerFolder string

Complete, rooted file path of the root spooler folder. This must not be null, and must refer to an existing file system folder.

aUserCredentials EbicsFileSpoolerCredentials

In a protected and encrypted spooler folder tree, these must be the credentials of the user, that wants access to the EbicsFileSpoolerFolder and its files. If given, then its properties UserName and Password must not be null.

Exceptions

ArgumentNullException

The parameter sSpoolerFolder was null.

ArgumentException

The given aUserCredentials did not contain a UserName and Password.

See Also

Fields

BOX_CAMT052

The name of the CAMT052 folder is "camt052".

public const string BOX_CAMT052 = "camt052"

Field Value

string

BOX_CAMT053

The name of the CAMT053 folder is "camt053".

public const string BOX_CAMT053 = "camt053"

Field Value

string

BOX_CAMT054

The name of the CAMT054 folder is "camt054".

public const string BOX_CAMT054 = "camt054"

Field Value

string

BOX_DOCS

The name of the DOCS folder is "docs".

public const string BOX_DOCS = "docs"

Field Value

string

BOX_OUTBOX

The name of the OUTBOX folder is "outbox".

public const string BOX_OUTBOX = "outbox"

Field Value

string

RESULTFILENAMESUFFIX

This suffix is appended to the original file name in order to produce a file name for storing the EbicsFileTransferResult of this file.

public const string RESULTFILENAMESUFFIX = ".result"

Field Value

string

ROOT

The constant user name of the root user is "root".

public const string ROOT = "root"

Field Value

string

Properties

IsProtected

Indicates whether this EbicsFileSpooler instance is using Access Control with encrypted files.

public bool IsProtected { get; }

Property Value

bool

Methods

AddAccessControlEntry(EbicsFileFolder, EbicsFileSpoolerCredentials)

public EbicsFileSpoolerAccessControlEntry AddAccessControlEntry(EbicsFileFolder aFileFolder, EbicsFileSpoolerCredentials aUserCredentials)

Parameters

aFileFolder EbicsFileFolder
aUserCredentials EbicsFileSpoolerCredentials

Returns

EbicsFileSpoolerAccessControlEntry

AppendOkay(string, string, EbicsFileSpoolerResult)

public void AppendOkay(string sHostID, string sPartnerID, EbicsFileSpoolerResult aSpoolerResult)

Parameters

sHostID string
sPartnerID string
aSpoolerResult EbicsFileSpoolerResult

CreateAccessControlEntry(EbicsFileFolder, EbicsFileSpoolerCredentials)

Creates a new EbicsFileSpoolerAccessControlEntry that enables an user to access the given file folder.

public EbicsFileSpoolerAccessControlEntry CreateAccessControlEntry(EbicsFileFolder aFileFolder, EbicsFileSpoolerCredentials aUserCredentials)

Parameters

aFileFolder EbicsFileFolder
aUserCredentials EbicsFileSpoolerCredentials

The credentials of the new user to create an access control entry for.

Returns

EbicsFileSpoolerAccessControlEntry

Remarks

This EbicsFileSpooler instance must have been created by the "root" user, in order to use this method.

The returned EbicsFileSpoolerAccessControlEntry was not saved or added to an access control list. It is up to the caller to obtain the correct access control list via ObtainAccessControlList(EbicsFileFolder), add the new entry, and finally call UpdateAccessControlList(EbicsFileFolder, EbicsFileSpoolerAccessControlList).

See Also

GetBoxFolder(string, string, string, bool)

public EbicsFileFolder GetBoxFolder(string sHostID, string sPartnerID, string sBoxName, bool fCreate)

Parameters

sHostID string
sPartnerID string
sBoxName string
fCreate bool

Returns

EbicsFileFolder

GetCamt052Folder(string, string)

public EbicsFileFolder GetCamt052Folder(string sHostID, string sPartnerID)

Parameters

sHostID string
sPartnerID string

Returns

EbicsFileFolder

GetCamt053Folder(string, string)

public EbicsFileFolder GetCamt053Folder(string sHostID, string sPartnerID)

Parameters

sHostID string
sPartnerID string

Returns

EbicsFileFolder

GetCamt054Folder(string, string)

public EbicsFileFolder GetCamt054Folder(string sHostID, string sPartnerID)

Parameters

sHostID string
sPartnerID string

Returns

EbicsFileFolder

GetContactFolder()

Creates an IEbicsContactFolder implementation according to the configuration.

public IEbicsContactFolder GetContactFolder()

Returns

IEbicsContactFolder

Remarks

If a SUBSEMBLY_EBICS_CONTACTFOLDERPATH is configured, then it will take precedence over the EbicsFileSpoolerContactFolder and thus will be returned. If there is no explicitly configured ContactFolderPath, then a EbicsFileSpoolerContactFolder instance for this spooler folder will be returned.

GetDocsFolder(string, string)

public EbicsFileFolder GetDocsFolder(string sHostID, string sPartnerID)

Parameters

sHostID string
sPartnerID string

Returns

EbicsFileFolder

GetFolder(string, bool)

public EbicsFileFolder GetFolder(string sPath, bool fCreate)

Parameters

sPath string

The relative path from the root spooler folder. If this is null, then the root folder path is returned. This path must have been built according to local file system requirements.

fCreate bool

Returns

EbicsFileFolder

GetHostFolders()

public EbicsFileFolder[] GetHostFolders()

Returns

EbicsFileFolder[]

GetJournalEntry(string, string, EbicsFileName)

public EbicsFileSpoolerJournalEntry GetJournalEntry(string sHostID, string sPartnerID, EbicsFileName aFileName)

Parameters

sHostID string
sPartnerID string
aFileName EbicsFileName

Returns

EbicsFileSpoolerJournalEntry

GetLastOkay(string, string)

public EbicsFileSpoolerResult GetLastOkay(string sHostID, string sPartnerID)

Parameters

sHostID string
sPartnerID string

Returns

EbicsFileSpoolerResult

GetOutboxFolder(string, string)

public EbicsFileFolder GetOutboxFolder(string sHostID, string sPartnerID)

Parameters

sHostID string
sPartnerID string

Returns

EbicsFileFolder

GetPartnerFolder(string, string, bool)

public EbicsFileFolder GetPartnerFolder(string sHostID, string sPartnerID, bool fCreate)

Parameters

sHostID string
sPartnerID string
fCreate bool

Returns

EbicsFileFolder

GetPartnerFolders(string)

public EbicsFileFolder[] GetPartnerFolders(string sHostID)

Parameters

sHostID string

Returns

EbicsFileFolder[]

HasAccess(EbicsFileFolder)

Indicates whether this instance has access to the requested folder, with the credentials that were given to the ctor.

public bool HasAccess(EbicsFileFolder aFileFolder)

Parameters

aFileFolder EbicsFileFolder

Returns

bool

LoadOrderResult(string, string, EbicsFileName)

public EbicsFileTransferResult LoadOrderResult(string sHostID, string sPartnerID, EbicsFileName aFileName)

Parameters

sHostID string
sPartnerID string
aFileName EbicsFileName

Returns

EbicsFileTransferResult

ObtainAccessControlList(EbicsFileFolder)

Loads or creates an EbicsFileSpoolerAccessControlList for the given folder.

public EbicsFileSpoolerAccessControlList ObtainAccessControlList(EbicsFileFolder aFileFolder)

Parameters

aFileFolder EbicsFileFolder

Returns

EbicsFileSpoolerAccessControlList

OpenRead(EbicsFileFolder, EbicsFileName)

public Stream OpenRead(EbicsFileFolder aFileFolder, EbicsFileName aFileName)

Parameters

aFileFolder EbicsFileFolder
aFileName EbicsFileName

Name of the file in this folder that shall be opened. This must not be null and must refer to an actually existing file. The properties IsHidden and IsEncrypted must have been set to match the actual file.

Returns

Stream

If the file was opened successfully, then a non-seekable read-only Stream from it is returned. If the file is encrypted, then the returned Stream will decrypt the content on-thy-fly.

Remarks

The file is always opened with exclusive, non-shared access.

OpenRead(EbicsFileFolder, string, bool)

public Stream OpenRead(EbicsFileFolder aFileFolder, string sFileName, bool fIsEncrypted)

Parameters

aFileFolder EbicsFileFolder
sFileName string

The file system file name without any path information. The location of the file is given by the aFileFolder parameter.

fIsEncrypted bool

If this is true, then the file is assumed to be encrypted.

Returns

Stream

OpenWrite(EbicsFileFolder, EbicsFileName)

public Stream OpenWrite(EbicsFileFolder aFileFolder, EbicsFileName aFileName)

Parameters

aFileFolder EbicsFileFolder
aFileName EbicsFileName

Name of the file in this folder that shall be created. This must not be null. If this refers to an existing file, then it will be overwritten. Regardless of the current value of the property IsEncrypted, the file will be encrypted if, and only if, the property IsProtected is true.

Returns

Stream

If the file was opened successfully, then a non-seekable write-only Stream to it is returned. If the file is encrypted, then the returned Stream will encrypt the content on-thy-fly.

Remarks

The file is always opened with exclusive, non-shared access.

OpenWrite(EbicsFileFolder, string, bool)

public Stream OpenWrite(EbicsFileFolder aFileFolder, string sFileName, bool fIsEncrypted)

Parameters

aFileFolder EbicsFileFolder
sFileName string

The file system file name without any path information. The location of the file is given by the aFileFolder parameter.

fIsEncrypted bool

If this is true, then the file will be encrypted.

Returns

Stream

If the file was opened successfully, then a non-seekable write-only Stream to it is returned. If the file is encrypted, then the returned Stream will encrypt the content on-thy-fly.

Remarks

The file is always opened with exclusive, non-shared access.

SetupAccessControl(EbicsFileSpoolerCredentials)

Sets up full access control for a currently unprotected EbicsFileSpooler spooler folder.

public void SetupAccessControl(EbicsFileSpoolerCredentials aRootCredentials)

Parameters

aRootCredentials EbicsFileSpoolerCredentials

The root credentials. The UserName must be ROOT, and the Password must not be null.

Remarks

Setting up access protection DOES NOT encrypt any existing files in the spooler folder tree. Only new files that are added to the spooler folders are encrypted and protected.

Successfully setting up access control implicitly switches this EbicsFileSpooler to use the given root access for all subsequent operations. Hence, it is possible to immediately set up users via CreateAccessControlEntry(EbicsFileFolder, EbicsFileSpoolerCredentials) after the method returns.

Setting up access control is not thread synchronised and therefore the caller must ensure that it is not called from multiple threads.

Exceptions

InvalidOperationException

File access control was already established, or this EbicsFileSpooler instance was already created with user credentials.

SubmitFileUpload(string, string, string, string, string)

Copies a file into the BOX_OUTBOX folder for uploading by the spooler.

public EbicsFileName SubmitFileUpload(string sHostID, string sPartnerID, string sSourceFilePath, string sOrderType, string sFileId = null)

Parameters

sHostID string
sPartnerID string
sSourceFilePath string

Full path to file that shall be uploaded to the server. This file must exist outside of the spooler folder. It will be copied into the BOX_OUTBOX with a new file name, generated from the sOrderType and the sFileId. The file name extension of the source file will also be used for the file copied into the BOX_OUTBOX.

sOrderType string

The EBICS OrderType that shall be used to upload the file.

sFileId string

Optional file ID that will be used to generate a unique file name. If this is null then a unique time stamp will be used to create a unqiue file ID.

Returns

EbicsFileName

Returns the EbicsFileName of the order file that was created in the BOX_OUTBOX folder.

Exceptions

ArgumentNullException

One of the required parameters was null.

EbicsFileSpoolerException

The BOX_OUTBOX folder is currently locked by another process.

SubmitSepaUpload(string, string, SepaDocument)

Writes the given SEPA payment initiation document into the BOX_OUTBOX folder for uploading by the spooler.

public EbicsFileName SubmitSepaUpload(string sHostID, string sPartnerID, SepaDocument aSepaDocument)

Parameters

sHostID string
sPartnerID string
aSepaDocument SepaDocument

Returns

EbicsFileName

Returns the EbicsFileName of the order file that was created in the BOX_OUTBOX folder.

Exceptions

ArgumentNullException

One of the parameters was null.

ArgumentException

One of the parameters was invalid.

EbicsFileSpoolerException

The BOX_OUTBOX folder is currently locked by another process.

UpdateAccessControlList(EbicsFileFolder, EbicsFileSpoolerAccessControlList)

Rewrites the complete access control list file into the given folder.

public void UpdateAccessControlList(EbicsFileFolder aFileFolder, EbicsFileSpoolerAccessControlList aAccessControlList)

Parameters

aFileFolder EbicsFileFolder
aAccessControlList EbicsFileSpoolerAccessControlList

An access control list that must have been previously obtained through ObtainAccessControlList(EbicsFileFolder).