Interface SftpFileSystemAccessor
-
public interface SftpFileSystemAccessor
-
-
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 java.util.List<java.lang.String>
DEFAULT_UNIX_VIEW
static java.util.NavigableMap<java.lang.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 java.lang.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, java.nio.file.Path dir, java.lang.String handle, java.nio.file.DirectoryStream<java.nio.file.Path> ds)
Called when a directory stream is no longer requireddefault void
closeFile(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel, java.util.Set<? extends java.nio.file.OpenOption> options)
Called to inform the accessor that it should close the filedefault java.nio.file.DirectoryStream<java.nio.file.Path>
openDirectory(ServerSession session, SftpEventListenerManager subsystem, DirectoryHandle dirHandle, java.nio.file.Path dir, java.lang.String handle)
Called when a new directory stream is requesteddefault java.nio.channels.SeekableByteChannel
openFile(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, java.nio.file.Path file, java.lang.String handle, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs)
Called whenever a new file is openeddefault void
syncFileData(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel)
Called when file meta-data re-synchronization is requireddefault java.nio.channels.FileLock
tryLock(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel, long position, long size, boolean shared)
Called when locking a section of a file is requested
-
-
-
Field Detail
-
DEFAULT_UNIX_VIEW
static final java.util.List<java.lang.String> DEFAULT_UNIX_VIEW
-
FILEATTRS_RESOLVERS
static final java.util.NavigableMap<java.lang.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 java.lang.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 java.nio.channels.SeekableByteChannel openFile(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, java.nio.file.Path file, java.lang.String handle, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs) throws java.io.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:
java.io.IOException
- If failed to open
-
tryLock
default java.nio.channels.FileLock tryLock(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel, long position, long size, boolean shared) throws java.io.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:
java.io.IOException
- If failed to honor the request- See Also:
FileChannel.tryLock(long, long, boolean)
-
syncFileData
default void syncFileData(ServerSession session, SftpEventListenerManager subsystem, FileHandle fileHandle, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel) throws java.io.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:
java.io.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, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel, java.util.Set<? extends java.nio.file.OpenOption> options) throws java.io.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:
java.io.IOException
- If failed to execute the request
-
openDirectory
default java.nio.file.DirectoryStream<java.nio.file.Path> openDirectory(ServerSession session, SftpEventListenerManager subsystem, DirectoryHandle dirHandle, java.nio.file.Path dir, java.lang.String handle) throws java.io.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:
java.io.IOException
- If failed to open
-
closeDirectory
default void closeDirectory(ServerSession session, SftpEventListenerManager subsystem, DirectoryHandle dirHandle, java.nio.file.Path dir, java.lang.String handle, java.nio.file.DirectoryStream<java.nio.file.Path> ds) throws java.io.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:
java.io.IOException
- If failed to open
-
-