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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendFile(SmbFileRef file, InputStream content) voidclose()voidcopyFile(SmbFileRef f, String destinationFolder, boolean createFolder) Copies the file to another folder.voidcreateFile(SmbFileRef file, InputStream content) voidcreateFolder(String folder) voidbooleanexists(SmbFileRef f) booleanfolderExists(String folder) longgetName(SmbFileRef file) Get a string representation of an identification of a file.booleanisFolder(SmbFileRef smbFileRef) list(SmbFileRef folder, TypeFilter filter) moveFile(SmbFileRef f, String destinationFolder, boolean createFolder) Moves the file to another folder.voidopen()readFile(SmbFileRef filename, String charset) voidremoveFolder(String folder, boolean removeNonEmptyFolder) renameFile(SmbFileRef source, SmbFileRef destination) Renames the file to a new name, possibly in another folder.voidsetAuthAlias(String authAlias) alias used to obtain credentials for the smb sharevoidsetAuthType(Samba2FileSystem.Samba2AuthType authType) Type of the authentication either 'NTLM' or 'SPNEGO'.voidsetDomainName(String domain) NTLM only: logon/authentication domain, in case the user account is bound to a domain such as Active Directory.voidsetHostname(String hostname) Hostname of the SMB share.voidSPNEGO only: Key Distribution Center, typically hosted on a domain controller.voidsetListHiddenFiles(boolean listHiddenFiles) Controls if hidden files are seenvoidsetPassword(String password) the smb share passwordvoidsetPort(int port) Port to connect to.voidSPNEGO only: Kerberos Realm, case sensitive.voidMay not contain '\\' characters.voidsetUsername(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, setMaxNumberOfMessagesToListMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.frankframework.filesystem.IBasicFileSystem
getCanonicalNameOrErrorMessage, getNumberOfFilesInFolder, isOpen, list
-
Constructor Details
-
Samba2FileSystem
public Samba2FileSystem()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceIBasicFileSystem<SmbFileRef>- Throws:
ConfigurationException
-
open
- Specified by:
openin interfaceIBasicFileSystem<SmbFileRef>- Overrides:
openin classAbstractFileSystem<SmbFileRef>- Throws:
FileSystemException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIBasicFileSystem<SmbFileRef>- Overrides:
closein classAbstractFileSystem<SmbFileRef>- Throws:
FileSystemException
-
toFile
Description copied from interface:IBasicFileSystemGet a file 'F' representation of an identification of a file. Must pair up with the implementation ofIBasicFileSystem.getName(Object).- Specified by:
toFilein interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
toFile
public SmbFileRef toFile(@Nullable String folder, @Nullable String filename) throws FileSystemException Description copied from interface:IBasicFileSystemCreates a reference to a file. If filename is not absolute, it will be created in 'defaultFolder'.- Specified by:
toFilein interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
list
public DirectoryStream<SmbFileRef> list(SmbFileRef folder, TypeFilter filter) throws FileSystemException - Specified by:
listin interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
exists
- Specified by:
existsin interfaceIBasicFileSystem<SmbFileRef>
-
isFolder
- Specified by:
isFolderin interfaceIBasicFileSystem<SmbFileRef>
-
createFile
- Specified by:
createFilein interfaceIWritableFileSystem<SmbFileRef>- Parameters:
file- FileSystem file referencecontent- to write or NULL. When NULL existing files should be overwritten, and new files should be created.- Throws:
IOException
-
appendFile
- Specified by:
appendFilein interfaceIWritableFileSystem<SmbFileRef>- Throws:
IOException
-
readFile
public Message readFile(SmbFileRef filename, String charset) throws FileSystemException, IOException - Specified by:
readFilein interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemExceptionIOException
-
deleteFile
- Specified by:
deleteFilein interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
renameFile
Description copied from interface:IWritableFileSystemRenames the file to a new name, possibly in another folder. Does not need to check for the existence of the source or non-existence of the destination.- Specified by:
renameFilein interfaceIWritableFileSystem<SmbFileRef>- Throws:
FileSystemException
-
moveFile
public SmbFileRef moveFile(SmbFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystemMoves 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:
moveFilein interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
copyFile
public SmbFileRef copyFile(SmbFileRef f, String destinationFolder, boolean createFolder) throws FileSystemException Description copied from interface:IBasicFileSystemCopies 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:
copyFilein interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
getAdditionalFileProperties
- Specified by:
getAdditionalFilePropertiesin interfaceIBasicFileSystem<SmbFileRef>
-
folderExists
- Specified by:
folderExistsin interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
createFolder
- Specified by:
createFolderin interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
removeFolder
- Specified by:
removeFolderin interfaceIBasicFileSystem<SmbFileRef>- Throws:
FileSystemException
-
getFileSize
- Specified by:
getFileSizein interfaceIBasicFileSystem<SmbFileRef>
-
getName
Description copied from interface:IBasicFileSystemGet 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:
getNamein interfaceIBasicFileSystem<SmbFileRef>
-
getParentFolder
- Specified by:
getParentFolderin interfaceIBasicFileSystem<SmbFileRef>
-
getCanonicalName
- Specified by:
getCanonicalNamein interfaceIBasicFileSystem<SmbFileRef>
-
getModificationTime
- Specified by:
getModificationTimein interfaceIBasicFileSystem<SmbFileRef>
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationNamein 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
-