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 RemoteDirectionm_Directionthe direction.protected LocalFileOperationsm_LocalOperationsfor 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 Stringcopy(String source, String target)Copies a file/dir.protected StringcopyDir(String source, String target)Copies a directory.protected abstract StringcopyFile(String source, String target)Copies a file.Stringdelete(String path)Deletes a file/dir.protected StringdeleteLocal(String path)Deletes a local file/dir.protected abstract StringdeleteRemote(String path)Deletes a remote file/dir.Stringduplicate(String source, String target)Duplicates a file/dir.RemoteDirectiongetDirection()Returns the direction of the operations.protected voidinitialize()Initializes the members.booleanisDir(String path)Checks whether the path is a directory.protected booleanisDirLocal(String path)Checks whether the local path is a directory.protected abstract booleanisDirRemote(String path)Checks whether the remote path is a directory.Stringmkdir(String dir)Creates the directory.protected StringmkdirLocal(String dir)Creates the local directory.protected abstract StringmkdirRemote(String dir)Creates the remote directory.Stringmove(String source, String target)Moves a file/dir.protected abstract DirectoryListernewRemoteDirectoryLister()Returns an instance of the remote directory lister.Stringrename(String source, String target)Renames a file/dir.protected StringrenameLocal(String source, String target)Renames a local file/dir.protected abstract StringrenameRemote(String source, String target)Renames a remote file/dir.voidsetDirection(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:
initializein classAbstractFileOperations
-
setDirection
public void setDirection(RemoteDirection value)
Sets the direction for the operations.- Specified by:
setDirectionin interfaceRemoteFileOperations- Parameters:
value- the direction
-
getDirection
public RemoteDirection getDirection()
Returns the direction of the operations.- Specified by:
getDirectionin 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:
copyin 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:
duplicatein 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:
renamein 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:
movein 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:
deletein 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:
mkdirin 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:
isDirin interfaceFileOperations- Parameters:
path- the path to check- Returns:
- true if path exists and is a directory
-
-