@Override protected void doChmod(RemoteFileOperations<LsEntry> remoteFileOperations, final String path, final int chmod) { remoteFileOperations .executeWithClient((ClientCallbackWithoutResult<ChannelSftp>) client -> { try { client.chmod(chmod, path); } catch (SftpException e) { throw new GeneralSftpException("Failed to execute chmod", e); } }); }
private String doPut(Message<?> requestMessage, String subDirectory) { return this.remoteFileTemplate.invoke(template -> put(requestMessage, template.getSession(), subDirectory)); }
@Bean public IntegrationFlow sftpSessionCallbackFlow() { return f -> f .<String>handle((p, h) -> sftpRemoteFileTemplate().execute(s -> s.list(p))) .channel(c -> c.queue("sftpLsResult")); }
@Override protected void doChmod(RemoteFileOperations<LsEntry> remoteFileOperations, final String path, final int chmod) { remoteFileOperations .executeWithClient((ClientCallbackWithoutResult<ChannelSftp>) client -> { try { client.chmod(chmod, path); } catch (SftpException e) { throw new GeneralSftpException("Failed to execute chmod", e); } }); }
private Object doMput(Message<?> requestMessage) { File file = null; Object payload = requestMessage.getPayload(); if (payload instanceof File) { file = (File) payload; } else if (payload instanceof String) { file = new File((String) payload); } else if (!(payload instanceof Collection)) { throw new IllegalArgumentException( "Only File or String payloads (or Collection of File/String) allowed for 'mput', received: " + payload.getClass()); } if ((payload instanceof Collection)) { return ((Collection<?>) payload).stream() .map(p -> doMput(new MutableMessage<>(p, requestMessage.getHeaders()))) .collect(Collectors.toList()); } else if (!file.isDirectory()) { return doPut(requestMessage); } else { File localDir = file; return this.remoteFileTemplate.invoke(t -> mPut(requestMessage, t.getSession(), localDir)); } }