Package adams.core.io.fileoperations
Class SmbFileOperations
- 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.SmbFileOperations
-
- All Implemented Interfaces:
FileOperations,RemoteFileOperations,LoggingLevelHandler,LoggingSupporter,SizeOfHandler,Serializable
public class SmbFileOperations extends AbstractRemoteFileOperations
SMB / Windows share file operations.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected com.hierynomus.smbj.share.DiskSharem_DiskSharethe diskshare instance.protected SMBSessionProviderm_Providerthe authentication provider to use.protected Stringm_Sharethe share to access.-
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 SmbFileOperations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanUpSmb()Cleans up SMB resources.protected StringcopyFile(String source, String target)Copies a file.protected StringdeleteRemote(String path)Deletes a remote file/dir.protected com.hierynomus.smbj.share.DiskSharegetDiskShare()Returns the disk share to use.SMBSessionProvidergetProvider()Returns the authentication provider in use.StringgetShare()Returns the share to access.protected booleanisDirRemote(String path)Checks whether the remote path is a directory.booleanisSupported(Operation op)Checks whether the given operation is supported.protected StringmkdirRemote(String dir)Creates the remote directory.protected DirectoryListernewRemoteDirectoryLister()Returns an instance of the remote directory lister.protected StringrenameRemote(String source, String target)Renames a remote file/dir.voidsetProvider(SMBSessionProvider value)Sets the authentication provider to use.voidsetShare(String value)Sets the share to access.-
Methods inherited from class adams.core.io.fileoperations.AbstractRemoteFileOperations
copy, copyDir, delete, deleteLocal, duplicate, getDirection, initialize, isDir, isDirLocal, mkdir, mkdirLocal, move, 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 SMBSessionProvider m_Provider
the authentication provider to use.
-
m_Share
protected String m_Share
the share to access.
-
m_DiskShare
protected transient com.hierynomus.smbj.share.DiskShare m_DiskShare
the diskshare instance.
-
-
Method Detail
-
cleanUpSmb
protected void cleanUpSmb()
Cleans up SMB resources.
-
getDiskShare
protected com.hierynomus.smbj.share.DiskShare getDiskShare()
Returns the disk share to use.- Returns:
- the share
-
setProvider
public void setProvider(SMBSessionProvider value)
Sets the authentication provider to use.- Parameters:
value- the provider
-
getProvider
public SMBSessionProvider getProvider()
Returns the authentication provider in use.- Returns:
- the provider, null if none set
-
setShare
public void setShare(String value)
Sets the share to access.- Parameters:
value- the share
-
getShare
public String getShare()
Returns the share to access.- Returns:
- the share
-
isSupported
public boolean isSupported(Operation op)
Checks whether the given operation is supported.- Parameters:
op- the operation to check- Returns:
- true if supported
-
copyFile
protected String copyFile(String source, String target)
Copies a file.- Specified by:
copyFilein classAbstractRemoteFileOperations- Parameters:
source- the source filetarget- the target file- Returns:
- null if successful, otherwise error message
-
newRemoteDirectoryLister
protected DirectoryLister newRemoteDirectoryLister()
Returns an instance of the remote directory lister.- Specified by:
newRemoteDirectoryListerin classAbstractRemoteFileOperations- Returns:
- the directory lister
-
renameRemote
protected String renameRemote(String source, String target)
Renames a remote file/dir.- Specified by:
renameRemotein classAbstractRemoteFileOperations- Parameters:
source- the source file/dir (old)target- the target file/dir (new)- Returns:
- null if successful, otherwise error message
-
deleteRemote
protected String deleteRemote(String path)
Deletes a remote file/dir.- Specified by:
deleteRemotein classAbstractRemoteFileOperations- Parameters:
path- the file/dir to delete- Returns:
- null if successful, otherwise error message
-
mkdirRemote
protected String mkdirRemote(String dir)
Creates the remote directory.- Specified by:
mkdirRemotein classAbstractRemoteFileOperations- Parameters:
dir- the directory to create- Returns:
- null if successful, otherwise error message
-
isDirRemote
protected boolean isDirRemote(String path)
Checks whether the remote path is a directory.- Specified by:
isDirRemotein classAbstractRemoteFileOperations- Parameters:
path- the path to check- Returns:
- true if path exists and is a directory
-
-