Class MinaFileSystemAccessor
java.lang.Object
ecmwf.common.ssh.MinaFileSystemAccessor
- All Implemented Interfaces:
org.apache.sshd.sftp.server.SftpFileSystemAccessor
public class MinaFileSystemAccessor
extends Object
implements org.apache.sshd.sftp.server.SftpFileSystemAccessor
- Author:
- Apache MINA SSHD Project
-
Field Summary
Fields inherited from interface org.apache.sshd.sftp.server.SftpFileSystemAccessor
DEFAULT, DEFAULT_AUTO_SYNC_FILE_ON_CLOSE, DEFAULT_UNIX_VIEW, FILEATTRS_RESOLVERS, PROP_AUTO_SYNC_FILE_ON_CLOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyExtensionFileAttributes(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Map<String, byte[]> extensions, LinkOption... options) voidcloseDirectory(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.DirectoryHandle dirHandle, Path dir, String handle, DirectoryStream<Path> ds) Called when a directory stream is no longer requiredvoidcloseFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.FileHandle fileHandle, Path file, String handle, Channel channel, Set<? extends OpenOption> options) Called to inform the accessor that it should close the filevoidClose all files open.voidcopyFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path src, Path dst, Collection<CopyOption> opts) voidcreateDirectory(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path path) voidcreateLink(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path link, Path existing, boolean symLink) booleannoFollow(Collection<?> opts) openDirectory(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.DirectoryHandle dirHandle, Path dir, String handle, LinkOption... linkOptions) Called when a new directory stream is requestedopenFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.FileHandle fileHandle, Path file, String handle, Set<? extends OpenOption> options, FileAttribute<?>... attrs) voidputRemoteFileName(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path path, org.apache.sshd.common.util.buffer.Buffer buf, String name, boolean shortName) readFileAttributes(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, String view, LinkOption... options) voidremoveFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path path, boolean isDirectory) voidrenameFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path oldPath, Path newPath, Collection<CopyOption> opts) resolveLocalFilePath(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path rootDir, String remotePath) Invoked in order to resolve remote file paths reference by the client into ones accessible by the serverresolveReportedFileAttributes(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, int flags, NavigableMap<String, Object> attrs, LinkOption... options) voidsetFileAccessControl(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, List<AclEntry> acl, LinkOption... options) voidsetFileAttribute(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, String view, String attribute, Object value, LinkOption... options) voidsetFileOwner(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Principal value, LinkOption... options) voidsetFilePermissions(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Set<PosixFilePermission> perms, LinkOption... options) voidsetGroupOwner(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Principal value, LinkOption... options) voidsyncFileData(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.FileHandle fileHandle, Path file, String handle, Channel channel) tryLock(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.FileHandle fileHandle, Path file, String handle, Channel channel, long position, long size, boolean shared) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.sftp.server.SftpFileSystemAccessor
resolveFileAccessLinkOptions, resolveFileOwner, resolveGroupOwner, resolveLinkTarget
-
Constructor Details
-
MinaFileSystemAccessor
public MinaFileSystemAccessor()
-
-
Method Details
-
closeFilesystem
public void closeFilesystem()Close all files open. -
resolveLocalFilePath
public Path resolveLocalFilePath(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path rootDir, String remotePath) throws IOException, InvalidPathException Invoked in order to resolve remote file paths reference by the client into ones accessible by the server- Specified by:
resolveLocalFilePathin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Parameters:
subsystem- The SFTP subsystem instance that manages the sessionrootDir- The default root directory used to resolve relative paths - a.k.a. thechrootlocationremotePath- The remote path - separated by '/'- Returns:
- The local
Path - Throws:
IOException- If failed to resolve the local pathInvalidPathException- If bad local path specification- See Also:
-
applyExtensionFileAttributes
public void applyExtensionFileAttributes(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Map<String, byte[]> extensions, LinkOption... options) throws IOException- Specified by:
applyExtensionFileAttributesin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
putRemoteFileName
public void putRemoteFileName(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path path, org.apache.sshd.common.util.buffer.Buffer buf, String name, boolean shortName) throws IOException - Specified by:
putRemoteFileNamein interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
openFile
public SeekableByteChannel openFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.FileHandle fileHandle, Path file, String handle, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException - Specified by:
openFilein interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
tryLock
public FileLock tryLock(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.FileHandle fileHandle, Path file, String handle, Channel channel, long position, long size, boolean shared) throws IOException - Specified by:
tryLockin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
syncFileData
public void syncFileData(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.FileHandle fileHandle, Path file, String handle, Channel channel) throws IOException - Specified by:
syncFileDatain interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
closeFile
public void closeFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.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- Specified by:
closeFilein interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Parameters:
subsystem- The SFTP subsystem instance that manages the sessionfileHandle- TheFileHandlerepresenting the created channel - may benullif not invoked within the context of such a handle (special cases)file- The requested local filePath- same one returned byresolveLocalFilePathhandle- The assigned file handle through which the remote peer references this filechannel- The originalChannelthat was returned byopenFile(SftpSubsystemProxy, FileHandle, Path, String, Set, FileAttribute...)options- The original options used to open the channel- Throws:
IOException- If failed to execute the request
-
openDirectory
public DirectoryStream<Path> openDirectory(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.DirectoryHandle dirHandle, Path dir, String handle, LinkOption... linkOptions) throws IOException Called when a new directory stream is requested- Specified by:
openDirectoryin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Parameters:
subsystem- The SFTP subsystem instance that manages the sessiondirHandle- TheDirectoryHandlerepresenting the streamdir- The requested local directoryPath- same one returned byresolveLocalFilePathhandle- The assigned directory handle through which the remote peer references this directorylinkOptions- TheLinkOptions - OK ifnull/empty.- Returns:
- The opened
DirectoryStream - Throws:
IOException- If failed to open
-
closeDirectory
public void closeDirectory(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, org.apache.sshd.sftp.server.DirectoryHandle dirHandle, Path dir, String handle, DirectoryStream<Path> ds) throws IOException Called when a directory stream is no longer required- Specified by:
closeDirectoryin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Parameters:
subsystem- The SFTP subsystem instance that manages the sessiondirHandle- TheDirectoryHandlerepresenting the stream - may benullif not invoked within the context of such a handle (special cases)dir- The requested local directoryPath- same one returned byresolveLocalFilePathhandle- The assigned directory handle through which the remote peer references this directoryds- The disposedDirectoryStream- Throws:
IOException- If failed to open
-
readFileAttributes
public Map<String,?> readFileAttributes(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, String view, LinkOption... options) throws IOException - Specified by:
readFileAttributesin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
setFileAttribute
public void setFileAttribute(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, String view, String attribute, Object value, LinkOption... options) throws IOException - Specified by:
setFileAttributein interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
setFileOwner
public void setFileOwner(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Principal value, LinkOption... options) throws IOException - Specified by:
setFileOwnerin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
setGroupOwner
public void setGroupOwner(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Principal value, LinkOption... options) throws IOException - Specified by:
setGroupOwnerin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
setFilePermissions
public void setFilePermissions(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, Set<PosixFilePermission> perms, LinkOption... options) throws IOException - Specified by:
setFilePermissionsin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
setFileAccessControl
public void setFileAccessControl(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path file, List<AclEntry> acl, LinkOption... options) throws IOException - Specified by:
setFileAccessControlin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
createDirectory
public void createDirectory(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path path) throws IOException - Specified by:
createDirectoryin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
createLink
public void createLink(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path link, Path existing, boolean symLink) throws IOException - Specified by:
createLinkin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
renameFile
public void renameFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path oldPath, Path newPath, Collection<CopyOption> opts) throws IOException - Specified by:
renameFilein interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
copyFile
public void copyFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path src, Path dst, Collection<CopyOption> opts) throws IOException - Specified by:
copyFilein interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
removeFile
public void removeFile(org.apache.sshd.sftp.server.SftpSubsystemProxy subsystem, Path path, boolean isDirectory) throws IOException - Specified by:
removeFilein interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor- Throws:
IOException
-
noFollow
- Specified by:
noFollowin interfaceorg.apache.sshd.sftp.server.SftpFileSystemAccessor
-