Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

File Transfer Framework

File Transfer Framework

The Asset Manager and the Import Manager both need to transfer files between the Commerce Manager Client and the Commerce Manager Server. This section explains the framework which makes this file transfer.

RCP Helper class - FileSystemUtils

The RCP Core contains a helper class, FileSystemUtils which includes methods to assist with file transfer operations. This class takes care of getting the connection details from the system configuration

To use this class from within your RCP client code, first get an instance of the class as follows:

FileSystemUtils fsUtils = FileSystemUtils.getInstance();

Some of the more useful methods:

Method Description

fullPathOfRelativeFile(FileObject base, java.lang.String fileName)

Get the full path of the given file name that is relative to the given base.

getFileSystemManager()

Get the FileSystemManager for this file system.

getRootPath()

Get the root path (combination of the file system base URI and the configured root path).

resolveFile(FileObject base, java.lang.String fileName)

Locates a file by name relative to the given base path.

resolveFile(java.lang.String fileName)

Locates a file by name.

resolveRelativeFile(java.lang.String fileName)

Locates a file relative to the root path.

Base framework - Apache Commons VFS

The base framework that provides the underlying functionality for transferring files is Apache Commons VFS. You can read more about this at the Apache Commons VFS home page. Also refer to the VFS Javadocs especially the FileSystemManager and FileObject interfaces.

Of all the supported file systems, the most relevant of interest to the RCP client are the following:

  • ftp - For transferring files via the ftp protocol. This is recommended and supported for use in the Commerce Manager
  • sftp - SSH File Transfer Protocol or SFTP is a network protocol that provides file transfer and manipulation functionality over any reliable data stream. It is typically used with the SSH-2 protocol (TCP port 22) to provide secure file transfer.
  • file - Provides access to the files on the local physical file system, useful for developers who want to develop locally without having to set up an FTP server.