org.apache.tools.ant.taskdefs.optional.ssh

Class SSHSession

public class SSHSession extends SSHBase

Establishes an ssh session with a remote machine, optionally establishing port forwarding, then executes any nested task(s) before closing the session.

Since: Ant 1.8.0

Nested Class Summary
classSSHSession.LocalTunnel
static classSSHSession.NestedSequential
The class corresponding to the sequential nested element.
classSSHSession.RemoteTunnel
Method Summary
voidaddTask(Task nestedTask)
Add a nested task to Sequential.
SSHSession.LocalTunnelcreateLocalTunnel()
SSHSession.RemoteTunnelcreateRemoteTunnel()
SSHSession.NestedSequentialcreateSequential()
This is the sequential nested element of the macrodef.
voidexecute()
Establish the ssh session and execute all nestedTasks
voidsetLocaltunnels(String tunnels)
Changes the comma-delimited list of local tunnels to establish on the connection.
voidsetRemotetunnels(String tunnels)
Changes the comma-delimited list of remote tunnels to establish on the connection.
voidsetTimeout(long timeout)
The connection can be dropped after a specified number of milliseconds.

Method Detail

addTask

public void addTask(Task nestedTask)
Add a nested task to Sequential.

Parameters: nestedTask Nested task to execute Sequential

createLocalTunnel

public SSHSession.LocalTunnel createLocalTunnel()

createRemoteTunnel

public SSHSession.RemoteTunnel createRemoteTunnel()

createSequential

public SSHSession.NestedSequential createSequential()
This is the sequential nested element of the macrodef.

Returns: a sequential element to be configured.

execute

public void execute()
Establish the ssh session and execute all nestedTasks

Throws: BuildException if one of the nested tasks fails, or network error or bad parameter.

setLocaltunnels

public void setLocaltunnels(String tunnels)
Changes the comma-delimited list of local tunnels to establish on the connection.

Parameters: tunnels a comma-delimited list of lport:rhost:rport tunnel specifications

setRemotetunnels

public void setRemotetunnels(String tunnels)
Changes the comma-delimited list of remote tunnels to establish on the connection.

Parameters: tunnels a comma-delimited list of rport:lhost:lport tunnel specifications

setTimeout

public void setTimeout(long timeout)
The connection can be dropped after a specified number of milliseconds. This is sometimes useful when a connection may be flaky. Default is 0, which means "wait forever".

Parameters: timeout The new timeout value in seconds