Package adams.core.io.fileoperations
Class FtpFileOperations
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.io.fileoperations.AbstractFileOperations
-
- adams.core.io.fileoperations.AbstractRemoteFileOperations
-
- adams.core.io.fileoperations.FtpFileOperations
-
- All Implemented Interfaces:
FileOperations
,RemoteFileOperations
,LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,Serializable
public class FtpFileOperations extends AbstractRemoteFileOperations
FTP file operations.- Version:
- $Revision$
- 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 to use.-
Fields inherited from class adams.core.io.fileoperations.AbstractRemoteFileOperations
m_Direction, m_LocalOperations
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FtpFileOperations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
copy(String source, String target)
Copies a file.protected String
deleteRemote(String file)
Deletes a remote file.org.apache.commons.net.ftp.FTPClient
getClient()
Returns the FTP client in use.boolean
isSupported(Operation op)
Checks whether the given operation is supported.protected String
mkdirRemote(String dir)
Creates the remote directory.String
move(String source, String target)
Moves a file.protected String
renameRemote(String source, String target)
Renames a remote file.void
setClient(org.apache.commons.net.ftp.FTPClient value)
Sets the FTP client to use.-
Methods inherited from class adams.core.io.fileoperations.AbstractRemoteFileOperations
delete, deleteLocal, getDirection, initialize, mkdir, mkdirLocal, rename, renameLocal, setDirection
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
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, toString, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
setClient
public void setClient(org.apache.commons.net.ftp.FTPClient value)
Sets the FTP client to use.- Parameters:
value
- the client
-
getClient
public org.apache.commons.net.ftp.FTPClient getClient()
Returns the FTP client in use.- Returns:
- the client, null if none set
-
isSupported
public boolean isSupported(Operation op)
Checks whether the given operation is supported.- Parameters:
op
- the operation to check- Returns:
- true if supported
-
copy
public String copy(String source, String target)
Copies a file.- Parameters:
source
- the source filetarget
- the target file- Returns:
- null if successful, otherwise error message
-
move
public String move(String source, String target)
Moves a file.- Parameters:
source
- the source filetarget
- the target file- Returns:
- null if successful, otherwise error message
-
renameRemote
protected String renameRemote(String source, String target)
Renames a remote file.- Specified by:
renameRemote
in classAbstractRemoteFileOperations
- Parameters:
source
- the source file (old)target
- the target file (new)- Returns:
- null if successful, otherwise error message
-
deleteRemote
protected String deleteRemote(String file)
Deletes a remote file.- Specified by:
deleteRemote
in classAbstractRemoteFileOperations
- Parameters:
file
- the file to delete- Returns:
- null if successful, otherwise error message
-
mkdirRemote
protected String mkdirRemote(String dir)
Creates the remote directory.- Specified by:
mkdirRemote
in classAbstractRemoteFileOperations
- Parameters:
dir
- the directory to create- Returns:
- null if successful, otherwise error message
-
-