Brooklyn

brooklyn.util.internal
[Java] Interface SshTool


public interface SshTool


Method Summary
void connect()

@throws SshException

void connect(int maxAttempts)

@param maxAttempts

int copyToServer(java.util.Map props, java.io.File f, java.lang.String pathAndFileOnRemoteServer)

Copies file, but won't preserve permission of last _access_ date.

int createFile(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, java.io.InputStream input, long size)

Creates the given file with the given contents.

int createFile(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, java.lang.String contents)

@see #createFile(Map, String, InputStream, long)

int createFile(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, byte[] contents)

@see #createFile(Map, String, InputStream, long)

void disconnect()

int execCommands(java.util.Map properties, java.util.List commands, java.util.Map env)

Executes the set of commands using ssh exec, ";" separated (overridable with property 'separator'.

int execCommands(java.util.Map properties, java.util.List commands)

@see execuCommands(Map, List, Map)

int execScript(java.util.Map props, java.util.List commands, java.util.Map env)

Executes the set of commands in a shell script; optional property 'out' should be an output stream.

int execScript(java.util.Map props, java.util.List commands)

@see execScript(Map, List, Map)

int execShell(java.util.Map props, java.util.List commands)

@deprecated @see execScript(Map, List, Map)

int execShell(java.util.Map props, java.util.List commands, java.util.Map env)

@deprecated @see execScript(Map, List, Map)

boolean isConnected()

int transferFileFrom(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, java.lang.String pathAndFileOnLocalServer)

@see #createFile(Map, String, InputStream, long)

int transferFileTo(java.util.Map props, java.io.InputStream input, java.lang.String pathAndFileOnRemoteServer)

@see #createFile(Map, String, InputStream, long)

 

Method Detail

connect

public void connect()
throws:
SshException


connect

public void connect(int maxAttempts)
throws:
SshException
Parameters:
maxAttempts


copyToServer

public int copyToServer(java.util.Map props, java.io.File f, java.lang.String pathAndFileOnRemoteServer)
Copies file, but won't preserve permission of last _access_ date. If path is null, empty, '.', '..', or ends with '/' then file name is used.

To set permissions (or override mod date) use for example 'permissions:"0644"',

See Also:
createFile(Map, String, InputStream, long)


createFile

public int createFile(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, java.io.InputStream input, long size)
Creates the given file with the given contents. Properties can be: If neither lastXxxDate set it does not send that line (unless property ptimestamp set true)
throws:
SshException
Parameters:
props
pathAndFileOnRemoteServer
input
size


createFile

public int createFile(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, java.lang.String contents)
See Also:
createFile(Map, String, InputStream, long)


createFile

public int createFile(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, byte[] contents)
See Also:
createFile(Map, String, InputStream, long)


disconnect

public void disconnect()


execCommands

public int execCommands(java.util.Map properties, java.util.List commands, java.util.Map env)
Executes the set of commands using ssh exec, ";" separated (overridable with property 'separator'. Optional properties 'out' and 'err' should be streams.

This is generally simpler/preferable to shell, but is not suitable if you need env values whare are only set on a fully-fledged shell.

throws:
SshException
Returns:
exit status


execCommands

public int execCommands(java.util.Map properties, java.util.List commands)
See Also:
execuCommands(java.util.Map, java.util.List, java.util.Map)


execScript

public int execScript(java.util.Map props, java.util.List commands, java.util.Map env)
Executes the set of commands in a shell script; optional property 'out' should be an output stream. Blocks until completion (unless property 'block' set as false).

values in environment parameters are wrapped in double quotes, with double quotes escaped

throws:
SshException
Returns:
exit status of script


execScript

public int execScript(java.util.Map props, java.util.List commands)
See Also:
execScript(java.util.Map, java.util.List, java.util.Map)


execShell

public int execShell(java.util.Map props, java.util.List commands)
deprecated:
@see execScript(Map, List, Map)


execShell

public int execShell(java.util.Map props, java.util.List commands, java.util.Map env)
deprecated:
@see execScript(Map, List, Map)


isConnected

public boolean isConnected()


transferFileFrom

public int transferFileFrom(java.util.Map props, java.lang.String pathAndFileOnRemoteServer, java.lang.String pathAndFileOnLocalServer)
See Also:
createFile(Map, String, InputStream, long)


transferFileTo

public int transferFileTo(java.util.Map props, java.io.InputStream input, java.lang.String pathAndFileOnRemoteServer)
See Also:
createFile(Map, String, InputStream, long)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.