クラス FtpRemoteFileTemplate

java.lang.ObjectSE
org.springframework.integration.file.remote.RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>
org.springframework.integration.ftp.session.FtpRemoteFileTemplate
実装されたすべてのインターフェース:
AwareBeanFactoryAwareInitializingBeanRemoteFileOperations<org.apache.commons.net.ftp.FTPFile>

public class FtpRemoteFileTemplate extends RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>
基になる FTPClient オブジェクトへの型安全なアクセスを提供する RemoteFileTemplate の FTP バージョン。
導入:
4.1
作成者:
Gary Russell, Artem Bilan
  • コンストラクターの詳細

    • FtpRemoteFileTemplate

      public FtpRemoteFileTemplate(SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory)
  • メソッドの詳細

    • executeWithClient

      public <T, C> T executeWithClient(ClientCallback<C,T> callback)
      インターフェースからコピーされた説明: RemoteFileOperations
      セッションのクライアントを取得した後、コールバックの doWithClient メソッドを実行し、低レベルのメソッドへのアクセスを提供します。メソッドの終了時に確実にセッションを閉じます。
      次で指定:
      インターフェース RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>executeWithClient 
      オーバーライド:
      クラス RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>executeWithClient 
      型パラメーター:
      T - ClientCallback.doWithClient(Object) によって返される型。
      C - 基礎となるクライアントオブジェクトの型。
      パラメーター:
      callback - ClientCallback。
      戻り値:
      コールバックメソッドの結果。
    • setExistsMode

      public void setExistsMode(FtpRemoteFileTemplate.ExistsMode existsMode)
      exists(String) 操作の FtpRemoteFileTemplate.ExistsMode を指定します。デフォルトは FtpRemoteFileTemplate.ExistsMode.STAT です。ファイル操作のためにフレームワークコンポーネントによって内部的に使用される場合、FtpRemoteFileTemplate.ExistsMode.NLST に切り替えられます。
      パラメーター:
      existsMode - 使用する FtpRemoteFileTemplate.ExistsMode
      導入:
      4.1.9
    • doExecuteWithClient

      protected <T> T doExecuteWithClient(ClientCallback<org.apache.commons.net.ftp.FTPClient,T> callback)
    • exists

      public boolean exists(StringSE path)
      この特定の FTP 実装はデフォルトで FTPClient.getStatus(String) に基づいていますが、すべての FTP サーバーが STAT コマンドを適切に実装するわけではないため、フレームワーク内部 FtpRemoteFileTemplate インスタンスはファイル操作のみのために FTPClient.listNames(String) に切り替えられます。

      モードは setExistsMode(ExistsMode) プロパティで切り替えることができます。

      FtpRemoteFileTemplate の拡張で任意のカスタム実装を実行できます。

      次で指定:
      インターフェース RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>exists 
      オーバーライド:
      クラス RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>exists 
      パラメーター:
      path - チェックするリモートファイルパス。
      戻り値:
      リモートファイルが存在するかどうかは true または false です。
    • shouldMarkSessionAsDirty

      protected boolean shouldMarkSessionAsDirty(ExceptionSE ex)
      クラスからコピーされた説明: RemoteFileTemplate
      コールバックから例外がスローされたときに、RemoteFileTemplate.execute(SessionCallback)Session.dirty() を呼び出す必要があるかどうかを決定します。デフォルトでは、このメソッドは true を返します。リモートファイルプロトコル拡張機能は、このメソッドをオーバーライドして、スローされた例外に対する特定の戦略を提供できます。file not found エラーは、セッションが切断されたことを示す信号ではありません。
      オーバーライド:
      クラス RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile>shouldMarkSessionAsDirty 
      パラメーター:
      ex - Session をダーティとしてマークする必要があるかどうかをチェックする例外。
      戻り値:
      Session.dirty() を呼び出す必要がある場合は true。
    • isStatusDirty

      protected boolean isStatusDirty(StringSE ftpErrorMessage)
      Throwable.getMessage() が致命的として扱われるかどうかを確認します。
      パラメーター:
      ftpErrorMessage - Throwable.getMessage() からの値。
      戻り値:
      Throwable.getMessage() が致命的として扱われる場合は true。
      導入:
      6.0.8