This article discusses how to create parameters and variables for Virtual Files System (VFS) properties.
Specifying VFS properties as parameters
VFS properties can be specified as parameters. The format of the reference to a VFS property is vfs.scheme.property.host.
The following list describes the subparts of the format:
- The vfs subpart is required to identify this as a virtual file system configuration property.
- The scheme subpart represents the VFS driver's scheme (or VFS type), such as HTTP, SFTP, or ZIP.
- The property subpart is the name of a VFS driver's ConfigBuilder's setter (the specific VFS element that you want to set).
- The host optionally defines a specific IP address or hostname that this setting applies to.
You must consult each scheme's API reference to determine which properties you can create variables for. Apache provides VFS scheme documentation at https://commons.apache.org/proper/commons-vfs/commons-vfs2/apidocs/. The org.apache.commons.vfs.provider package lists each of the configurable VFS providers (FTP, HTTP, SFTP, etc.). Each provider has a FileSystemConfigBuilder class that in turn has set*(FileSystemOptions, Object) methods. If a method's second parameter is a String or a number (Integer, Long, etc.) then you can create a PDI variable to set the value for VFS dialog boxes.
The table below explains VFS properties for the SFTP scheme. Each property must be declared as a PDI variable and preceded by the vfs.sftp prefix as defined above.
|SFTP VFS Property||Purpose|
|compression||Specifies whether ZLIB compression is used for the destination files. Possible values are zlib and none.|
|identity||The private key file (fully qualified local or remote path and filename) to use for host authentication.|
|authkeypassphrase||The passphrase for the private key specified by the identity property.|
|StrictHostKeyChecking||If this is set to no, the certificate of any remote host will be accepted. If set to yes, the remote host must exist in the known hosts file (~/.ssh/known_hosts).|
The following examples show how to specify parameters as VFS properties:
Configure SFTP VFS
To configure the connection settings for SFTP dialog boxes in PDI, you must create either variables or parameters for each relevant value. Possible values are determined by the VFS driver you are using.
You can also use parameters to substitute VFS connection details, then use them in the VFS dialog box where appropriate. For instance, these would be relevant credentials, assuming the parameters have been set:
This technique enables you to hide sensitive connection details, such as usernames and passwords.
You can see examples of these techniques in the VFS Configuration Sample transformation in the /data-integration/samples/transformations/ directory.