Package adams.gui.chooser
Class SftpRemoteDirectorySetup
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.chooser.SftpRemoteDirectorySetup
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,SSHSessionProvider,OptionHandler,PasswordSupporter,SizeOfHandler,RemoteDirectorySetup,Serializable
public class SftpRemoteDirectorySetup extends AbstractOptionHandler implements SSHSessionProvider, RemoteDirectorySetup, PasswordSupporter
For configuring an SSH connection and remote directory.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SSHAuthenticationTypem_AuthenticationTypethe type of authentication to use.protected Stringm_Hostthe SSH host.protected PlaceholderFilem_KnownHoststhe file with known hosts.protected BasePasswordm_Passwordthe SSH password to use.protected intm_Portthe SSH port.protected PlaceholderFilem_PrivateKeyFilethe location of the private key.protected BasePasswordm_PrivateKeyPassphrasethe passphrase for the private key.protected Stringm_RemoteDirthe directory to list.protected com.jcraft.jsch.Sessionm_Sessionthe SSH session.protected booleanm_StrictHostKeyCheckingwhether to perform strict host key checking (only disable for testing!!protected Stringm_Userthe SSH user to use.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description SftpRemoteDirectorySetup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringauthenticationTypeTipText()Returns the tip text for this property.voidcleanUp()Cleans up data structures, frees up memory.voiddefineOptions()Adds options to the internal list of options.SSHAuthenticationTypegetAuthenticationType()Returns the type of authentication to use.StringgetHost()Returns the host to connect to.PlaceholderFilegetKnownHosts()Returns the file with the known hosts.BasePasswordgetPassword()Returns the SSH password to use.intgetPort()Returns the port to connect to.PlaceholderFilegetPrivateKeyFile()Returns the location of the private key file.BasePasswordgetPrivateKeyPassphrase()Returns the passphrase for the private key file, ignored if empty.StringgetRemoteDir()Returns the remote directory.com.jcraft.jsch.SessiongetSession()Returns the SSH session.booleangetStrictHostKeyChecking()Returns whether to perform strict host key checking.StringgetUser()Returns the SSH user name to use.StringglobalInfo()Returns a string describing the object.StringhostTipText()Returns the tip text for this property.StringknownHostsTipText()Returns the tip text for this property.com.jcraft.jsch.SessionnewSession()Returns a new session for the host/port defined in the options.com.jcraft.jsch.SessionnewSession(String host, int port)Returns a new session for the given host/port.StringpasswordTipText()Returns the tip text for this property.StringportTipText()Returns the tip text for this property.StringprivateKeyFileTipText()Returns the tip text for this property.StringprivateKeyPassphraseTipText()Returns the tip text for this property.StringremoteDirTipText()Returns the tip text for this property.booleanrequiresInitialization()Returns whether the setup needs to be configured by the user or whether it can be used straight away.voidsetAuthenticationType(SSHAuthenticationType value)Sets the type of authentication to use.voidsetHost(String value)Sets the host to connect to.voidsetKnownHosts(PlaceholderFile value)Sets the file with the known hosts.voidsetPassword(BasePassword value)Sets the SSH password to use.voidsetPort(int value)Sets the port to connect to.voidsetPrivateKeyFile(PlaceholderFile value)Sets the location of the private key file.voidsetPrivateKeyPassphrase(BasePassword value)Sets the passphrase for the private key file, ignored if empty.voidsetRemoteDir(String value)Sets the remote directory.voidsetStrictHostKeyChecking(boolean value)Sets whether to perform strict host key checking.voidsetUser(String value)Sets the SSH user to use.StringstrictHostKeyCheckingTipText()Returns the tip text for this property.StringuserTipText()Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Host
protected String m_Host
the SSH host.
-
m_Port
protected int m_Port
the SSH port.
-
m_AuthenticationType
protected SSHAuthenticationType m_AuthenticationType
the type of authentication to use.
-
m_User
protected String m_User
the SSH user to use.
-
m_Password
protected BasePassword m_Password
the SSH password to use.
-
m_PrivateKeyFile
protected PlaceholderFile m_PrivateKeyFile
the location of the private key.
-
m_PrivateKeyPassphrase
protected BasePassword m_PrivateKeyPassphrase
the passphrase for the private key.
-
m_KnownHosts
protected PlaceholderFile m_KnownHosts
the file with known hosts.
-
m_StrictHostKeyChecking
protected boolean m_StrictHostKeyChecking
whether to perform strict host key checking (only disable for testing!! insecure!!).
-
m_RemoteDir
protected String m_RemoteDir
the directory to list.
-
m_Session
protected transient com.jcraft.jsch.Session m_Session
the SSH session.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setHost
public void setHost(String value)
Sets the host to connect to.- Parameters:
value- the host name/ip
-
getHost
public String getHost()
Returns the host to connect to.- Returns:
- the host name/ip
-
hostTipText
public String hostTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPort
public void setPort(int value)
Sets the port to connect to.- Parameters:
value- the port
-
getPort
public int getPort()
Returns the port to connect to.- Returns:
- the port
-
portTipText
public String portTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAuthenticationType
public void setAuthenticationType(SSHAuthenticationType value)
Sets the type of authentication to use.- Parameters:
value- the type
-
getAuthenticationType
public SSHAuthenticationType getAuthenticationType()
Returns the type of authentication to use.- Returns:
- the type
-
authenticationTypeTipText
public String authenticationTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUser
public void setUser(String value)
Sets the SSH user to use.- Parameters:
value- the user name
-
getUser
public String getUser()
Returns the SSH user name to use.- Returns:
- the user name
-
userTipText
public String userTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPassword
public void setPassword(BasePassword value)
Sets the SSH password to use.- Specified by:
setPasswordin interfacePasswordSupporter- Parameters:
value- the password
-
getPassword
public BasePassword getPassword()
Returns the SSH password to use.- Specified by:
getPasswordin interfacePasswordSupporter- Returns:
- the password
-
passwordTipText
public String passwordTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPrivateKeyFile
public void setPrivateKeyFile(PlaceholderFile value)
Sets the location of the private key file.- Parameters:
value- the key file
-
getPrivateKeyFile
public PlaceholderFile getPrivateKeyFile()
Returns the location of the private key file.- Returns:
- the key file
-
privateKeyFileTipText
public String privateKeyFileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPrivateKeyPassphrase
public void setPrivateKeyPassphrase(BasePassword value)
Sets the passphrase for the private key file, ignored if empty.- Parameters:
value- the passphrase
-
getPrivateKeyPassphrase
public BasePassword getPrivateKeyPassphrase()
Returns the passphrase for the private key file, ignored if empty.- Returns:
- the passphrase
-
privateKeyPassphraseTipText
public String privateKeyPassphraseTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setKnownHosts
public void setKnownHosts(PlaceholderFile value)
Sets the file with the known hosts.- Parameters:
value- the file
-
getKnownHosts
public PlaceholderFile getKnownHosts()
Returns the file with the known hosts.- Returns:
- the file
-
knownHostsTipText
public String knownHostsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStrictHostKeyChecking
public void setStrictHostKeyChecking(boolean value)
Sets whether to perform strict host key checking. NB: only disabled for testing, as it is very insecure to disable it!- Parameters:
value- if true then strict checking is on
-
getStrictHostKeyChecking
public boolean getStrictHostKeyChecking()
Returns whether to perform strict host key checking. NB: only disabled for testing, as it is very insecure to disable it!- Returns:
- true if strict checking is on
-
strictHostKeyCheckingTipText
public String strictHostKeyCheckingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRemoteDir
public void setRemoteDir(String value)
Sets the remote directory.- Parameters:
value- the remote directory
-
getRemoteDir
public String getRemoteDir()
Returns the remote directory.- Returns:
- the remote directory.
-
remoteDirTipText
public String remoteDirTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getSession
public com.jcraft.jsch.Session getSession()
Returns the SSH session. Attempts to reconnect when necessary.- Specified by:
getSessionin interfaceSSHSessionProvider- Returns:
- the SSH session, null if not connected
-
newSession
public com.jcraft.jsch.Session newSession()
Returns a new session for the host/port defined in the options.- Specified by:
newSessionin interfaceSSHSessionProvider- Returns:
- the session
-
newSession
public com.jcraft.jsch.Session newSession(String host, int port)
Returns a new session for the given host/port.- Specified by:
newSessionin interfaceSSHSessionProvider- Parameters:
host- the host to create the session for- Returns:
- the session
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceCleanUpHandler
-
requiresInitialization
public boolean requiresInitialization()
Returns whether the setup needs to be configured by the user or whether it can be used straight away.- Specified by:
requiresInitializationin interfaceRemoteDirectorySetup- Returns:
- true if user needs to configure first
-
-