org.apache.camel.component.file.remote
Class RemoteFileConfiguration

java.lang.Object
  extended by org.apache.camel.component.file.GenericFileConfiguration
      extended by org.apache.camel.component.file.remote.RemoteFileConfiguration
Direct Known Subclasses:
FtpConfiguration, SftpConfiguration

public abstract class RemoteFileConfiguration
extends org.apache.camel.component.file.GenericFileConfiguration

Configuration of the FTP server


Nested Class Summary
static class RemoteFileConfiguration.PathSeparator
          Path separator as either unix or windows style.
 
Field Summary
 
Fields inherited from class org.apache.camel.component.file.GenericFileConfiguration
directory
 
Constructor Summary
RemoteFileConfiguration()
           
RemoteFileConfiguration(URI uri)
           
 
Method Summary
 void configure(URI uri)
           
 int getConnectTimeout()
           
 String getHost()
           
 String getPassword()
           
 int getPort()
           
 String getProtocol()
           
 RemoteFileConfiguration.PathSeparator getSeparator()
           
 String getSiteCommand()
           
 int getSoTimeout()
           
 int getTimeout()
           
 String getUsername()
           
 boolean isBinary()
           
 boolean isIgnoreFileNotFoundOrPermissionError()
           
 boolean isPassiveMode()
           
 boolean isStepwise()
           
 boolean isStreamDownload()
           
 boolean isThrowExceptionOnConnectFailed()
           
 boolean isUseList()
           
 boolean needToNormalize()
           
 String normalizePath(String path)
          Normalizes the given path according to the configured path separator.
 String remoteServerInformation()
          Returns human readable server information for logging purpose
 void setBinary(boolean binary)
           
 void setConnectTimeout(int connectTimeout)
          Sets the connect timeout for waiting for a connection to be established

Used by both FTPClient and JSCH

protected abstract  void setDefaultPort()
           
 void setHost(String host)
           
 void setIgnoreFileNotFoundOrPermissionError(boolean ignoreFileNotFoundOrPermissionError)
          Whether to ignore when trying to download a file which does not exist or due to permission error.
 void setPassiveMode(boolean passiveMode)
          Sets passive mode connections.
 void setPassword(String password)
           
 void setPort(int port)
           
 void setProtocol(String protocol)
           
 void setSeparator(RemoteFileConfiguration.PathSeparator separator)
          Sets the path separator to be used.
 void setSiteCommand(String siteCommand)
          Sets optional site command(s) to be executed after successful login.
 void setSoTimeout(int soTimeout)
          Sets the so timeout

Used only by FTPClient

 void setStepwise(boolean stepwise)
          Sets whether we should stepwise change directories while traversing file structures when downloading files, or as well when uploading a file to a directory.
 void setStreamDownload(boolean streamDownload)
          Sets the download method to use when not using a local working directory.
 void setThrowExceptionOnConnectFailed(boolean throwExceptionOnConnectFailed)
          Should an exception be thrown if connection failed (exhausted)

By default exception is not thrown and a WARN is logged.

 void setTimeout(int timeout)
          Sets the data timeout for waiting for reply

Used only by FTPClient

 void setUseList(boolean useList)
          Whether to allow using LIST command when downloading a file.
 void setUsername(String username)
           
 
Methods inherited from class org.apache.camel.component.file.GenericFileConfiguration
getDirectory, setDirectory, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteFileConfiguration

public RemoteFileConfiguration()

RemoteFileConfiguration

public RemoteFileConfiguration(URI uri)
Method Detail

needToNormalize

public boolean needToNormalize()
Overrides:
needToNormalize in class org.apache.camel.component.file.GenericFileConfiguration

configure

public void configure(URI uri)
Overrides:
configure in class org.apache.camel.component.file.GenericFileConfiguration

remoteServerInformation

public String remoteServerInformation()
Returns human readable server information for logging purpose


setDefaultPort

protected abstract void setDefaultPort()

getHost

public String getHost()

setHost

public void setHost(String host)

getPort

public int getPort()

setPort

public void setPort(int port)

getPassword

public String getPassword()

setPassword

public void setPassword(String password)

getProtocol

public String getProtocol()

setProtocol

public void setProtocol(String protocol)

getUsername

public String getUsername()

setUsername

public void setUsername(String username)

isBinary

public boolean isBinary()

setBinary

public void setBinary(boolean binary)

isPassiveMode

public boolean isPassiveMode()

setPassiveMode

public void setPassiveMode(boolean passiveMode)
Sets passive mode connections.
Default is active mode connections.


getConnectTimeout

public int getConnectTimeout()

setConnectTimeout

public void setConnectTimeout(int connectTimeout)
Sets the connect timeout for waiting for a connection to be established

Used by both FTPClient and JSCH


getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)
Sets the data timeout for waiting for reply

Used only by FTPClient


getSoTimeout

public int getSoTimeout()

setSoTimeout

public void setSoTimeout(int soTimeout)
Sets the so timeout

Used only by FTPClient


isThrowExceptionOnConnectFailed

public boolean isThrowExceptionOnConnectFailed()

setThrowExceptionOnConnectFailed

public void setThrowExceptionOnConnectFailed(boolean throwExceptionOnConnectFailed)
Should an exception be thrown if connection failed (exhausted)

By default exception is not thrown and a WARN is logged. You can use this to enable exception being thrown and handle the thrown exception from the PollingConsumerPollStrategy rollback method.


getSiteCommand

public String getSiteCommand()

setSiteCommand

public void setSiteCommand(String siteCommand)
Sets optional site command(s) to be executed after successful login.

Multiple site commands can be separated using a new line character (\n).

Parameters:
siteCommand - the site command(s).

isStepwise

public boolean isStepwise()

setStepwise

public void setStepwise(boolean stepwise)
Sets whether we should stepwise change directories while traversing file structures when downloading files, or as well when uploading a file to a directory.

You can disable this if you for example are in a situation where you cannot change directory on the FTP server due security reasons.

Parameters:
stepwise - whether to use change directory or not

getSeparator

public RemoteFileConfiguration.PathSeparator getSeparator()

setSeparator

public void setSeparator(RemoteFileConfiguration.PathSeparator separator)
Sets the path separator to be used.

UNIX = Path separator / is used Windows = Path separator \ is used Auto = (is default) Use existing path separator in file name


isStreamDownload

public boolean isStreamDownload()

setStreamDownload

public void setStreamDownload(boolean streamDownload)
Sets the download method to use when not using a local working directory. If set to true, the remote files are streamed to the route as they are read. When set to false, the remote files are loaded into memory before being sent into the route.


isUseList

public boolean isUseList()

setUseList

public void setUseList(boolean useList)
Whether to allow using LIST command when downloading a file.

Default is true. In some use cases you may want to download a specific file and are not allowed to use the LIST command, and therefore you can set this option to false.


isIgnoreFileNotFoundOrPermissionError

public boolean isIgnoreFileNotFoundOrPermissionError()

setIgnoreFileNotFoundOrPermissionError

public void setIgnoreFileNotFoundOrPermissionError(boolean ignoreFileNotFoundOrPermissionError)
Whether to ignore when trying to download a file which does not exist or due to permission error.

By default when a file does not exists or insufficient permission, then an exception is thrown. Setting this option to true allows to ignore that instead.


normalizePath

public String normalizePath(String path)
Normalizes the given path according to the configured path separator.

Parameters:
path - the given path
Returns:
the normalized path


Apache Camel