Class Reference
IRIS for UNIX 2019.3
InterSystems: The power behind what matters   
Documentation  Search
  [ENSLIB] >  [EnsLib] >  [FTP] >  [CommonSSH]
Private  Storage   

abstract class EnsLib.FTP.CommonSSH extends %RegisteredObject

Adapter that receives files via the FTP protocol.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
1 17 20 1


Summary

Properties
%LastSetFilePath %serverPath %sftpSession %sshSession
ConnectTimeout Connected FTP FTPPort
FTPServer ReturnCode ReturnMessage SFTPFileAccessMode
SFTPPrivateKeyFile SFTPPublicKeyFile SFTPSetFileAccessModeByClient StayConnected
TranslateTable

Methods
%%OIDGet %AddToSaveSet %BindExport %BuildObjectGraph
%ClassIsLatestVersion %ClassName %Close %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IncrementCount %IsA %IsModified
%New %NormalizeObject %ObjectModified %OriginalNamespace
%PackageName %RemoveFromSaveSet %SerializeObject %SetModified
%ValidateObject Append Ascii Binary
ConnectSSH DeleteSSH FileListSSHClose FileListSSHExecute
FileListSSHFetch List Logout NameListSSH
RenameSSH Retrieve RetryRetrieve SetDirectory
Store System TestConnectionSSH fileRetrieve
getFileInfo

Subclasses
EnsLib.FTP.Common

Parameters

• parameter SETTINGS = "FTPServer:Basic,FTPPort:Basic,Credentials:Basic:credentialsSelector,FilePath:Basic,Charset::selector?context={Ens.ContextSearch/CharacterSets},StayConnected:Connection,ConnectTimeout:Connection,SFTPPublicKeyFile:SFTP,SFTPPrivateKeyFile:SFTP,SFTPFileAccessMode:SFTP,SFTPSetFileAccessModeByClient:SFTP";

Properties

• property %LastSetFilePath as %String;
• property %serverPath as %String;
Our internal record of what our current directory has been set to
• property %sftpSession as %Net.SSH.SFTP;
• property %sshSession as %Net.SSH.Session;
• property ConnectTimeout as %Numeric(MINVAL=0) [ InitialExpression = 5 ];
Number of seconds to wait on each connection attempt
• property Connected as %Boolean [ InitialExpression = 0 ];
Shadows ..FTP.Connected. For SFTP the proxy session object and the Adapter are one and the same so this property is shared.
• property FTP as %RegisteredObject;
FTP Session object - %Net.FtpSession, or for SFTP it is an instance of this current class that serves as a proxy for %Net.SSH.SFTP)
• property FTPPort as %Integer;
TCP Port on the FTP Server to connect to. For FTP the standard port is 21 and for SFTP it is 22. Leave this field blank to use the appropriate standard value.
• property FTPServer as %String(MAXLEN=1000);
FTP Server to connect to
• property ReturnCode as %Integer [ InitialExpression = 0 ];
ReturnCode is a the three digit number that an FTP server reponds to commands with. For SFTP we will simulate this
• property ReturnMessage as %String;
ReturnMessage is set to the text message that the sftp server responds with. This often contains useful information if a method failed
• property SFTPFileAccessMode as %String [ InitialExpression = "0600" ];
SFTP File Access Mode specifies the access permissions to assign to the file on the remote system when transferred.
It can be specified as either octal e.g. 0600 or symbolic such as u+rw,g+r
The default is 0600. If specifying octal 4 digits are required.
For symbolic and specifying all use 'ugo' and not 'a' e.g ugo+rw.
• property SFTPPrivateKeyFile as %String(MAXLEN=1000);
File path to a file containing the SSH private key certificate.
The password from the Credentials setting will be used as the passphrase for the private key
• property SFTPPublicKeyFile as %String(MAXLEN=1000);
File path to a file containing the SSH public key certificate
• property SFTPSetFileAccessModeByClient as %Boolean [ InitialExpression = 1 ];
When Putting a file with requested SFTP File Access Mode the SFTP server may apply a umask. A separate SetPermissions call that might not be modified by a umask can be made to apply the requested permissions.
The default is to use an extra SetPermissions call.
If the SFTP File Access Mode is 0600 a SetPermissions call will not be made irrespective of this setting.
Note - this call may not succeed if the target file has already been collected on the server. A Warning will be issued if the SetPermissions call errors.
• property StayConnected as %Numeric(MINVAL=-1) [ InitialExpression = -1 ];
If non-zero, stay connected to the remote system between handling Requests until idle for this number of seconds. A value of -1 means never disconnect.
• property TranslateTable as %String;
The translate table to be used when reading or writing files.

Methods

• method Append(Filename As %String, Stream As %AbstractStream) as %Boolean
Append the data contained in Stream to the file named in Filename. Note: Because Append is not supported natively by all SFTP servers, we have to retrieve and re-send the entire file plus the appended addition.
• method Ascii() as %Boolean
• method Binary() as %Boolean
• method ConnectSSH(pTimeout As %Numeric = 15, pInbound As %Boolean = 0, pSFTPPort As %Integer) as %Status
• method DeleteSSH(Filename As %String) as %Boolean
• classmethod FileListSSHClose(QHandle As %Binary) as %Status
• classmethod FileListSSHExecute(ByRef QHandle As %Binary, adapter As Ens.Adapter, directory As %String, wildcards As %String, dirsOrNoDirs As %Boolean = 0, semaphoreSpec As %String = "") as %Status
• classmethod FileListSSHFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
• method List(Pattern As %String, ByRef Stream As %AbstractStream) as %Boolean
• method Logout() as %Boolean
• method NameListSSH(Path As %String, ByRef FileArray As %ArrayOfDataTypes) as %Boolean
• method RenameSSH(OldFilename As %String, NewFilePath As %String) as %Boolean
• method Retrieve(Filename As %String, ByRef Stream As %AbstractStream) as %Integer
• method RetryRetrieve(Filename As %String, Stream As %AbstractStream) as %Integer
• method SetDirectory(Path As %String) as %Boolean
• method Store(Filename As %String, Stream As %AbstractStream, Append As %Integer = 0) as %Boolean
• method System(ByRef System As %String) as %Boolean
• method TestConnectionSSH(pInbound)
• method fileRetrieve(Filename As %String, ByRef Stream As %AbstractStream, pRetry As %Boolean = 0) as %Integer
• method getFileInfo(Filename As %String, ByRef Info) as %Status

Queries

• query FileListSSH(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.


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.