Package adams.gui.chooser
Class FtpRemoteDirectorySetup
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.chooser.FtpRemoteDirectorySetup
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,PasswordSupporter
,SizeOfHandler
,RemoteDirectorySetup
,Serializable
,EventListener
,org.apache.commons.net.ProtocolCommandListener
public class FtpRemoteDirectorySetup extends AbstractOptionHandler implements RemoteDirectorySetup, org.apache.commons.net.ProtocolCommandListener, 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 org.apache.commons.net.ftp.FTPClient
m_Client
the FTP client object.protected String
m_Host
the FTP host.protected BasePassword
m_Password
the FTP password to use.protected String
m_RemoteDir
the directory to list.protected boolean
m_UseBinaryMode
whether to use binary file transfer mode.protected boolean
m_UsePassiveMode
whether to use passive mode.protected String
m_User
the FTP 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 FtpRemoteDirectorySetup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.void
defineOptions()
Adds options to the internal list of options.org.apache.commons.net.ftp.FTPClient
getClient()
Returns the FTP client.String
getHost()
Returns the host to connect to.BasePassword
getPassword()
Returns the FTP password to use.String
getRemoteDir()
Returns the remote directory.boolean
getUseBinaryMode()
Returns whether binary mode is used.boolean
getUsePassiveMode()
Returns whether passive mode is used.String
getUser()
Returns the FTP user name to use.String
globalInfo()
Returns a string describing the object.String
hostTipText()
Returns the tip text for this property.org.apache.commons.net.ftp.FTPClient
newClient()
Returns a new client for the host/port defined in the options.String
passwordTipText()
Returns the tip text for this property.void
protocolCommandSent(org.apache.commons.net.ProtocolCommandEvent event)
This method is invoked by a ProtocolCommandEvent source after sending a protocol command to a server.void
protocolReplyReceived(org.apache.commons.net.ProtocolCommandEvent event)
This method is invoked by a ProtocolCommandEvent source after receiving a reply from a server.String
remoteDirTipText()
Returns the tip text for this property.boolean
requiresInitialization()
Returns whether the setup needs to be configured by the user or whether it can be used straight away.void
setHost(String value)
Sets the host to connect to.void
setPassword(BasePassword value)
Sets the FTP password to use.void
setRemoteDir(String value)
Sets the remote directory.void
setUseBinaryMode(boolean value)
Sets whether to use binary mode.void
setUsePassiveMode(boolean value)
Sets whether to use passive mode.void
setUser(String value)
Sets the FTP user to use.String
useBinaryModeTipText()
Returns the tip text for this property.String
usePassiveModeTipText()
Returns the tip text for this property.String
userTipText()
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 FTP host.
-
m_User
protected String m_User
the FTP user to use.
-
m_Password
protected BasePassword m_Password
the FTP password to use.
-
m_UsePassiveMode
protected boolean m_UsePassiveMode
whether to use passive mode.
-
m_UseBinaryMode
protected boolean m_UseBinaryMode
whether to use binary file transfer mode.
-
m_RemoteDir
protected String m_RemoteDir
the directory to list.
-
m_Client
protected org.apache.commons.net.ftp.FTPClient m_Client
the FTP client object.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in 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.
-
setUser
public void setUser(String value)
Sets the FTP user to use.- Parameters:
value
- the user name
-
getUser
public String getUser()
Returns the FTP 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 FTP password to use.- Specified by:
setPassword
in interfacePasswordSupporter
- Parameters:
value
- the password
-
getPassword
public BasePassword getPassword()
Returns the FTP password to use.- Specified by:
getPassword
in 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.
-
setUsePassiveMode
public void setUsePassiveMode(boolean value)
Sets whether to use passive mode.- Parameters:
value
- if true passive mode is used
-
getUsePassiveMode
public boolean getUsePassiveMode()
Returns whether passive mode is used.- Returns:
- true if passive mode is used
-
usePassiveModeTipText
public String usePassiveModeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseBinaryMode
public void setUseBinaryMode(boolean value)
Sets whether to use binary mode.- Parameters:
value
- if true binary mode is used
-
getUseBinaryMode
public boolean getUseBinaryMode()
Returns whether binary mode is used.- Returns:
- true if binary mode is used
-
useBinaryModeTipText
public String useBinaryModeTipText()
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.
-
getClient
public org.apache.commons.net.ftp.FTPClient getClient()
Returns the FTP client.- Returns:
- the FTP client, null if not connected
-
newClient
public org.apache.commons.net.ftp.FTPClient newClient()
Returns a new client for the host/port defined in the options.- Returns:
- the client
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
protocolCommandSent
public void protocolCommandSent(org.apache.commons.net.ProtocolCommandEvent event)
This method is invoked by a ProtocolCommandEvent source after sending a protocol command to a server.- Specified by:
protocolCommandSent
in interfaceorg.apache.commons.net.ProtocolCommandListener
- Parameters:
event
- The ProtocolCommandEvent fired.
-
protocolReplyReceived
public void protocolReplyReceived(org.apache.commons.net.ProtocolCommandEvent event)
This method is invoked by a ProtocolCommandEvent source after receiving a reply from a server.- Specified by:
protocolReplyReceived
in interfaceorg.apache.commons.net.ProtocolCommandListener
- Parameters:
event
- The ProtocolCommandEvent fired.
-
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:
requiresInitialization
in interfaceRemoteDirectorySetup
- Returns:
- true if user needs to configure first
-
-