Class Samba2FileSystem
java.lang.Object
org.frankframework.filesystem.AbstractFileSystem<SmbFileRef>
org.frankframework.filesystem.smb.Samba2FileSystem
- All Implemented Interfaces:
AutoCloseable
,HasPhysicalDestination
,IBasicFileSystem<SmbFileRef>
,IWritableFileSystem<SmbFileRef>
public class Samba2FileSystem
extends AbstractFileSystem<SmbFileRef>
implements IWritableFileSystem<SmbFileRef>
Uses the (newer) SMB 2 and 3 protocol.
Possible error codes:
Pre-authentication information was invalid (24) / Idenitfier doesn't match expected value (906): login information is incorrect Server not found in Kerberos database (7): Verify that the hostname is the FQDN and the server is using a valid SPN.
Pre-authentication information was invalid (24) / Idenitfier doesn't match expected value (906): login information is incorrect Server not found in Kerberos database (7): Verify that the hostname is the FQDN and the server is using a valid SPN.
- Author:
- Ali Sihab, Niels Meijer
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.frankframework.filesystem.AbstractFileSystem
log
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
copyFile
(SmbFileRef f, String destinationFolder, boolean createFolder) Copies the file to another folder.void
createFolder
(String folder) void
boolean
exists
(SmbFileRef f) boolean
folderExists
(String folder) long
getName
(SmbFileRef file) Get a string representation of an identification of a file.boolean
isFolder
(SmbFileRef smbFileRef) list
(String folder, TypeFilter filter) Lists files, directories or both, from a 'folder' or in the 'root' of the filesystem (when folder is null).moveFile
(SmbFileRef f, String destinationFolder, boolean createFolder) Moves the file to another folder.void
open()
readFile
(SmbFileRef filename, String charset) void
removeFolder
(String folder, boolean removeNonEmptyFolder) renameFile
(SmbFileRef source, SmbFileRef destination) Renames the file to a new name, possibly in a another folder.void
setAuthAlias
(String authAlias) alias used to obtain credentials for the smb sharevoid
setAuthType
(Samba2FileSystem.Samba2AuthType authType) Type of the authentication either 'NTLM' or 'SPNEGO'.void
setDomainName
(String domain) NTLM only: logon/authentication domain, in case the user account is bound to a domain such as Active Directory.void
setHostname
(String hostname) Hostname of the SMB share.void
SPNEGO only: Key Distribution Center, typically hosted on a domain controller.void
setListHiddenFiles
(boolean listHiddenFiles) Controls if hidden files are seenvoid
setPassword
(String password) the smb share passwordvoid
setPort
(int port) Port to connect to.void
SPNEGO only: Kerberos Realm, case sensitive.void
May not contain '\\' characters.void
setUsername
(String username) the smb share usernameGet a file 'F' representation of an identification of a file.Creates a reference to a file.Methods inherited from class org.frankframework.filesystem.AbstractFileSystem
getMaxNumberOfMessagesToList, getNumberOfFilesInFolder, isOpen, setMaxNumberOfMessagesToList
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.frankframework.core.HasPhysicalDestination
getDomain
Methods inherited from interface org.frankframework.filesystem.IBasicFileSystem
getCanonicalNameOrErrorMessage, getNumberOfFilesInFolder, isOpen
Methods inherited from interface org.frankframework.filesystem.IWritableFileSystem
appendFile, createFile
-
Constructor Details
-
Samba2FileSystem
public Samba2FileSystem()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
ConfigurationException
-
open
- Specified by:
open
in interfaceIBasicFileSystem<SmbFileRef>
- Overrides:
open
in classAbstractFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceIBasicFileSystem<SmbFileRef>
- Overrides:
close
in classAbstractFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
toFile
Description copied from interface:IBasicFileSystem
Get a file 'F' representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.getName(Object)
.- Specified by:
toFile
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
toFile
public SmbFileRef toFile(@Nullable String folder, @Nullable String filename) throws FileSystemException Description copied from interface:IBasicFileSystem
Creates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Specified by:
toFile
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
list
public DirectoryStream<SmbFileRef> list(String folder, TypeFilter filter) throws FileSystemException Description copied from interface:IBasicFileSystem
Lists files, directories or both, from a 'folder' or in the 'root' of the filesystem (when folder is null). Only lists the objects as defined by the type filter.- Specified by:
list
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
exists
- Specified by:
exists
in interfaceIBasicFileSystem<SmbFileRef>
-
isFolder
- Specified by:
isFolder
in interfaceIBasicFileSystem<SmbFileRef>
-
createFile
- Specified by:
createFile
in interfaceIWritableFileSystem<SmbFileRef>
- Throws:
FileSystemException
IOException
-
appendFile
- Specified by:
appendFile
in interfaceIWritableFileSystem<SmbFileRef>
- Throws:
FileSystemException
IOException
-
readFile
- Specified by:
readFile
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
deleteFile
- Specified by:
deleteFile
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
renameFile
Description copied from interface:IWritableFileSystem
Renames the file to a new name, possibly in a another folder. Does not need to check for existence of the source or non-existence of the destination.- Specified by:
renameFile
in interfaceIWritableFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
moveFile
public SmbFileRef moveFile(SmbFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystem
Moves the file to another folder. Does not need to check for existence of the source or non-existence of the destination. Returns the moved file, or null if no file was moved or there is no reference to the moved file.- Specified by:
moveFile
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
copyFile
public SmbFileRef copyFile(SmbFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystem
Copies the file to another folder. Does not need to check for existence of the source or non-existence of the destination. Returns the copied file, or null if no file was copied or there is no reference to the copied file.- Specified by:
copyFile
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
getAdditionalFileProperties
- Specified by:
getAdditionalFileProperties
in interfaceIBasicFileSystem<SmbFileRef>
-
folderExists
- Specified by:
folderExists
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
createFolder
- Specified by:
createFolder
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolder
in interfaceIBasicFileSystem<SmbFileRef>
- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSize
in interfaceIBasicFileSystem<SmbFileRef>
-
getName
Description copied from interface:IBasicFileSystem
Get a string representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.toFile(String)
. Can reflect name a file has in its folder, is not expected to be unique over folders.- Specified by:
getName
in interfaceIBasicFileSystem<SmbFileRef>
-
getParentFolder
- Specified by:
getParentFolder
in interfaceIBasicFileSystem<SmbFileRef>
-
getCanonicalName
- Specified by:
getCanonicalName
in interfaceIBasicFileSystem<SmbFileRef>
-
getModificationTime
- Specified by:
getModificationTime
in interfaceIBasicFileSystem<SmbFileRef>
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in interfaceHasPhysicalDestination
-
setUsername
the smb share username -
setPassword
the smb share password -
setAuthAlias
alias used to obtain credentials for the smb share -
setDomainName
NTLM only: logon/authentication domain, in case the user account is bound to a domain such as Active Directory. -
setAuthType
Type of the authentication either 'NTLM' or 'SPNEGO'. When setting SPNEGO, the host must use the FQDN, and must be registered on the KDC with a valid SPN.- Default value
- SPNEGO
-
setKdc
SPNEGO only: Key Distribution Center, typically hosted on a domain controller. Stored injava.security.krb5.kdc
-
setRealm
SPNEGO only: Kerberos Realm, case sensitive. Typically upper case and the same as the domain name. An Active Directory domain acts as a Kerberos Realm. Stored injava.security.krb5.realm
-
setHostname
Hostname of the SMB share. -
setPort
public void setPort(int port) Port to connect to.- Default value
- 445
-
setListHiddenFiles
public void setListHiddenFiles(boolean listHiddenFiles) Controls if hidden files are seen- Default value
- false
-