Module datarush.library
Class RemoteCommandRunner
- java.lang.Object
-
- com.pervasive.datarush.operators.io.vectorwise.RemoteCommandRunner
-
- All Implemented Interfaces:
CommandRunner
public class RemoteCommandRunner extends Object implements CommandRunner
Run a command on a remote server using the ssh protocol connecting to a sshd. Only user name and password authentication is supported.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Close the user session with the sshd.void
initialize()
Open a session to a remote sshd at the configured host and port.int
runCommand(List<String> args, InputStream stdIn, OutputStream stdOut, OutputStream stdErr)
Submits the given command to the connected session.
-
-
-
Method Detail
-
initialize
public void initialize() throws IOException
Open a session to a remote sshd at the configured host and port. The client authenticates with the sshd using the configured user name and password. If authentication fails and network communication errors occur, anIOException
is thrown.- Specified by:
initialize
in interfaceCommandRunner
- Throws:
IOException
- thrown if authentication fails or networking problems occur
-
runCommand
public int runCommand(List<String> args, InputStream stdIn, OutputStream stdOut, OutputStream stdErr) throws IOException
Submits the given command to the connected session. The standard output and standard error are captured in the given output streams. The exit code of the shell command is provided as the return value. All resources for the opened command channel are released before returning. This method can be invoked multiple times as needed on an open client session.- Specified by:
runCommand
in interfaceCommandRunner
- Parameters:
command
- the shell command to executestdOut
- standard output of the command is captured herestdErr
- standard error of the shell command is captured here- Returns:
- exit code of the shell command
- Throws:
IOException
- thrown if any error occur communicating with the remote sshd
-
dispose
public void dispose() throws IOException
Close the user session with the sshd.- Specified by:
dispose
in interfaceCommandRunner
- Throws:
IOException
- thrown if any errors occur
-
-