ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 47552] scp task should support compression
Date Thu, 21 Apr 2016 19:16:01 GMT

--- Comment #1 from ---
Created attachment 33791
Patch to add compression option to Ant scp task

This patch adds the currently unavailable compression option to the Ant scp
task. On the command line, it's just adding a "-C" to the parameters of the
"scp" command. This fix exposes this parameter up to the level of the Ant task
wrapper with the boolean "compressed" parameter.

All modifications are to classes in the package.

A private boolean flag to indicate whether compression should be used is added
to AbstractSshMessage, mutable only via a new constructor which overloads the
previous constructor by adding the new parameter. The flag's value is visible
via a new accessor method, getCompressed(). The AbstractSshMessage class is
extended by both ScpFromMessage and ScpToMessage. Both ScpFromMessage and
ScpToMessage contain execute() methods. New overloaded constructors have been
added to both ScpFromMessage and the ScpToMessage to include the boolean flag
to use compression. These flags are passed into the call to
 the parent AbstractSshMessage class's newly added constructors.

In ScpFromMessage, the execute() method is where the call to "scp" with its
various command line parameters is made. This has been altered to check the
parent class's getCompressed() accessor method. If true, the "-C" command line
parameter is appended to the command String.

The ScpToMessage class's execute() method calls one of two other private member
methods to enact the "scp" command: doSingleTransfer() and
doMultipleTransfers(), depending on whether either a single file or a list of
files has been specified. In both of these methods, the parent class's
getCompressed() accessor method is checked. If true, the "-C" command line
parameter is appended to the command String.

Finally, the Scp class, representing the actual ant task, was modified to
include a private boolean flag to indicate that compression should be used. Its
value is defaulted to false, and the class has been modified to include a
standard mutator method for it. This new boolean flag is the parameter by which
the compression option can be used. A call to the An
t task using the new compression option would look like the following:
<scp file="myfile.txt" todir="user@somehost:/home/chuck" password="password"
compression="true" />

You are receiving this mail because:
You are the assignee for the bug.

View raw message