public class SftpSubsystem extends Subsystem implements SftpSpecification
com.sshtools.common.sftp.FileSystem to serve files
through the SFTP protocol. This implementation currently supports up to
version 3 of the protocol.| Modifier and Type | Field and Description |
|---|---|
static java.lang.Integer |
SFTP_QUEUE |
static java.lang.String |
SUBSYSTEM_NAME |
context, session, SUBSYSTEM_INCOMING, SUBSYSTEM_OUTGOINGSSH_FX_BYTE_RANGE_LOCK_CONFLICT, SSH_FX_BYTE_RANGE_LOCK_REFUSED, SSH_FX_CANNOT_DELETE, SSH_FX_DELETE_PENDING, SSH_FX_DIR_NOT_EMPTY, SSH_FX_FILE_ALREADY_EXISTS, SSH_FX_FILE_CORRUPT, SSH_FX_FILE_IS_A_DIRECTORY, SSH_FX_GROUP_INVALID, SSH_FX_INVALID_FILENAME, SSH_FX_INVALID_HANDLE, SSH_FX_INVALID_PARAMETER, SSH_FX_LINK_LOOP, SSH_FX_LOCK_CONFLICT, SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK, SSH_FX_NO_MEDIA, SSH_FX_NO_SPACE_ON_FILESYSTEM, SSH_FX_NO_SUCH_PATH, SSH_FX_NOT_A_DIRECTORY, SSH_FX_OWNER_INVALID, SSH_FX_QUOTA_EXCEEDED, SSH_FX_UNKNOWN_PRINCIPAL, SSH_FX_WRITE_PROTECT, SSH_FXP_ATTRS, SSH_FXP_CLOSE, SSH_FXP_DATA, SSH_FXP_EXTENDED, SSH_FXP_EXTENDED_REPLY, SSH_FXP_FSETSTAT, SSH_FXP_FSTAT, SSH_FXP_HANDLE, SSH_FXP_INIT, SSH_FXP_LSTAT, SSH_FXP_MKDIR, SSH_FXP_NAME, SSH_FXP_OPEN, SSH_FXP_OPENDIR, SSH_FXP_READ, SSH_FXP_READDIR, SSH_FXP_READLINK, SSH_FXP_REALPATH, SSH_FXP_REMOVE, SSH_FXP_RENAME, SSH_FXP_RMDIR, SSH_FXP_SETSTAT, SSH_FXP_STAT, SSH_FXP_STATUS, SSH_FXP_SYMLINK, SSH_FXP_VERSION, SSH_FXP_WRITE, STATUS_FX_EOF, STATUS_FX_FAILURE, STATUS_FX_NO_SUCH_FILE, STATUS_FX_OK, STATUS_FX_OP_UNSUPPORTED, STATUS_FX_PERMISSION_DENIED| Constructor and Description |
|---|
SftpSubsystem() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTransferEvent(java.lang.String handle,
TransferEvent evt) |
void |
addWrapper(SftpOperationWrapper wrapper) |
java.lang.String |
checkDefaultPath(java.lang.String path) |
protected void |
cleanupSubsystem() |
protected void |
fireCloseFileEvent(byte[] handle,
java.lang.Exception error) |
protected void |
fireCloseFileEvent(TransferEvent evt,
java.lang.Exception error) |
void |
fireEvent(Event event) |
protected void |
fireMakeDirectoryEvent(java.lang.String path,
java.util.Date started,
java.lang.Exception error) |
protected void |
fireOpenDirectoryEvent(java.lang.String path,
java.util.Date started,
byte[] handle,
java.lang.Exception error) |
protected void |
fireOpenFileEvent(com.sshtools.common.util.UnsignedInteger32 flags,
SftpFileAttributes attrs,
java.lang.String path,
java.util.Date started,
byte[] handle,
java.lang.Exception error) |
protected void |
fireOpenInitEvent(com.sshtools.common.util.UnsignedInteger32 flags,
SftpFileAttributes attrs,
java.lang.String path,
java.util.Date started,
java.lang.Exception error) |
protected void |
fireRemoveFileEvent(java.lang.String path,
java.util.Date started,
java.lang.Exception error) |
protected void |
fireRenameFileEvent(java.lang.String oldpath,
java.lang.String newpath,
java.util.Date started,
java.lang.Exception error) |
protected void |
fireRmDirEvent(java.lang.String path,
java.util.Date started,
java.lang.Exception error) |
protected void |
fireStatEvent(java.lang.String path,
SftpFileAttributes old,
SftpFileAttributes attrs,
java.util.Date started,
java.lang.Exception error) |
protected void |
fireSymlinkEvent(java.lang.String linkpath,
java.lang.String targetpath,
java.util.Date started,
java.lang.Exception error) |
java.lang.String |
getCharsetEncoding() |
AbstractFileSystem |
getFileSystem() |
void |
init(SessionChannel session,
Context context)
Initialize the subsystem with the current session and configuration.
|
protected void |
onMessageReceived(byte[] msg)
Called when a subsystem message has been extracted from the incoming data
stream.
|
protected void |
onSubsystemFree()
Called to free the subsystem and its resources.
|
void |
removeWrapper(SftpOperationWrapper wrapper) |
void |
sendAttributesMessage(int id,
SftpFileAttributes attrs) |
void |
sendFilenameMessage(int id,
SftpFile[] files,
boolean isRealPath,
boolean isAbsolute) |
void |
sendHandleMessage(int id,
byte[] handle) |
void |
sendStatusMessage(int id,
int reason,
java.lang.String description) |
void |
submitTask(java.lang.Runnable runnable) |
cleanup, executeOperation, free, getConnection, getContext, getSession, onFreeMessage, parseMessage, processMessage, sendMessageclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsendMessagepublic static final java.lang.Integer SFTP_QUEUE
public static final java.lang.String SUBSYSTEM_NAME
public void init(SessionChannel session, Context context) throws java.io.IOException, PermissionDeniedException
Subsysteminit in class Subsystemjava.io.IOExceptionPermissionDeniedExceptionprotected void cleanupSubsystem()
cleanupSubsystem in class Subsystemprotected void onSubsystemFree()
onSubsystemFree in class Subsystemprotected void onMessageReceived(byte[] msg)
throws java.io.IOException
SubsystemonMessageReceived in class Subsystemjava.io.IOExceptionprotected void fireStatEvent(java.lang.String path,
SftpFileAttributes old,
SftpFileAttributes attrs,
java.util.Date started,
java.lang.Exception error)
protected void fireSymlinkEvent(java.lang.String linkpath,
java.lang.String targetpath,
java.util.Date started,
java.lang.Exception error)
protected void fireRmDirEvent(java.lang.String path,
java.util.Date started,
java.lang.Exception error)
protected void fireRenameFileEvent(java.lang.String oldpath,
java.lang.String newpath,
java.util.Date started,
java.lang.Exception error)
protected void fireRemoveFileEvent(java.lang.String path,
java.util.Date started,
java.lang.Exception error)
protected void fireOpenFileEvent(com.sshtools.common.util.UnsignedInteger32 flags,
SftpFileAttributes attrs,
java.lang.String path,
java.util.Date started,
byte[] handle,
java.lang.Exception error)
protected void fireOpenInitEvent(com.sshtools.common.util.UnsignedInteger32 flags,
SftpFileAttributes attrs,
java.lang.String path,
java.util.Date started,
java.lang.Exception error)
public void sendHandleMessage(int id,
byte[] handle)
throws java.io.IOException
java.io.IOExceptionprotected void fireCloseFileEvent(byte[] handle,
java.lang.Exception error)
protected void fireCloseFileEvent(TransferEvent evt, java.lang.Exception error)
public void sendAttributesMessage(int id,
SftpFileAttributes attrs)
throws java.io.IOException
java.io.IOExceptionprotected void fireOpenDirectoryEvent(java.lang.String path,
java.util.Date started,
byte[] handle,
java.lang.Exception error)
public void sendStatusMessage(int id,
int reason,
java.lang.String description)
sendStatusMessage in interface SftpSpecificationpublic void sendFilenameMessage(int id,
SftpFile[] files,
boolean isRealPath,
boolean isAbsolute)
throws java.io.IOException
java.io.IOExceptionprotected void fireMakeDirectoryEvent(java.lang.String path,
java.util.Date started,
java.lang.Exception error)
public java.lang.String checkDefaultPath(java.lang.String path)
throws java.io.IOException,
PermissionDeniedException
java.io.IOExceptionPermissionDeniedExceptionpublic void fireEvent(Event event)
public AbstractFileSystem getFileSystem()
getFileSystem in interface SftpSpecificationpublic void submitTask(java.lang.Runnable runnable)
public void addWrapper(SftpOperationWrapper wrapper)
public void removeWrapper(SftpOperationWrapper wrapper)
public java.lang.String getCharsetEncoding()
public void addTransferEvent(java.lang.String handle,
TransferEvent evt)
Copyright © 2022. All rights reserved.