@Override public Exchange createExchange(GenericFile<T> file) { Exchange answer = super.createExchange(); if (file != null) { file.bindToExchange(answer); } return answer; }
public static File getFile(GenericFile file) { return (File) file.getBody(); }
@Override protected void updateFileHeaders(GenericFile<FTPFile> file, Message message) { long length = file.getFile().getSize(); long modified = file.getFile().getTimestamp() != null ? file.getFile().getTimestamp().getTimeInMillis() : -1; file.setFileLength(length); file.setLastModified(modified); if (length >= 0) { message.setHeader(Exchange.FILE_LENGTH, length); } if (modified >= 0) { message.setHeader(Exchange.FILE_LAST_MODIFIED, modified); } }
String path = file.getAbsoluteFilePath(); if (path.equals("/") || path.equals("\\")) { String path = file.getParent(); if (path.equals("/") || path.equals("\\")) { LOG.trace("List files {} found {} files", file.getAbsoluteFilePath(), files.size()); for (Object f : files) { SftpRemoteFile rf = (SftpRemoteFile) f; if (fastExistsCheck) { match = rf.getFilename().equals(file.getAbsoluteFilePath()) || rf.getFilename().equals(file.getFileNameOnly()); } else { match = rf.getFilename().equals(file.getFileNameOnly());
LOG.trace("JSonPath: {} is read as generic file: {}", path, json); GenericFile<?> genericFile = (GenericFile<?>) json; if (genericFile.getCharset() != null) { InputStream inputStream = new FileInputStream((File) genericFile.getFile()); return path.read(inputStream, genericFile.getCharset(), configuration);
try { String relativeName = file.getRelativeFilePath(); try { file.setBody(local);
@Override public void process(Exchange exchange) throws Exception { String fileName = exchange.getIn().getBody(GenericFile.class).getFileName(); String importConfigId = fileName.substring(0, fileName.indexOf('.')); ImportConfiguration importConfiguration = importConfigurationService.load(importConfigId); if(importConfiguration != null) { logger.debug("Set a header with import configuration found for ID : {}", importConfigId); exchange.getIn().setHeader(RouterConstants.HEADER_IMPORT_CONFIG_ONESHOT, importConfiguration); } else { logger.warn("No import configuration found with ID : {}", importConfigId); exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE); } }
String path = file.getAbsoluteFilePath(); if (path.equals("/") || path.equals("\\")) { String path = file.getParent(); if (path.equals("/") || path.equals("\\")) { LOG.trace("List files {} found {} files", file.getAbsoluteFilePath(), files.size()); for (FTPFile f : files) { boolean match; if (fastExistsCheck) { match = f.getName().equals(file.getAbsoluteFilePath()) || f.getName().equals(file.getFileNameOnly()); } else { match = f.getName().equals(file.getFileNameOnly());
String relativeName = target.getRelativeFilePath(); GenericFile<FTPFile> target = (GenericFile<FTPFile>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE); target.setBody(local);
@Override protected void updateFileHeaders(GenericFile<SftpRemoteFile> file, Message message) { Object rf = file.getFile().getRemoteFile(); if (rf != null) { ChannelSftp.LsEntry e = (ChannelSftp.LsEntry) rf; long length = e.getAttrs().getSize(); long modified = e.getAttrs().getMTime() * 1000L; file.setFileLength(length); file.setLastModified(modified); if (length >= 0) { message.setHeader(Exchange.FILE_LENGTH, length); } if (modified >= 0) { message.setHeader(Exchange.FILE_LAST_MODIFIED, modified); } } }
FileConsumer.asGenericFile( tarFile.getParent(), tarFile, Charset.defaultCharset().toString(), false); genericFile.bindToExchange(answer); GenericFile<File> genericFile = FileConsumer.asGenericFile( tarFile.getParent(), tarFile, Charset.defaultCharset().toString(), false); genericFile.bindToExchange(answer);
@Converter public static Source toStreamSource(GenericFile<File> genericFile){ return new StreamSource((File)genericFile.getBody()); }
FileConsumer.asGenericFile( zipFile.getParent(), zipFile, Charset.defaultCharset().toString(), false); genericFile.bindToExchange(answer); GenericFile<File> genericFile = FileConsumer.asGenericFile( zipFile.getParent(), zipFile, Charset.defaultCharset().toString(), false); genericFile.bindToExchange(answer);
@Converter public static Source toStreamSource(GenericFile<File> genericFile){ return new StreamSource((File)genericFile.getBody()); }