Skip to main content

EnsLib.FTP.Common

abstract class EnsLib.FTP.Common extends EnsLib.FTP.CommonSSH

Adapter that receives files via the FTP protocol.

Property Inventory

Method Inventory

Parameters

parameter SETTINGS = Protocol:Connection,SSLConfig:Connection:sslConfigSelector,SSLCheckServerIdentity:Connection,SSLUseSessionResumption:Connection,UsePASV:Connection,CommandTranslateTable:FTP:selector?context={Ens.ContextSearch/CharacterSets?internalTables=1};

Properties

property CommandTranslateTable as %String;
For FTP Protocol the translate table to use for the command channel, specifically for the filename/pathnames. Normally this should not be specified in which case if the ftp server supports UTF8 then we will use that for the filename/pathnames, if the server does not support UTF8 then we will use RAW mode and just read the bytes as sent.

It is possible for a server to provide the filename list in RAW and for it to support UTF8. In this case it might be necessary to set the Command Translate Table to RAW to override the the detected UTF8

The values shown in the list are the internal table names.
Property methods: CommandTranslateTableDisplayToLogical(), CommandTranslateTableGet(), CommandTranslateTableIsValid(), CommandTranslateTableLogicalToDisplay(), CommandTranslateTableLogicalToOdbc(), CommandTranslateTableNormalize(), CommandTranslateTableSet()
property Protocol as %String (VALUELIST = ",FTP,SFTP");
Use this setting to indicate whether the protocol is FTP - File Transfer Protocol or SFTP - SSH File Transfer Protocol.
If the protocol is FTP it is possible to use the setting SSL Configuration to configure FTP over SSL

If the protocol is SFTP then:
- the UsePASV and ServerListStyle values will be ignored.
- the FTPPort value should ordinarily be set to 22.
- you must supply a Credentials value
- if you supply values for both SFTPPublicKeyFile and SFTPPrivateKeyFile the adapter will attempt key pair authentication. It will do this in conjunction with the username and password supplied via the Credentials setting, using the password in the Credentials as the passphrase for the private key.
- if you don't supply both KeyFile values the adapter will attempt only username/password authentication based on the Credentials setting.

If this setting is blank then the protocol will be FTP - File Transfer Protocol subject to:

In order to support prior version compatibility a setting value of !SFTP for SSL Configuration will result in using the SFTP - SSH File Transfer Protocol irrespective of this Protocol setting.

Property methods: ProtocolDisplayToLogical(), ProtocolGet(), ProtocolIsValid(), ProtocolLogicalToDisplay(), ProtocolLogicalToOdbc(), ProtocolNormalize(), ProtocolSet()
property SSLCheckServerIdentity as %Boolean [ InitialExpression = 0 ];
When making an FTP over SSL connection check the server identity in the certificate matches the name of the system we are connecting to. This defaults to being OFF but it is recommended to enable.
If enabled it matches based on the rules layed out in section 3.1 of RFC 2818.
Property methods: SSLCheckServerIdentityDisplayToLogical(), SSLCheckServerIdentityGet(), SSLCheckServerIdentityIsValid(), SSLCheckServerIdentityLogicalToDisplay(), SSLCheckServerIdentityNormalize(), SSLCheckServerIdentitySet()
property SSLConfig as %String;
The name of an existing SSL/TLS system configuration set to use for FTPS (Secure Socket Layer / Transport Layer Security, configured via the system portal's Security Management page).
This is for FTPS, meaning an encrypted connection to a normal FTP server.
If you append an asterisk (*) to the configuration name you enter, this adapter will use legacy FTPS mode. FTPS is defined by RFC4217 but some servers operate with a non-compliant variant which simply assumes that the command channel should use TLS. Earlier versions of this adapter worked only with this sort of non-compliant server. Append an asterisk to the SSL configuration name if you need to (continue to) work with this sort of server.

For prior version compatibility a value of !SFTP is still supported to indicate the protocol is SFTP. The recommendation is to use the Protocol setting to indicate SFTP.

Property methods: SSLConfigDisplayToLogical(), SSLConfigGet(), SSLConfigIsValid(), SSLConfigLogicalToDisplay(), SSLConfigLogicalToOdbc(), SSLConfigNormalize()
property SSLUseSessionResumption as %Boolean [ InitialExpression = 0 ];
When making the SSL connection for the data channel, reuse session parameters from the command channel.
This feature requires OpenSSL v1.1.x+.
Property methods: SSLUseSessionResumptionDisplayToLogical(), SSLUseSessionResumptionGet(), SSLUseSessionResumptionIsValid(), SSLUseSessionResumptionLogicalToDisplay(), SSLUseSessionResumptionNormalize(), SSLUseSessionResumptionSet()
property UsePASV as %Boolean [ InitialExpression = 1 ];
Use Passive FTP mode: server returns a data port address and the client connects to it. Most firewalls are more tolerant of Passive mode FTP because both the control and data TCP connections are initiated by the client.
Property methods: UsePASVDisplayToLogical(), UsePASVGet(), UsePASVIsValid(), UsePASVLogicalToDisplay(), UsePASVNormalize(), UsePASVSet()

Methods

method Connect(pTimeout As %Numeric = 30, pInbound As %Boolean = 0) as %Status
Connect to the FTP server and log in, setting the directory and transfer mode
method CreateTimestamp(pFilename As %String, pSpec As %String, pDummyVMS As %Boolean, pDirectory As %String, pDummyLocal As %Boolean) as %String
Use this method, ..CreateTimestamp(), when naming files on the remote FTP server, use ##class(Ens.Util.File).CreateTimestamp() when naming local files.
method Disconnect(pInbound As %Boolean = 0) as %Status
Disconnect from the datasource
classmethod FileListClose(QHandle As %Binary) as %Status
classmethod FileListExecute(ByRef QHandle As %Binary, adapter As Ens.Adapter, directory As %String, wildcards As %String, dirsOrNoDirs As %Boolean = 0, semaphoreSpec As %String = "") as %Status
classmethod FileListFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
method OnKeepalive() as %Status
method TestConnection(pInbound)

Queries

query FileList(adapter As Ens.Adapter, directory As %String(MAXLEN=""), wildcards As %String, dirsOrNoDirs As %Boolean = 0, semaphoreSpec As %String = "")
Selects Name As %String, Type As %String, Size As %BigInt, DateCreated As %TimeStamp, DateModified As %TimeStamp, ItemName As %String, ItemDir As %String, SemaphoreName As %String
This query is a shadow of the FileSet query in %Library.File, using an interface to the Adapter and skipping directories The dirsOrNoDirs argument if 0 (the default) will exclude directory entries, or if 1 will return directory entries only.

Inherited Members

Inherited Properties

Inherited Methods

Subclasses

FeedbackOpens in a new tab