Class MinaScpFileOpener
java.lang.Object
ecmwf.common.ssh.MinaScpFileOpener
- All Implemented Interfaces:
org.apache.sshd.scp.common.ScpFileOpener
public final class MinaScpFileOpener
extends Object
implements org.apache.sshd.scp.common.ScpFileOpener
SCP file-opener that routes all I/O through the virtual ECPDS user session. This enables SCP downloads and uploads
via the same backend as SFTP, using
UserSession.getProxySocketInput(String, long) and
UserSession.getProxySocketOutput(String, long, int) for streaming, and UserSession.getFileListElement(String) for metadata.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.sshd.scp.common.ScpSourceStreamResolvercreateScpSourceStreamResolver(org.apache.sshd.common.session.Session session, Path path) org.apache.sshd.scp.common.ScpTargetStreamResolvercreateScpTargetStreamResolver(org.apache.sshd.common.session.Session session, Path path) getLocalBasicFileAttributes(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) getLocalFilePermissions(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) getLocalFolderChildren(org.apache.sshd.common.session.Session session, Path path) Returns the virtual children of a directory.getMatchingFilesToSend(org.apache.sshd.common.session.Session session, Path path, String pattern) Returns virtual paths whose names matchpatterninside the directory atpath.openRead(org.apache.sshd.common.session.Session session, Path file, long size, Set<PosixFilePermission> permissions, OpenOption... options) openWrite(org.apache.sshd.common.session.Session session, Path file, long size, Set<PosixFilePermission> permissions, OpenOption... options) resolveIncomingFilePath(org.apache.sshd.common.session.Session session, Path path, String name, boolean recursive, Set<PosixFilePermission> perms, org.apache.sshd.scp.common.helpers.ScpTimestampCommandDetails time) Resolves the incoming target path for an SCP upload.resolveIncomingReceiveLocation(org.apache.sshd.common.session.Session session, Path path, boolean recursive, boolean shouldBeDir, boolean preserve) Resolves the root receive location for an SCP upload.resolveLocalPath(org.apache.sshd.common.session.Session session, FileSystem fileSystem, String path) Resolves the SCP command path to a NIOPath.booleansendAsDirectory(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) booleansendAsRegularFile(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.scp.common.ScpFileOpener
checkRemoteFileName, closeRead, closeWrite, resolveOutgoingFilePath
-
Constructor Details
-
MinaScpFileOpener
public MinaScpFileOpener()
-
-
Method Details
-
resolveLocalPath
public Path resolveLocalPath(org.apache.sshd.common.session.Session session, FileSystem fileSystem, String path) throws IOException Resolves the SCP command path to a NIOPath. The returned path is always absolute and is used only as a virtual-path carrier — it is never opened on the real local filesystem.- Specified by:
resolveLocalPathin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
sendAsDirectory
public boolean sendAsDirectory(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) throws IOException - Specified by:
sendAsDirectoryin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
sendAsRegularFile
public boolean sendAsRegularFile(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) throws IOException - Specified by:
sendAsRegularFilein interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
getLocalBasicFileAttributes
public BasicFileAttributes getLocalBasicFileAttributes(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) throws IOException - Specified by:
getLocalBasicFileAttributesin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
getLocalFilePermissions
public Set<PosixFilePermission> getLocalFilePermissions(org.apache.sshd.common.session.Session session, Path path, LinkOption... options) throws IOException - Specified by:
getLocalFilePermissionsin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
getLocalFolderChildren
public DirectoryStream<Path> getLocalFolderChildren(org.apache.sshd.common.session.Session session, Path path) throws IOException Returns the virtual children of a directory. UsesUserSession.getFileList(String)to enumerate entries and maps each name to a child path underpath.- Specified by:
getLocalFolderChildrenin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
getMatchingFilesToSend
public Iterable<Path> getMatchingFilesToSend(org.apache.sshd.common.session.Session session, Path path, String pattern) throws IOException Returns virtual paths whose names matchpatterninside the directory atpath. Ifpathpoints to a regular file, returns it directly.- Specified by:
getMatchingFilesToSendin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
resolveIncomingFilePath
public Path resolveIncomingFilePath(org.apache.sshd.common.session.Session session, Path path, String name, boolean recursive, Set<PosixFilePermission> perms, org.apache.sshd.scp.common.helpers.ScpTimestampCommandDetails time) throws IOException Resolves the incoming target path for an SCP upload. If the target path is an existing virtual directory the uploaded file is placed inside it (aspath/name); otherwise the file is created atpathdirectly.- Specified by:
resolveIncomingFilePathin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
resolveIncomingReceiveLocation
public Path resolveIncomingReceiveLocation(org.apache.sshd.common.session.Session session, Path path, boolean recursive, boolean shouldBeDir, boolean preserve) throws IOException Resolves the root receive location for an SCP upload. Returnspathunchanged; directory creation, if needed, is handled by the backend.- Specified by:
resolveIncomingReceiveLocationin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
openRead
public InputStream openRead(org.apache.sshd.common.session.Session session, Path file, long size, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException - Specified by:
openReadin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
openWrite
public OutputStream openWrite(org.apache.sshd.common.session.Session session, Path file, long size, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException - Specified by:
openWritein interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
createScpSourceStreamResolver
public org.apache.sshd.scp.common.ScpSourceStreamResolver createScpSourceStreamResolver(org.apache.sshd.common.session.Session session, Path path) throws IOException - Specified by:
createScpSourceStreamResolverin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-
createScpTargetStreamResolver
public org.apache.sshd.scp.common.ScpTargetStreamResolver createScpTargetStreamResolver(org.apache.sshd.common.session.Session session, Path path) throws IOException - Specified by:
createScpTargetStreamResolverin interfaceorg.apache.sshd.scp.common.ScpFileOpener- Throws:
IOException
-