Interface FileTransferMBean


public interface FileTransferMBean
This MBean exposes remote file transfer capabilities and must be accessed only within IBM's JMX REST Connector. Accessing this MBean by any other means will result in a UnsupportedOperationException.

The ObjectName for this MBean is "WebSphere:feature=restConnector,type=FileTransfer,name=FileTransfer".

For the remote file parameters (ie: remoteSourceFile for download/delete and remoteTargetFile for upload) the following characteristics apply:

  • the remote file will be either on the connected host or on the routing host (if one is setup).
  • all file paths need to be either absolute or prepend a Liberty-defined symbol (described on <wlp>/README.txt) that resolves to an absolute path.
  • all read and write operations need to be within the configured (or defaulted) read/write regions. See FileServiceMXBean for details.

For the local file parameters (ie: localTargetFile for download and and localSourceFile for upload) the following characteristics apply:

  • the local file will be in a folder that contains the appropriate read/write permissions.
  • the file path is either absolute or relative to the current working directory.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    A string representing the ObjectName that this MBean maps to.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deleteAll(List<String> remoteArtifacts)
    Delete files and folders (empty and non-empty) at the remote specified locations
    void
    deleteFile(String remoteSourceFile)
    Delete a file located at the remote specified location.
    void
    downloadFile(String remoteSourceFile, String localTargetFile)
    Download a file from the specified remote source location and write it in the specified local target location.
    long
    downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset)
    Download part of a file from the specified remote source location using the specified start and end offset byte values and write it in the specified local target location.
    void
    uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion)
    Upload a file from the specified local source location and write it in the specified remote target location.
  • Field Details

  • Method Details

    • downloadFile

      void downloadFile(String remoteSourceFile, String localTargetFile) throws IOException
      Download a file from the specified remote source location and write it in the specified local target location.

      Directories are not supported as the remote source file. To download a directory, it must first be archived.

      Parameters:
      remoteSourceFile - the remote file location of the source to download
      localTargetFile - the local file location where the source contents will be written
      Throws:
      IOException - if there are any issues handling the source or target files
    • downloadFile

      long downloadFile(String remoteSourceFile, String localTargetFile, long startOffset, long endOffset) throws IOException
      Download part of a file from the specified remote source location using the specified start and end offset byte values and write it in the specified local target location.

      Directories are not supported as the remote source file. To download a directory, it must first be archived.

      This partial download feature is currently available only in non-routing scenarios.

      Parameters:
      remoteSourceFile - the remote file location of the source to download
      localTargetFile - the local file location where the source contents will be written
      startOffset - index of the first byte to copy (zero-based and inclusive)
      endOffset - index of the last byte to copy (zero-based and inclusive). Specify -1 to copy until the end of file.
      Returns:
      Index to use as start offset for next partial file download request. If this value is greater than the startOffset value that was passed in, then some bytes (equivalent to the difference) were transferred by this download request.
      Note: It is assumed that in-between the download requests, remote source file is not modified in any way except for appending contents to end of the file.
      Throws:
      IOException - if there are any issues handling the source or target files
    • uploadFile

      void uploadFile(String localSourceFile, String remoteTargetFile, boolean expandOnCompletion) throws IOException
      Upload a file from the specified local source location and write it in the specified remote target location.

      This method optionally supports expanding an archive (specified as the local source file) to the remote target file. The supported compression formats are 'zip' and 'jar' (including war and ear) . All other format types will result in undefined behaviour.

      Directories are not supported as the local source file. To upload a directory, it must first be archived and can then be expanded during upload using the expandOnCompletion option. This option has a special behaviour: the archive will be uploaded as a regular file to the remote system, and then we will make a directory that matches the filename specified by remoteTargetFile, and the contents will be expanded inside that new folder.

      Example: Uploading an archive with remoteTargetFile /home/myFolder/wlp.zip and the expandOnCompletion option set to true will upload the archive wlp.zip to the remote file system, create a folder called wlp.zip under the directory /home/myFolder, and then expand the contents of the archive inside the folder /home/myFolder/wlp.zip. If expandOnCompletion flag is false,then remoteTargetFile must match a filename with an extension (unless the file has not extension), and cannot be a folder.

      Parameters:
      localSourceFile - the local path to the file that will be uploaded. The source file must be a file, since directories are not supported.
      remoteTargetFile - the remote path of the uploaded file. The target file must be a file, since directories are not supported.
      expandOnCompletion - indicates if the archive should be expanded automatically after it is uploaded.
      Throws:
      IOException - if there are any issues handling the request
    • deleteFile

      void deleteFile(String remoteSourceFile) throws IOException
      Delete a file located at the remote specified location.

      Recursive deletion of a directory is not supported, however deletion of an empty directory is supported.

      Parameters:
      remoteSourceFile - the location of the remote file to be deleted
      Throws:
      IOException - if there are any issues handling the request
    • deleteAll

      void deleteAll(List<String> remoteArtifacts) throws IOException
      Delete files and folders (empty and non-empty) at the remote specified locations
      Parameters:
      remoteArtifacts - list of locations of remote files and folders (empty and non-empty) to delete
      Throws:
      IOException - if there are any issues handling the request