Package adams.core.io.fileoperations
Class SftpFileOperations
- 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.SftpFileOperations
-
- All Implemented Interfaces:
FileOperations
,RemoteFileOperations
,LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,Serializable
public class SftpFileOperations extends AbstractRemoteFileOperations
SFTP file operations.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SSHSessionProvider
m_Provider
the session provider 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 SftpFileOperations()
-
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.SSHSessionProvider
getProvider()
Returns the SSH session provider 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
setProvider(SSHSessionProvider value)
Sets the SSH session provider 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
-
-
-
-
Field Detail
-
m_Provider
protected SSHSessionProvider m_Provider
the session provider to use.
-
-
Method Detail
-
setProvider
public void setProvider(SSHSessionProvider value)
Sets the SSH session provider to use.- Parameters:
value
- the provider
-
getProvider
public SSHSessionProvider getProvider()
Returns the SSH session provider in use.- Returns:
- the provider, 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
-
-