Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 9 years ago
parent
commit
5024dcf97b
6 changed files with 92 additions and 0 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +5
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +17
    -0
      manual/Tasks/scp.html
  5. +17
    -0
      manual/Tasks/sshexec.html
  6. +48
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java

+ 1
- 0
CONTRIBUTORS View File

@@ -154,6 +154,7 @@ Ingenonsya France
Ingmar Stein
Irene Rusman
Isaac Shabtay
Issa Gorissen
Ivan Ivanov
J Bleijenbergh
Jack J. Woehr


+ 5
- 0
WHATSNEW View File

@@ -95,6 +95,11 @@ Other changes:
* <javac> now supports Java9 modules.
https://github.com/apache/ant/pull/16

* <sshexec> and <scp> have two new attributes serverAliveInterval and
serverAliveCountMax that can be used to keep a intermediaries from
closing idle connections.
Bugzilla Report 59162

Changes from Ant 1.9.5 TO Ant 1.9.6
===================================



+ 4
- 0
contributors.xml View File

@@ -640,6 +640,10 @@
<first>Isaac</first>
<last>Shabtay</last>
</name>
<name>
<first>Issa</first>
<last>Gorissen</last>
</name>
<name>
<first>Ivan</first>
<last>Ivanov</last>


+ 17
- 0
manual/Tasks/scp.html View File

@@ -200,6 +200,23 @@ for more information. This task has been tested with jsch-0.1.2 and later.</p>
remote server. Default is 755. <em>since Ant 1.9.5</em>.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">serverAliveIntervalSeconds</td>
<td valign="top">Sets a timeout interval in seconds after which if no data has
been received from the server, the task will send a message through
the encrypted channel to request a response from the server.
<em>since Ant 1.9.7</em></td>
<td align="center" valign="top">No, the default is 0, indicating
that these messages will not be sent to the server</td>
</tr>
<tr>
<td valign="top">serverAliveCountMax</td>
<td valign="top">The number of server alive messages which may be
sent without receiving any messages back from the server. Only
used if serverAliveIntervalSeconds is not 0.
<em>since Ant 1.9.7</em></td>
<td align="center" valign="top">No, defaults to 3</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>



+ 17
- 0
manual/Tasks/sshexec.html View File

@@ -230,6 +230,23 @@ and won't work with versions of jsch earlier than
<em>since Ant 1.9.4</em></td>
<td align="center" valign="top">No, defaults to false</td>
</tr>
<tr>
<td valign="top">serverAliveIntervalSeconds</td>
<td valign="top">Sets a timeout interval in seconds after which if no data has
been received from the server, the task will send a message through
the encrypted channel to request a response from the server.
<em>since Ant 1.9.7</em></td>
<td align="center" valign="top">No, the default is 0, indicating
that these messages will not be sent to the server</td>
</tr>
<tr>
<td valign="top">serverAliveCountMax</td>
<td valign="top">The number of server alive messages which may be
sent without receiving any messages back from the server. Only
used if serverAliveIntervalSeconds is not 0.
<em>since Ant 1.9.7</em></td>
<td align="center" valign="top">No, defaults to 3</td>
</tr>
</table>

<h3>Examples</h3>


+ 48
- 0
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java View File

@@ -42,6 +42,8 @@ public abstract class SSHBase extends Task implements LogListener {
private boolean failOnError = true;
private boolean verbose;
private final SSHUserInfo userInfo;
private int serverAliveCountMax = 3;
private int serverAliveIntervalSeconds = 0;

/**
* Constructor for SSHBase.
@@ -104,6 +106,46 @@ public abstract class SSHBase extends Task implements LogListener {
return verbose;
}

/**
* Set the serverAliveCountMax value.
* @since Ant 1.9.7
*/
public void setServerAliveCountMax(final int countMax) {
if (countMax <= 0) {
throw new BuildException("ssh server alive count max setting cannot be negative or zero");
}
this.serverAliveCountMax = countMax;
}

/**
* Get the serverAliveCountMax value.
* @return the serverAliveCountMax value
* @since Ant 1.9.7
*/
public int getServerAliveCountMax() {
return serverAliveCountMax;
}

/**
* Set the serverAliveIntervalSeconds value in seconds.
* @since Ant 1.9.7
*/
public void setServerAliveIntervalSeconds(final int interval) {
if (interval < 0) {
throw new BuildException("ssh server alive interval setting cannot be negative");
}
this.serverAliveIntervalSeconds = interval;
}

/**
* Get the serverAliveIntervalSeconds value in seconds.
* @return the serverAliveIntervalSeconds value in seconds
* @since Ant 1.9.7
*/
public int getServerAliveIntervalSeconds() {
return serverAliveIntervalSeconds;
}

/**
* Username known to remote host.
*
@@ -221,6 +263,12 @@ public abstract class SSHBase extends Task implements LogListener {
session.setConfig("PreferredAuthentications",
"publickey,keyboard-interactive,password");
session.setUserInfo(userInfo);

if (getServerAliveIntervalSeconds() > 0) {
session.setServerAliveCountMax(getServerAliveCountMax());
session.setServerAliveInterval(getServerAliveIntervalSeconds() * 1000);
}

log("Connecting to " + host + ":" + port);
session.connect();
return session;


Loading…
Cancel
Save