Class FileTransferConnection

    • Constructor Detail

      • FileTransferConnection

        public FileTransferConnection()
    • Method Detail

      • setForceRelativePath

        public void setForceRelativePath​(java.lang.Boolean b)
        Force the path to be relative when using getDirectoryRoot(String).

        This is useful in the situation where the server in question does not have the user in a ftp jail

        Parameters:
        b - true to prefix a . to the path.
        See Also:
        getDirectoryRoot(String)
      • getForceRelativePath

        public java.lang.Boolean getForceRelativePath()
        Get the force relative path flag.
        Returns:
        true or false.
        See Also:
        setForceRelativePath(Boolean)
      • forceRelativePath

        public boolean forceRelativePath()
      • getDefaultUserName

        public java.lang.String getDefaultUserName()

        Returns the default user name.

        Returns:
        the default user name
      • setDefaultUserName

        public void setDefaultUserName​(java.lang.String s)
        Set the user name.
        Parameters:
        s - the username.
      • getDefaultControlPort

        public java.lang.Integer getDefaultControlPort()
        Returns:
        Returns the defaultControlPort.
      • defaultControlPort

        public abstract int defaultControlPort()
      • setDefaultControlPort

        public void setDefaultControlPort​(java.lang.Integer i)
        Override the default port.
        Parameters:
        i - The defaultControlPort to set.
      • setAdditionalDebug

        public void setAdditionalDebug​(java.lang.Boolean b)
        Get additional logging output where available.
        Parameters:
        b - true to get additional logging.
      • getAdditionalDebug

        public java.lang.Boolean getAdditionalDebug()
        The additional debug flag.
        Returns:
        true or false (default false)
        See Also:
        setAdditionalDebug(Boolean)
      • additionalDebug

        public boolean additionalDebug()
      • setWindowsWorkAround

        public void setWindowsWorkAround​(java.lang.Boolean b)
        Set whether the target server is a windows machine that returns backslash separated filenames when doing NLIST on a directory rather than the normal forward slashes.
        Parameters:
        b - the windowsWorkAround to set
      • windowsWorkaround

        public boolean windowsWorkaround()
      • getCacheConnection

        public java.lang.Boolean getCacheConnection()
        Returns:
        whether connection is held open after use
      • setCacheConnection

        public void setCacheConnection​(java.lang.Boolean b)
        Set whether or not connections created are held open for future use.

        This feature is primarily intended to mitigate the connection cost when using FtpConsumer with a frequent poll interval.If multiple components end up using the same FileTransferClient instance from the cache (perhaps you have multiple FtpConsumer instances configured in the same channel) then you will likely end up with non-optimal performance due to thread synchronisation.

        It is generally recommended that you configure the associated FtpConsumer and FtpProducer instances using the URL form of the destination if you intend to use the caching feature; this allows you to make sure that each component has its own unique FileTransferClient instance associated with it.

        Parameters:
        b - true to enable, default false.
        See Also:
        setMaxClientCache(Integer)
      • cacheConnection

        public boolean cacheConnection()
      • getMaxClientCacheSize

        public java.lang.Integer getMaxClientCacheSize()
        Get the max number of entries in the cache.
        Returns:
        the maximum number of entries.
      • setMaxClientCache

        public void setMaxClientCache​(java.lang.Integer maxSize)
        Set the max number of entries in the cache.

        Entries will be removed on a least recently accessed basis.

        Parameters:
        maxSize - the maximum number of entries, default is 16
        See Also:
        setCacheConnection(Boolean)
      • maxClientCacheSize

        public int maxClientCacheSize()
      • getCacheExpiration

        public TimeInterval getCacheExpiration()
      • setCacheExpiration

        public void setCacheExpiration​(TimeInterval expiration)
      • expirationMillis

        protected long expirationMillis()
      • acceptProtocol

        protected abstract boolean acceptProtocol​(java.lang.String s)
        Validate the URL Protocol when a URL is used.
        Parameters:
        s - the URL Protocol
        Returns:
        true if the URL protocol is acceptable to the concrete imp.
      • getDirectoryRoot

        public java.lang.String getDirectoryRoot​(java.lang.String hostUrl)

        Returns the directory root for the passed host URL.

        Parameters:
        hostUrl - the host URL
        Returns:
        the directory root for the passed host URL
      • disconnect

        public void disconnect​(FileTransferClient ftp)
        Disconnect the FTP client.
        Parameters:
        ftp - the ftp client implementation