Interface SftpFileSystemAccessor
-
public interface SftpFileSystemAccessor
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static SftpFileSystemAccessor
DEFAULT
static boolean
DEFAULT_AUTO_SYNC_FILE_ON_CLOSE
Default value for "sftp-auto-fsync-on-close" if none setstatic List<String>
DEFAULT_UNIX_VIEW
static NavigableMap<String,FileInfoExtractor<?>>
FILEATTRS_RESOLVERS
A case insensitiveNavigableMap
ofFileInfoExtractor
s to be used to complete attributes that are deemed important enough to warrant an extra effort if not accessible via the file system attributes viewsstatic String
PROP_AUTO_SYNC_FILE_ON_CLOSE
Whether to invokeFileChannel.force(boolean)
on files open for write when closing
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
closeDirectory(ServerSession session, SftpEventListenerManager subsystem, DirectoryHandle dirHandle, Path dir, String handle, DirectoryStream<Path> ds)
Called when a directory stream is no longer requireddefault void
closeFile(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Channel channel, Set<? extends OpenOption> options)
Called to inform the accessor that it should close the filedefault DirectoryStream<Path>
openDirectory(ServerSession session, SftpEventListenerManager subsystem, DirectoryHandle dirHandle, Path dir, String handle)
Called when a new directory stream is requesteddefault SeekableByteChannel
openFile(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
Called whenever a new file is openeddefault void
syncFileData(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Channel channel)
Called when file meta-data re-synchronization is requireddefault FileLock
tryLock(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Channel channel, long position, long size, boolean shared)
Called when locking a section of a file is requested
-
-
-
Field Detail
-
FILEATTRS_RESOLVERS
static final NavigableMap<String,FileInfoExtractor<?>> FILEATTRS_RESOLVERS
A case insensitiveNavigableMap
ofFileInfoExtractor
s to be used to complete attributes that are deemed important enough to warrant an extra effort if not accessible via the file system attributes views
-
PROP_AUTO_SYNC_FILE_ON_CLOSE
static final String PROP_AUTO_SYNC_FILE_ON_CLOSE
Whether to invokeFileChannel.force(boolean)
on files open for write when closing- See Also:
- Constant Field Values
-
DEFAULT_AUTO_SYNC_FILE_ON_CLOSE
static final boolean DEFAULT_AUTO_SYNC_FILE_ON_CLOSE
Default value for "sftp-auto-fsync-on-close" if none set- See Also:
- Constant Field Values
-
DEFAULT
static final SftpFileSystemAccessor DEFAULT
-
-
Method Detail
-
openFile
default SeekableByteChannel openFile(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
Called whenever a new file is opened- Parameters:
session
- TheServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessionfileHandle
- TheFileHandle
representing the created channel - may benull
if not invoked within the context of such a handle (special cases)file
- The requested local filePath
handle
- The assigned file handle through which the remote peer references this file. May benull
/empty if the request is due to some internal functionality instead of due to peer requesting a handle to a file.options
- The requestedOpenOption
sattrs
- The requestedFileAttribute
s- Returns:
- The opened
SeekableByteChannel
- Throws:
IOException
- If failed to open
-
tryLock
default FileLock tryLock(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Channel channel, long position, long size, boolean shared) throws IOException
Called when locking a section of a file is requested- Parameters:
session
- TheServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessionfileHandle
- TheFileHandle
representing the created channelfile
- The requested local filePath
handle
- The assigned file handle through which the remote peer references this filechannel
- The originalChannel
that was returned byopenFile(ServerSession, SftpEventListenerManager, FileHandle, Path, String, Set, FileAttribute...)
position
- The position at which the locked region is to start - must be non-negativesize
- The size of the locked region; must be non-negative, and the sum position + size must be non-negativeshared
-true
to request a shared lock,false
to request an exclusive lock- Returns:
- A lock object representing the newly-acquired lock, or
null
if the lock could not be acquired because another program holds an overlapping lock - Throws:
IOException
- If failed to honor the request- See Also:
FileChannel.tryLock(long, long, boolean)
-
syncFileData
default void syncFileData(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Channel channel) throws IOException
Called when file meta-data re-synchronization is required- Parameters:
session
- TheServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessionfileHandle
- TheFileHandle
representing the created channelfile
- The requested local filePath
handle
- The assigned file handle through which the remote peer references this filechannel
- The originalChannel
that was returned byopenFile(ServerSession, SftpEventListenerManager, FileHandle, Path, String, Set, FileAttribute...)
- Throws:
IOException
- If failed to execute the request- See Also:
FileChannel.force(boolean)
, OpenSSH - section 10
-
closeFile
default void closeFile(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, Path file, String handle, Channel channel, Set<? extends OpenOption> options) throws IOException
Called to inform the accessor that it should close the file- Parameters:
session
- TheServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessionfileHandle
- TheFileHandle
representing the created channel - may benull
if not invoked within the context of such a handle (special cases)file
- The requested local filePath
handle
- The assigned file handle through which the remote peer references this filechannel
- The originalChannel
that was returned byopenFile(ServerSession, SftpEventListenerManager, FileHandle, Path, String, Set, FileAttribute...)
options
- The original options used to open the channel- Throws:
IOException
- If failed to execute the request
-
openDirectory
default DirectoryStream<Path> openDirectory(ServerSession session, SftpEventListenerManager subsystem, DirectoryHandle dirHandle, Path dir, String handle) throws IOException
Called when a new directory stream is requested- Parameters:
session
- TheServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessiondirHandle
- TheDirectoryHandle
representing the streamdir
- The requested local directoryhandle
- The assigned directory handle through which the remote peer references this directory- Returns:
- The opened
DirectoryStream
- Throws:
IOException
- If failed to open
-
closeDirectory
default void closeDirectory(ServerSession session, SftpEventListenerManager subsystem, DirectoryHandle dirHandle, Path dir, String handle, DirectoryStream<Path> ds) throws IOException
Called when a directory stream is no longer required- Parameters:
session
- TheServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessiondirHandle
- TheDirectoryHandle
representing the stream - may benull
if not invoked within the context of such a handle (special cases)dir
- The requested local directoryhandle
- The assigned directory handle through which the remote peer references this directoryds
- The disposedDirectoryStream
- Throws:
IOException
- If failed to open
-
-