public abstract class AbstractSshMessage
extends java.lang.Object
Constructor and Description |
---|
AbstractSshMessage(boolean verbose,
Session session)
Constructor for AbstractSshMessage
|
AbstractSshMessage(Session session)
Constructor for AbstractSshMessage
|
Modifier and Type | Method and Description |
---|---|
abstract void |
execute()
Carry out the transfer.
|
protected SftpProgressMonitor |
getProgressMonitor()
Get the progress monitor.
|
protected boolean |
getVerbose()
Is the verbose attribute set.
|
protected void |
log(java.lang.String message)
Log a message to the log listener.
|
protected void |
logStats(long timeStarted,
long timeEnded,
long totalLength)
Log transfer stats to the log listener.
|
protected Channel |
openExecChannel(java.lang.String command)
Open an ssh channel.
|
protected ChannelSftp |
openSftpChannel()
Open an ssh sftp channel.
|
protected void |
sendAck(java.io.OutputStream out)
Send an ack.
|
void |
setLogListener(LogListener aListener)
Set a log listener.
|
protected int |
trackProgress(long filesize,
long totalLength,
int percentTransmitted)
Track progress every 10% if 100kb < filesize < 1mb.
|
protected void |
waitForAck(java.io.InputStream in)
Reads the response, throws a BuildException if the response
indicates an error.
|
public AbstractSshMessage(Session session)
session
- the ssh session to usepublic AbstractSshMessage(boolean verbose, Session session)
verbose
- if true do verbose loggingsession
- the ssh session to useprotected Channel openExecChannel(java.lang.String command) throws JSchException
command
- the command to useJSchException
- on errorprotected ChannelSftp openSftpChannel() throws JSchException
JSchException
- on errorprotected void sendAck(java.io.OutputStream out) throws java.io.IOException
out
- the output stream to usejava.io.IOException
- on errorprotected void waitForAck(java.io.InputStream in) throws java.io.IOException, BuildException
in
- the input stream to usejava.io.IOException
- on I/O errorBuildException
- on other errorspublic abstract void execute() throws java.io.IOException, JSchException
java.io.IOException
- on I/O errorsJSchException
- on ssh errorspublic void setLogListener(LogListener aListener)
aListener
- the log listenerprotected void log(java.lang.String message)
message
- the message to logprotected void logStats(long timeStarted, long timeEnded, long totalLength)
timeStarted
- the time startedtimeEnded
- the finishing timetotalLength
- the total lengthprotected final boolean getVerbose()
protected final int trackProgress(long filesize, long totalLength, int percentTransmitted)
filesize
- the size of the file been transmittedtotalLength
- the total transmission sizepercentTransmitted
- the current percent transmittedprotected SftpProgressMonitor getProgressMonitor()