Package org.apache.sshd.scp.common
Interface ScpTransferEventListener
-
- All Superinterfaces:
java.util.EventListener
,SshdEventListener
- All Known Implementing Classes:
AbstractScpTransferEventListenerAdapter
public interface ScpTransferEventListener extends SshdEventListener
Can be registered in order to receive events about SCP transfers
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ScpTransferEventListener.FileOperation
-
Field Summary
Fields Modifier and Type Field Description static ScpTransferEventListener
EMPTY
An "empty" implementation to be used instead ofnull
s
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default void
endFileEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, java.lang.Throwable thrown)
default void
endFolderEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, java.lang.Throwable thrown)
default void
handleFileEventAckInfo(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, ScpAckInfo ackInfo)
Called afterendFileEvent(Session, FileOperation, Path, long, Set, Throwable)
if no exception was thrown and the peer's ACK was successfully readdefault void
handleReceiveCommandAckInfo(Session session, java.lang.String command, ScpAckInfo ackInfo)
Called after a receive related command has bee acknowledged by the peerdefault void
startFileEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms)
default void
startFolderEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms)
static <L extends ScpTransferEventListener>
LvalidateListener(L listener)
-
-
-
Field Detail
-
EMPTY
static final ScpTransferEventListener EMPTY
An "empty" implementation to be used instead ofnull
s
-
-
Method Detail
-
startFileEvent
default void startFileEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms) throws java.io.IOException
- Parameters:
session
- The client/serverSession
through which the transfer is being executedop
- TheScpTransferEventListener.FileOperation
file
- The local referenced filePath
length
- Size (in bytes) of transferred dataperms
- ASet
ofPosixFilePermission
s to be applied once transfer is complete- Throws:
java.io.IOException
- If failed to handle the event
-
endFileEvent
default void endFileEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, java.lang.Throwable thrown) throws java.io.IOException
- Parameters:
session
- The client/serverSession
through which the transfer is being executedop
- TheScpTransferEventListener.FileOperation
file
- The local referenced filePath
length
- Size (in bytes) of transferred dataperms
- ASet
ofPosixFilePermission
s to be applied once transfer is completethrown
- The result of the operation attempt - ifnull
then reception was successful- Throws:
java.io.IOException
- If failed to handle the event
-
handleFileEventAckInfo
default void handleFileEventAckInfo(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, ScpAckInfo ackInfo) throws java.io.IOException
Called afterendFileEvent(Session, FileOperation, Path, long, Set, Throwable)
if no exception was thrown and the peer's ACK was successfully read- Parameters:
session
- The client/serverSession
through which the transfer is being executedop
- TheScpTransferEventListener.FileOperation
file
- The local referenced filePath
length
- Size (in bytes) of transferred dataperms
- ASet
ofPosixFilePermission
s to be applied once transfer is completeackInfo
- TheScpAckInfo
received after a file transfer - before validating it- Throws:
java.io.IOException
- If failed to handle the event
-
handleReceiveCommandAckInfo
default void handleReceiveCommandAckInfo(Session session, java.lang.String command, ScpAckInfo ackInfo) throws java.io.IOException
Called after a receive related command has bee acknowledged by the peer- Parameters:
session
- The client/serverSession
through which the transfer is being executedcommand
- The raw command that was attemptedackInfo
- TheScpAckInfo
received after command execution - including ifOK
. By default it throws anScpException
ifERROR
status code, but the user is free to override this behavior (see ScpClient download fails silently when the remote files does not exist ) - including throwing an exception if OK status...- Throws:
java.io.IOException
- If bad acknowledgment
-
startFolderEvent
default void startFolderEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms) throws java.io.IOException
- Parameters:
session
- The client/serverSession
through which the transfer is being executedop
- TheScpTransferEventListener.FileOperation
file
- The local referenced folderPath
perms
- ASet
ofPosixFilePermission
s to be applied once transfer is complete- Throws:
java.io.IOException
- If failed to handle the event
-
endFolderEvent
default void endFolderEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, java.lang.Throwable thrown) throws java.io.IOException
- Parameters:
session
- The client/serverSession
through which the transfer is being executedop
- TheScpTransferEventListener.FileOperation
file
- The local referenced filePath
perms
- ASet
ofPosixFilePermission
s to be applied once transfer is completethrown
- The result of the operation attempt - ifnull
then reception was successful- Throws:
java.io.IOException
- If failed to handle the event
-
validateListener
static <L extends ScpTransferEventListener> L validateListener(L listener)
-
-