Skip to main content

EnsLib.FTP.OutboundAdapter

class EnsLib.FTP.OutboundAdapter extends Ens.OutboundAdapter, EnsLib.FTP.Common, EnsLib.File.Common

Property Inventory

Method Inventory

Parameters

parameter SETTINGS = RegistryID:Basic:selector?context={Ens.ServiceRegistry.External.ContextSearch/Services?Protocols_1=FTP},Overwrite,SFTPAppendMode:SFTP;
These properties can be configured or set by the associated Business Operation

Properties

property Charset as %String [ InitialExpression = "Binary" ];
FTP - Use the named Character encoding to translate characters from the file.
A * prepended to any of the charset names will cause a binary FTP transfer with the resulting data then translated using the specified encoding.
Note that Binary should be chosen for binary files and other cases when special characters such as line terminators must be preserved.
Other settings may be useful when transferring text documents via FTP.

Choices include:
Binary - binary transfer
Ascii - Ascii mode FTP transfer but no character encoding translation
Native - the default character encoding of the installed locale of the Ensemble server
latin1 - the ISO Latin1 8-bit encoding
ISO-8859-1 - the ISO Latin1 8-bit encoding
UTF-8 - the Unicode 8-bit encoding
Unicode - the Unicode 16-bit encoding (Little-Endian)
UnicodeBig - the Unicode 16-bit encoding (Big-Endian)
@<ttable> - <ttable> means a raw InterSystems character translation table name. A prefix of '@' means to use the named table.

Property methods: CharsetDisplayToLogical(), CharsetGet(), CharsetIsValid(), CharsetLogicalToDisplay(), CharsetLogicalToOdbc(), CharsetNormalize()
property FilePath as %String (MAXLEN = 1000) [ Required ];
Directory on the FTP server in which to effect FTP operations.
Property methods: FilePathDisplayToLogical(), FilePathGet(), FilePathIsValid(), FilePathLogicalToDisplay(), FilePathLogicalToOdbc(), FilePathNormalize()
property Overwrite as %Boolean [ InitialExpression = 1 ];
Overwrite output file if it exists instead of appending
Property methods: OverwriteDisplayToLogical(), OverwriteGet(), OverwriteIsValid(), OverwriteLogicalToDisplay(), OverwriteNormalize(), OverwriteSet()
property SFTPAppendMode as %String (VALUELIST = ",Client,Server") [ InitialExpression = "Client" ];
If you configure SSLConfig=!SFTP and Overwrite=false then you should configure SFTP Append Mode also.

If the SFTP server supports appending then you should select 'Server' append mode. Some SFTP servers do not support appending. When connecting to such a server you should select 'Client' append mode.
Click here to test server side appendOpens in a new tab

In 'Client' mode the FTP adapter will retrieve the remote file (if it exists) from the server, append the new data locally, and then put the combined data back to the SFTP server.

There is a chance that some other process will remove the file from the server or modify the file on the server before the adapter puts the combined data back to the server. In this case the changes made by the other process could be lost.

The logic the SFTP adapter uses for local appending is:

  1. Check if the remote file exists
  2. If it exists it renames by adding .ToBeAppendedTo to the end of the name
  3. If it does not exist it looks for a prior name ending .ToBeAppendedTo
  4. If either of these existing files are found it is downloaded and the new data appended
  5. The combined file is put back and the prior file ending with .ToBeAppendedTo is removed
  6. If there is a network failure before putting the combined file on the server the adapter will use the .ToBeAppendedTo file on the next connection
Since the file being appended to might be locked by the SFTP server you should also consider configuring ReplyCodeActions so that the Operation retries upon error, e.g. E=R or E*Error.

Property methods: SFTPAppendModeDisplayToLogical(), SFTPAppendModeGet(), SFTPAppendModeIsValid(), SFTPAppendModeLogicalToDisplay(), SFTPAppendModeLogicalToOdbc(), SFTPAppendModeNormalize(), SFTPAppendModeSet()

Methods

method CreateFilename(pFilename As %String, pSpec As %String, pIsVMS As %Boolean, pDirectory As %String, pLocal As %Boolean) as %String
Passthrough method for the use of BatchStandardOperation classes. Non-trivial parallel version is defined in File adapter
method Delete(pFilename As %String) as %Status
Delete a named file from an FTP server. Server,Username,Password, and FilePath are configured as Settings for this Adapter. Returns a status value indicating the success of the FTP operation.
method GetStream(pFilename As %String, ByRef pStream As %Stream.Object = $$$NULLOREF) as %Status
Retrieve a named file from an FTP server and return it as a stream. Server,Username,Password,FilePath and Transfer mode (Charset) are configured as Settings for this Adapter. Returns a status value indicating the success of the FTP operation. If the caller provides a stream, it must be the appropriate type of stream for the transfer (Ascii, Binary). This method will create the stream if none is provided.
method NameList(Output pFileList As %ListOfDataTypes) as %Status
Get a list of files on an FTP server. Server,Username,Password, and FilePath are configured as Settings for this Adapter. The filenames are returned in a %ListOfDataTypes object. Returns a status value indicating the success of the FTP operation.
method PutStream(pFilename As %String, pStream As %Stream.Object) as %Status
Store a Stream to an FTP server as a named file. Server,Username,Password,FilePath and Transfer mode (Charset) are configured as Settings for this Adapter. Returns a status value indicating the success of the FTP operation.
method Rename(pFilename As %String, pNewFilename As %String, pNewPath As %String = "") as %Status
Rename a file on an FTP server. Server,Username,Password, and FilePath are configured as Settings for this Adapter. Returns a status value indicating the success of the FTP operation.

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab