Search in sources :

Example 1 with ScpClient

use of org.eclipse.linuxtools.systemtap.ui.consolelog.ScpClient in project linuxtools by eclipse.

the class RunScriptHandler method prepareNonLocalScript.

/**
 * Attempts to set up a channel for a script that runs on a non-local host or user.
 * @return <code>true</code> on success, <code>false</code> on failure.
 * @throws ExecutionException If failure occurs during a (non-simple) launch,
 * this will throw an exception instead of returning <code>false</code>.
 */
private void prepareNonLocalScript() throws ExecutionException {
    try {
        ScpClient scpclient = new ScpClient(remoteOptions);
        // $NON-NLS-1$
        tmpfileName = new Path("/tmp").append(getFileName(fileName)).toOSString();
        scpclient.transfer(fileName, tmpfileName);
    } catch (final JSchException | IOException e) {
        String message = e instanceof JSchException ? // $NON-NLS-1$
        Localization.getString("RunScriptHandler.checkCredentials") : // $NON-NLS-1$
        Localization.getString("RunScriptHandler.ioError");
        throw new ExecutionException(message, e);
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) JSchException(com.jcraft.jsch.JSchException) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException) ScpClient(org.eclipse.linuxtools.systemtap.ui.consolelog.ScpClient)

Aggregations

JSchException (com.jcraft.jsch.JSchException)1 IOException (java.io.IOException)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 ScpClient (org.eclipse.linuxtools.systemtap.ui.consolelog.ScpClient)1