Class ScpToMessageBySftp
java.lang.Object
org.apache.tools.ant.taskdefs.optional.ssh.AbstractSshMessage
org.apache.tools.ant.taskdefs.optional.ssh.ScpToMessage
org.apache.tools.ant.taskdefs.optional.ssh.ScpToMessageBySftp
Utility class to carry out an upload by sftp.
-
Constructor Summary
ConstructorsConstructorDescriptionScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, File aLocalFile, String aRemotePath) Constructor for a local file to remote.ScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, File aLocalFile, String aRemotePath, boolean preserveLastModified) Constructor for a local file to remote.ScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, List<Directory> aDirectoryList, String aRemotePath) Constructor for a local directories to remote.ScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, List<Directory> aDirectoryList, String aRemotePath, boolean preserveLastModified) Constructor for a local directories to remote.ScpToMessageBySftp(com.jcraft.jsch.Session session, File aLocalFile, String aRemotePath) Constructor for ScpToMessage.ScpToMessageBySftp(com.jcraft.jsch.Session session, List<Directory> aDirectoryList, String aRemotePath) Constructor for ScpToMessage. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Carry out the transfer.Get the local file.booleanReturns true if the last modified time needs to be preserved on the file(s) that get transferred.Get the remote path.Methods inherited from class ScpToMessage
getDirMode, getFileMode, setDirMode, setFileModeModifier and TypeMethodDescriptionintGet the dir mode.intGet the file mode.voidsetDirMode(int dirMode) Set the dir mode, defaults to 0755.voidsetFileMode(int fileMode) Set the file mode, defaults to 0644.Methods inherited from class AbstractSshMessage
getCompressed, getProgressMonitor, getVerbose, log, logStats, openExecChannel, openSftpChannel, sendAck, setLogListener, trackProgress, waitForAckModifier and TypeMethodDescriptionprotected 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
-
ScpToMessageBySftp
public ScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, File aLocalFile, String aRemotePath) Constructor for a local file to remote.- Parameters:
verbose- if true do verbose loggingsession- the scp session to useaLocalFile- the local fileaRemotePath- the remote path- Since:
- Ant 1.7
-
ScpToMessageBySftp
public ScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, File aLocalFile, String aRemotePath, boolean preserveLastModified) Constructor for a local file to remote.- Parameters:
verbose- if true do verbose loggingsession- the scp session to useaLocalFile- the local fileaRemotePath- the remote pathpreserveLastModified- True if the last modified time needs to be preserved on the transferred files. False otherwise.- Since:
- Ant 1.9.10
-
ScpToMessageBySftp
public ScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, List<Directory> aDirectoryList, String aRemotePath) Constructor for a local directories to remote.- Parameters:
verbose- if true do verbose loggingsession- the scp session to useaDirectoryList- a list of directoriesaRemotePath- the remote path- Since:
- Ant 1.7
-
ScpToMessageBySftp
public ScpToMessageBySftp(boolean verbose, com.jcraft.jsch.Session session, List<Directory> aDirectoryList, String aRemotePath, boolean preserveLastModified) Constructor for a local directories to remote.- Parameters:
verbose- if true do verbose loggingsession- the scp session to useaDirectoryList- a list of directoriesaRemotePath- the remote pathpreserveLastModified- True if the last modified time needs to be preserved on the transferred files. False otherwise.- Since:
- Ant 1.9.10
-
ScpToMessageBySftp
-
ScpToMessageBySftp
-
-
Method Details
-
execute
Carry out the transfer.- Overrides:
executein classScpToMessage- Throws:
IOException- on i/o errorscom.jcraft.jsch.JSchException- on errors detected by scp
-
getLocalFile
Get the local file.- Overrides:
getLocalFilein classScpToMessage- Returns:
- the local file.
-
getRemotePath
Get the remote path.- Overrides:
getRemotePathin classScpToMessage- Returns:
- the remote path.
-
getPreserveLastModified
public boolean getPreserveLastModified()Returns true if the last modified time needs to be preserved on the file(s) that get transferred. Returns false otherwise.- Overrides:
getPreserveLastModifiedin classScpToMessage- Returns:
- boolean
-