Package adams.core.io.fileoperations
Class AbstractRemoteFileOperations
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.io.fileoperations.AbstractFileOperations
-
- adams.core.io.fileoperations.AbstractRemoteFileOperations
-
- All Implemented Interfaces:
FileOperations
,RemoteFileOperations
,LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
SftpFileOperations
,SmbFileOperations
public abstract class AbstractRemoteFileOperations extends AbstractFileOperations implements RemoteFileOperations
Ancestor for remote file operation classes.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected RemoteDirection
m_Direction
the direction.protected LocalFileOperations
m_LocalOperations
for local file operations.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractRemoteFileOperations()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
copy(String source, String target)
Copies a file/dir.protected String
copyDir(String source, String target)
Copies a directory.protected abstract String
copyFile(String source, String target)
Copies a file.String
delete(String path)
Deletes a file/dir.protected String
deleteLocal(String path)
Deletes a local file/dir.protected abstract String
deleteRemote(String path)
Deletes a remote file/dir.String
duplicate(String source, String target)
Duplicates a file/dir.RemoteDirection
getDirection()
Returns the direction of the operations.protected void
initialize()
Initializes the members.boolean
isDir(String path)
Checks whether the path is a directory.protected boolean
isDirLocal(String path)
Checks whether the local path is a directory.protected abstract boolean
isDirRemote(String path)
Checks whether the remote path is a directory.String
mkdir(String dir)
Creates the directory.protected String
mkdirLocal(String dir)
Creates the local directory.protected abstract String
mkdirRemote(String dir)
Creates the remote directory.String
move(String source, String target)
Moves a file/dir.protected abstract DirectoryLister
newRemoteDirectoryLister()
Returns an instance of the remote directory lister.String
rename(String source, String target)
Renames a file/dir.protected String
renameLocal(String source, String target)
Renames a local file/dir.protected abstract String
renameRemote(String source, String target)
Renames a remote file/dir.void
setDirection(RemoteDirection value)
Sets the direction for the operations.-
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.io.fileoperations.FileOperations
isSupported
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Direction
protected RemoteDirection m_Direction
the direction.
-
m_LocalOperations
protected LocalFileOperations m_LocalOperations
for local file operations.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractFileOperations
-
setDirection
public void setDirection(RemoteDirection value)
Sets the direction for the operations.- Specified by:
setDirection
in interfaceRemoteFileOperations
- Parameters:
value
- the direction
-
getDirection
public RemoteDirection getDirection()
Returns the direction of the operations.- Specified by:
getDirection
in interfaceRemoteFileOperations
- Returns:
- the direction
-
copyFile
protected abstract String copyFile(String source, String target)
Copies a file.- Parameters:
source
- the source filetarget
- the target file- Returns:
- null if successful, otherwise error message
-
newRemoteDirectoryLister
protected abstract DirectoryLister newRemoteDirectoryLister()
Returns an instance of the remote directory lister.- Returns:
- the directory lister
-
copyDir
protected String copyDir(String source, String target)
Copies a directory.- Parameters:
source
- the source dirtarget
- the target dir- Returns:
- null if successful, otherwise error message
-
copy
public String copy(String source, String target)
Copies a file/dir.- Specified by:
copy
in interfaceFileOperations
- Parameters:
source
- the source file/dirtarget
- the target file/dir- Returns:
- null if successful, otherwise error message
-
duplicate
public String duplicate(String source, String target)
Duplicates a file/dir. Not implemented!- Specified by:
duplicate
in interfaceFileOperations
- Parameters:
source
- the source file/dirtarget
- the target file/dir- Returns:
- null if successful, otherwise error message
-
renameLocal
protected String renameLocal(String source, String target)
Renames a local file/dir.- Parameters:
source
- the source file/dir (old)target
- the target file/dir (new)- Returns:
- null if successful, otherwise error message
-
renameRemote
protected abstract String renameRemote(String source, String target)
Renames a remote file/dir.- Parameters:
source
- the source file/dir (old)target
- the target file/dir (new)- Returns:
- null if successful, otherwise error message
-
rename
public String rename(String source, String target)
Renames a file/dir.- Specified by:
rename
in interfaceFileOperations
- Parameters:
source
- the source file/dir (old)target
- the target file/dir (new)- Returns:
- null if successful, otherwise error message
-
move
public String move(String source, String target)
Moves a file/dir.- Specified by:
move
in interfaceFileOperations
- Parameters:
source
- the source file/dirtarget
- the target file/dir- Returns:
- null if successful, otherwise error message
-
deleteLocal
protected String deleteLocal(String path)
Deletes a local file/dir.- Parameters:
path
- the file/dir to delete- Returns:
- null if successful, otherwise error message
-
deleteRemote
protected abstract String deleteRemote(String path)
Deletes a remote file/dir.- Parameters:
path
- the file/dir to delete- Returns:
- null if successful, otherwise error message
-
delete
public String delete(String path)
Deletes a file/dir.- Specified by:
delete
in interfaceFileOperations
- Parameters:
path
- the file/dir to delete- Returns:
- null if successful, otherwise error message
-
mkdirLocal
protected String mkdirLocal(String dir)
Creates the local directory.- Parameters:
dir
- the directory to create- Returns:
- null if successful, otherwise error message
-
mkdirRemote
protected abstract String mkdirRemote(String dir)
Creates the remote directory.- Parameters:
dir
- the directory to create- Returns:
- null if successful, otherwise error message
-
mkdir
public String mkdir(String dir)
Creates the directory.- Specified by:
mkdir
in interfaceFileOperations
- Parameters:
dir
- the directory to create- Returns:
- null if successful, otherwise error message
-
isDirLocal
protected boolean isDirLocal(String path)
Checks whether the local path is a directory.- Parameters:
path
- the path to check- Returns:
- true if path exists and is a directory
-
isDirRemote
protected abstract boolean isDirRemote(String path)
Checks whether the remote path is a directory.- Parameters:
path
- the path to check- Returns:
- true if path exists and is a directory
-
isDir
public boolean isDir(String path)
Checks whether the path is a directory.- Specified by:
isDir
in interfaceFileOperations
- Parameters:
path
- the path to check- Returns:
- true if path exists and is a directory
-
-