public NameValue(N name, V value) { ObjectHelper.requireNonNull(name, "name cannot be null"); this.name = name; this.value = value; }
public JschSession(Context context, ImmutableUri uri, JSch jsch, Session jschSession) { ObjectHelper.requireNonNull(uri, "uri cannot be null"); ObjectHelper.requireNonNull(jsch, "jsch cannot be null"); ObjectHelper.requireNonNull(jschSession, "jsch session cannot be null"); this.context = context; this.uri = uri; this.jsch = jsch; this.jschSession = jschSession; this.closed = false; }
public Which command(Path command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = command; return this; }
@Override public SshExec command(Path command) { ObjectHelper.requireNonNull(command, "command cannot be null"); this.command = command; return this; }
public Which command(Path command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = command; return this; }
public Which command(File command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = command.toPath(); return this; }
@Override public SshExec command(File command) { ObjectHelper.requireNonNull(command, "command cannot be null"); this.command = command.toPath(); return this; }
public Which command(String command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = Paths.get(command); return this; }
public Which command(File command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = command.toPath(); return this; }
public Which command(String command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = Paths.get(command); return this; }
default public T path(Path path) { ObjectHelper.requireNonNull(path, "path cannot be null"); // insert onto front since user would likely want this searched first getPaths().add(0, path); return (T)this; }
default public T paths(File... paths) { ObjectHelper.requireNonNull(paths, "paths cannot be null"); Path[] a = new Path[paths.length]; for (int i = paths.length - 1; i >= 0; i--) { a[i] = paths[i].toPath(); } return paths(a); }
default public T paths(File... paths) { ObjectHelper.requireNonNull(paths, "paths cannot be null"); Path[] a = new Path[paths.length]; for (int i = paths.length - 1; i >= 0; i--) { a[i] = paths[i].toPath(); } return paths(a); }
@Override protected Result doRun() throws BlazeException { ObjectHelper.requireNonNull(source, "source cannot be null"); ObjectHelper.requireNonNull(target, "target cannot be null"); sftp.get(source, target); return new Result(this, null); }
@Override protected Result doRun() throws BlazeException { ObjectHelper.requireNonNull(source, "source cannot be null"); ObjectHelper.requireNonNull(target, "target cannot be null"); sftp.put(source, target); return new Result(this, null); }
default public T paths(List<Path> paths) { ObjectHelper.requireNonNull(paths, "paths cannot be null"); // insert onto front since user would likely want this searched first for (int i = paths.size() - 1; i >= 0; i--) { getPaths().add(0, paths.get(i)); } return (T)this; } }
default public T paths(List<Path> paths) { ObjectHelper.requireNonNull(paths, "paths cannot be null"); // insert onto front since user would likely want this searched first for (int i = paths.size() - 1; i >= 0; i--) { getPaths().add(0, paths.get(i)); } return (T)this; } }
default public T path(File path) { ObjectHelper.requireNonNull(path, "path cannot be null"); return path(path.toPath()); }
default public T paths(Globber globber) { ObjectHelper.requireNonNull(globber, "globber cannot be null"); try { return paths(globber.scan()); } catch (IOException e) { throw new BlazeException(e.getMessage(), e); } }
@Override protected Result doRun() throws BlazeException { Session jschSession = ((JschSession)session).getJschSession(); ObjectHelper.requireNonNull(jschSession, "ssh session must be established first"); try { ChannelSftp channel = (ChannelSftp)jschSession.openChannel("sftp"); channel.connect(); return new Result(this, new JschSftpSession(session, channel)); } catch (JSchException e) { throw new SshException(e.getMessage(), e); } }