Class AbstractSshMessage
- java.lang.Object
- 
- org.apache.tools.ant.taskdefs.optional.ssh.AbstractSshMessage
 
- 
- Direct Known Subclasses:
- ScpFromMessage,- ScpToMessage
 
 public abstract class AbstractSshMessage extends java.lang.ObjectAbstract class for ssh upload and download
- 
- 
Constructor SummaryConstructors Constructor Description AbstractSshMessage(boolean verbose, boolean compressed, com.jcraft.jsch.Session session)Constructor for AbstractSshMessageAbstractSshMessage(boolean verbose, com.jcraft.jsch.Session session)Constructor for AbstractSshMessageAbstractSshMessage(com.jcraft.jsch.Session session)Constructor for AbstractSshMessage
 - 
Method SummaryModifier and Type Method Description abstract voidexecute()Carry out the transfer.protected booleangetCompressed()Is the compressed attribute set.protected com.jcraft.jsch.SftpProgressMonitorgetProgressMonitor()Get the progress monitor.protected booleangetVerbose()Is the verbose attribute set.protected voidlog(java.lang.String message)Log a message to the log listener.protected voidlogStats(long timeStarted, long timeEnded, long totalLength)Log transfer stats to the log listener.protected com.jcraft.jsch.ChannelopenExecChannel(java.lang.String command)Open an ssh channel.protected com.jcraft.jsch.ChannelSftpopenSftpChannel()Open an ssh sftp channel.protected voidsendAck(java.io.OutputStream out)Send an ack.voidsetLogListener(LogListener aListener)Set a log listener.protected inttrackProgress(long filesize, long totalLength, int percentTransmitted)Track progress every 10% if 100kb < filesize < 1Mb.protected voidwaitForAck(java.io.InputStream in)Reads the response, throws a BuildException if the response indicates an error.
 
- 
- 
- 
Constructor Detail- 
AbstractSshMessagepublic AbstractSshMessage(com.jcraft.jsch.Session session) Constructor for AbstractSshMessage- Parameters:
- session- the ssh session to use
 
 - 
AbstractSshMessagepublic AbstractSshMessage(boolean verbose, com.jcraft.jsch.Session session)Constructor for AbstractSshMessage- Parameters:
- verbose- if true do verbose logging
- session- the ssh session to use
- Since:
- Ant 1.6.2
 
 - 
AbstractSshMessagepublic AbstractSshMessage(boolean verbose, boolean compressed, com.jcraft.jsch.Session session)Constructor for AbstractSshMessage- Parameters:
- verbose- if true do verbose logging
- compressed- if true use compression
- session- the ssh session to use
- Since:
- Ant 1.9.8
 
 
- 
 - 
Method Detail- 
openExecChannelprotected com.jcraft.jsch.Channel openExecChannel(java.lang.String command) throws com.jcraft.jsch.JSchExceptionOpen an ssh channel.- Parameters:
- command- the command to use
- Returns:
- the channel
- Throws:
- com.jcraft.jsch.JSchException- on error
 
 - 
openSftpChannelprotected com.jcraft.jsch.ChannelSftp openSftpChannel() throws com.jcraft.jsch.JSchExceptionOpen an ssh sftp channel.- Returns:
- the channel
- Throws:
- com.jcraft.jsch.JSchException- on error
 
 - 
sendAckprotected void sendAck(java.io.OutputStream out) throws java.io.IOExceptionSend an ack.- Parameters:
- out- the output stream to use
- Throws:
- java.io.IOException- on error
 
 - 
waitForAckprotected void waitForAck(java.io.InputStream in) throws java.io.IOException, BuildExceptionReads the response, throws a BuildException if the response indicates an error.- Parameters:
- in- the input stream to use
- Throws:
- java.io.IOException- on I/O error
- BuildException- on other errors
 
 - 
executepublic abstract void execute() throws java.io.IOException, com.jcraft.jsch.JSchExceptionCarry out the transfer.- Throws:
- java.io.IOException- on I/O errors
- com.jcraft.jsch.JSchException- on ssh errors
 
 - 
setLogListenerpublic void setLogListener(LogListener aListener) Set a log listener.- Parameters:
- aListener- the log listener
 
 - 
logprotected void log(java.lang.String message) Log a message to the log listener.- Parameters:
- message- the message to log
 
 - 
logStatsprotected void logStats(long timeStarted, long timeEnded, long totalLength)Log transfer stats to the log listener.- Parameters:
- timeStarted- the time started
- timeEnded- the finishing time
- totalLength- the total length
 
 - 
getVerboseprotected final boolean getVerbose() Is the verbose attribute set.- Returns:
- true if the verbose attribute is set
- Since:
- Ant 1.6.2
 
 - 
getCompressedprotected final boolean getCompressed() Is the compressed attribute set.- Returns:
- true if the compressed attribute is set
- Since:
- Ant 1.9.8
 
 - 
trackProgressprotected final int trackProgress(long filesize, long totalLength, int percentTransmitted)Track progress every 10% if 100kb < filesize < 1Mb. For larger files track progress for every percent transmitted.- Parameters:
- filesize- the size of the file been transmitted
- totalLength- the total transmission size
- percentTransmitted- the current percent transmitted
- Returns:
- the percent that the file is of the total
 
 - 
getProgressMonitorprotected com.jcraft.jsch.SftpProgressMonitor getProgressMonitor() Get the progress monitor.- Returns:
- the progress monitor.
 
 
- 
 
-