private String doPut(Message<?> requestMessage, String subDirectory) { return this.remoteFileTemplate.invoke(template -> put(requestMessage, template.getSession(), subDirectory)); }
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)); } }