Class AbstractSshMessage
java.lang.Object
org.apache.tools.ant.taskdefs.optional.ssh.AbstractSshMessage
- Direct Known Subclasses:
- ScpFromMessage,- ScpToMessage
Abstract class for ssh upload and download
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractSshMessage(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 TypeMethodDescriptionabstract voidexecute()Carry out the transfer.protected final booleanIs the compressed attribute set.protected com.jcraft.jsch.SftpProgressMonitorGet the progress monitor.protected final booleanIs the verbose attribute set.protected voidLog 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(String command) Open an ssh channel.protected com.jcraft.jsch.ChannelSftpOpen an ssh sftp channel.protected voidsendAck(OutputStream out) Send an ack.voidsetLogListener(LogListener aListener) Set a log listener.protected final inttrackProgress(long filesize, long totalLength, int percentTransmitted) Track progress every 10% if 100kb < filesize < 1Mb.protected voidReads the response, throws a BuildException if the response indicates an error.
- 
Constructor Details- 
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 Details- 
openExecChannelprotected com.jcraft.jsch.Channel openExecChannel(String command) throws com.jcraft.jsch.JSchException Open 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
 
- 
sendAckSend an ack.- Parameters:
- out- the output stream to use
- Throws:
- IOException- on error
 
- 
waitForAckReads the response, throws a BuildException if the response indicates an error.- Parameters:
- in- the input stream to use
- Throws:
- IOException- on I/O error
- BuildException- on other errors
 
- 
executeCarry out the transfer.- Throws:
- IOException- on I/O errors
- com.jcraft.jsch.JSchException- on ssh errors
 
- 
setLogListenerSet a log listener.- Parameters:
- aListener- the log listener
 
- 
logLog 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.
 
 
-