public class SftpSubsystem extends Subsystem
FileSystem
to serve files
through the SFTP protocol. This implementation currently supports up to
version 3 of the protocol.Constructor and Description |
---|
SftpSubsystem() |
Modifier and Type | Method and Description |
---|---|
void |
addTransferEvent(String handle,
TransferEvent evt) |
void |
addWrapper(SftpOperationWrapper wrapper) |
String |
checkDefaultPath(String path) |
protected void |
cleanupSubsystem() |
protected void |
fireCloseFileEvent(byte[] handle,
Throwable error) |
protected void |
fireCloseFileEvent(TransferEvent evt,
Throwable error) |
void |
fireEvent(Event event) |
protected void |
fireMakeDirectoryEvent(String path,
Date started,
Throwable error) |
void |
fireOpenDirectoryEvent(String path,
Date started,
byte[] handle,
Throwable error) |
protected void |
fireOpenFileEvent(UnsignedInteger32 flags,
SftpFileAttributes attrs,
String path,
Date started,
byte[] handle,
Throwable error) |
protected void |
fireOpenInitEvent(UnsignedInteger32 flags,
SftpFileAttributes attrs,
String path,
Date started,
Exception error) |
protected void |
fireRemoveFileEvent(String path,
Date started,
Throwable error) |
protected void |
fireRenameFileEvent(String oldpath,
String newpath,
Date started,
Throwable error) |
protected void |
fireRmDirEvent(String path,
Date started,
Throwable error) |
protected void |
fireStatEvent(String path,
SftpFileAttributes old,
SftpFileAttributes attrs,
Date started,
Throwable error) |
protected void |
fireSymlinkEvent(String linkpath,
String targetpath,
Date started,
Throwable error) |
protected void |
flagClose(ConnectionAwareTask task) |
String |
getCharsetEncoding() |
FileSystem |
getFileSystem() |
protected String |
getName() |
TransportProtocol |
getTransport() |
void |
init(SessionChannel session,
SshContext 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,
String description) |
protected boolean |
startTask(Runnable r) |
cleanupOnError, executeOperation, getConnection, getContext, getSession, onFreeMessage, parseMessage, postCleanup, processMessage, sendMessage
addOperationListener, addTask, cleanupOperations, clearQueue, endExecution, getOperationsCount, removeOperationListener, startExecution, taskAdded
public static final int STATUS_FX_OK
public static final int STATUS_FX_EOF
public static final int STATUS_FX_NO_SUCH_FILE
public static final int STATUS_FX_PERMISSION_DENIED
public static final int STATUS_FX_FAILURE
public static final int STATUS_FX_OP_UNSUPPORTED
public static final int SSH_FX_INVALID_HANDLE
public static final int SSH_FX_NO_SUCH_PATH
public static final int SSH_FX_FILE_ALREADY_EXISTS
public static final int SSH_FX_WRITE_PROTECT
public static final int SSH_FX_NO_MEDIA
public static final int SSH_FX_NO_SPACE_ON_FILESYSTEM
public static final int SSH_FX_QUOTA_EXCEEDED
public static final int SSH_FX_UNKNOWN_PRINCIPAL
public static final int SSH_FX_LOCK_CONFLICT
public static final int SSH_FX_DIR_NOT_EMPTY
public static final int SSH_FX_NOT_A_DIRECTORY
public static final int SSH_FX_INVALID_FILENAME
public static final int SSH_FX_LINK_LOOP
public static final int SSH_FX_CANNOT_DELETE
public static final int SSH_FX_INVALID_PARAMETER
public static final int SSH_FX_FILE_IS_A_DIRECTORY
public static final int SSH_FX_BYTE_RANGE_LOCK_CONFLICT
public static final int SSH_FX_BYTE_RANGE_LOCK_REFUSED
public static final int SSH_FX_DELETE_PENDING
public static final int SSH_FX_FILE_CORRUPT
public static final int SSH_FX_OWNER_INVALID
public static final int SSH_FX_GROUP_INVALID
public static final int SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK
public static final int SSH_FXP_EXTENDED_REPLY
public static final String SUBSYSTEM_NAME
public void init(SessionChannel session, SshContext context) throws IOException
Subsystem
init
in class Subsystem
IOException
protected String getName()
getName
in class ExecutorOperationSupport<SshContext>
protected boolean startTask(Runnable r)
startTask
in class ExecutorOperationSupport<SshContext>
protected void cleanupSubsystem()
cleanupSubsystem
in class Subsystem
protected void onSubsystemFree()
onSubsystemFree
in class Subsystem
protected void flagClose(ConnectionAwareTask task)
protected void onMessageReceived(byte[] msg)
Subsystem
onMessageReceived
in class Subsystem
protected void fireStatEvent(String path, SftpFileAttributes old, SftpFileAttributes attrs, Date started, Throwable error)
protected void fireSymlinkEvent(String linkpath, String targetpath, Date started, Throwable error)
protected void fireRenameFileEvent(String oldpath, String newpath, Date started, Throwable error)
protected void fireOpenFileEvent(UnsignedInteger32 flags, SftpFileAttributes attrs, String path, Date started, byte[] handle, Throwable error)
protected void fireOpenInitEvent(UnsignedInteger32 flags, SftpFileAttributes attrs, String path, Date started, Exception error)
public void sendHandleMessage(int id, byte[] handle) throws IOException
IOException
protected void fireCloseFileEvent(byte[] handle, Throwable error)
protected void fireCloseFileEvent(TransferEvent evt, Throwable error)
public void sendAttributesMessage(int id, SftpFileAttributes attrs) throws IOException
IOException
public void fireOpenDirectoryEvent(String path, Date started, byte[] handle, Throwable error)
public void sendStatusMessage(int id, int reason, String description)
public void sendFilenameMessage(int id, SftpFile[] files, boolean isRealPath, boolean isAbsolute) throws IOException
IOException
protected void fireMakeDirectoryEvent(String path, Date started, Throwable error)
public String checkDefaultPath(String path) throws IOException, PermissionDeniedException
IOException
PermissionDeniedException
public void fireEvent(Event event)
public FileSystem getFileSystem()
public TransportProtocol getTransport()
public void addWrapper(SftpOperationWrapper wrapper)
public void removeWrapper(SftpOperationWrapper wrapper)
public String getCharsetEncoding()
public void addTransferEvent(String handle, TransferEvent evt)
Copyright © 2024. All rights reserved.