Package com.adaptris.core.ftp
Class StandardSftpConnection
java.lang.Object
com.adaptris.core.AdaptrisConnectionImp
com.adaptris.core.NoOpConnection
com.adaptris.core.ftp.FileTransferConnection
com.adaptris.core.ftp.StandardSftpConnection
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,StateManagedComponent
@ComponentProfile(summary="Connect to a server using the SSH File Transfer Protocol; authentication via a configured authentication provider",
tag="connections,sftp")
public class StandardSftpConnection
extends FileTransferConnection
SFTP Connection class that connects via a configurable
SftpAuthenticationProvider.- Since:
- 3.6.0
In the adapter configuration file this class is aliased as standard-sftp-connection which is the preferred alternative to the fully qualified classname when building your configuration.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.adaptris.core.ftp.FileTransferConnection
FileTransferConnection.UserInfo -
Field Summary
Fields inherited from class com.adaptris.core.ftp.FileTransferConnection
DEFAULT_EXPIRATION, DEFAULT_MAX_CACHE_SIZEFields inherited from class com.adaptris.core.AdaptrisConnectionImp
log -
Constructor Summary
ConstructorsConstructorDescriptionStandardSftpConnection(ConfigBuilder config, SftpAuthenticationProvider prov) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanValidate the URL Protocol when a URL is used.protected FileTransferClientcreate(String remoteHost, int port, FileTransferConnection.UserInfo ui) Create an instance of theFileTransferClientfor use with the producer or consumer.protected FileTransferConnection.UserInfointprotected voidInitialise the underlying connection.voidvoidSet the config repository.voidvoidThe socket timeout in milliseconds for connect / read /write operations.Methods inherited from class com.adaptris.core.ftp.FileTransferConnection
additionalDebug, cacheConnection, closeConnection, connect, disconnect, expirationMillis, forceRelativePath, getAdditionalDebug, getCacheConnection, getCacheExpiration, getDefaultControlPort, getDefaultUserName, getDirectoryRoot, getForceRelativePath, getMaxClientCacheSize, getWindowsWorkAround, maxClientCacheSize, setAdditionalDebug, setCacheConnection, setCacheExpiration, setDefaultControlPort, setDefaultUserName, setForceRelativePath, setMaxClientCache, setWindowsWorkAround, windowsWorkaround, withCacheExpirationMethods inherited from class com.adaptris.core.NoOpConnection
prepareConnection, startConnection, stopConnectionMethods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, connectionStateHandler, getConnectionErrorHandler, getConnectionStateHandler, getRuntimeComponent, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setConnectionStateHandler, setRuntimeComponent, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
Constructor Details
-
StandardSftpConnection
public StandardSftpConnection() -
StandardSftpConnection
-
-
Method Details
-
acceptProtocol
Description copied from class:FileTransferConnectionValidate the URL Protocol when a URL is used.- Specified by:
acceptProtocolin classFileTransferConnection- Parameters:
s- the URL Protocol- Returns:
- true if the URL protocol is acceptable to the concrete imp.
-
create
protected FileTransferClient create(String remoteHost, int port, FileTransferConnection.UserInfo ui) throws IOException, FileTransferException, PasswordException Description copied from class:FileTransferConnectionCreate an instance of theFileTransferClientfor use with the producer or consumer.- Specified by:
createin classFileTransferConnection- Parameters:
remoteHost- the remote host.port- the port to connect toui- a local UserInfo containing username and password- Returns:
- a
FileTransferClientobject - Throws:
IOException- wrapping a general comms error.FileTransferException- if a protocol specific exception occurred.PasswordException
-
initConnection
Description copied from class:AdaptrisConnectionImpInitialise the underlying connection.- Overrides:
initConnectionin classFileTransferConnection- Throws:
CoreException- wrapping any exception.- See Also:
-
getSocketTimeout
-
setSocketTimeout
The socket timeout in milliseconds for connect / read /write operations.- Parameters:
t- The socketTimeout to set, default is 60000
-
createUserInfo
- Specified by:
createUserInfoin classFileTransferConnection- Throws:
FileTransferException
-
getKnownHostsFile
-
setKnownHostsFile
-
defaultControlPort
public int defaultControlPort()- Specified by:
defaultControlPortin classFileTransferConnection
-
getConfiguration
- Returns:
- the configRepository
-
setConfiguration
Set the config repository.Use a config repository to set various SSH based settings (such as
PreferredAuthenticationsorServerAliveInterval.- Parameters:
repo- the configRepository to set
-
getAuthentication
- Returns:
- the authProvider
-
setAuthentication
- Parameters:
p- the authProvider to set
-