List of usage examples for org.springframework.integration.file HeadDirectoryScanner HeadDirectoryScanner
public HeadDirectoryScanner(int maxNumberOfFiles)
From source file:com.iana.dver.pdf.scrapper.DVERScrapperTask.java
public void readAndParseDVER() throws WrongConfigurationException, IOException { if (scanDir == null && archiveDir == null && maxFiles == null && xmlDir == null) { log.info("Wrong configuration used"); throw new WrongConfigurationException("Some configuration is missing in job"); }/*from w w w.java 2s . c o m*/ // Fetching the files up to 50 DirectoryScanner scanner = new HeadDirectoryScanner(Integer.parseInt(maxFiles.trim())); File dverScanDirectory = new File(scanDir); if (dverScanDirectory.isDirectory()) { List<File> files = scanner.listFiles(dverScanDirectory); // Sorting the list as per created time. Collections.sort(files, LastModifiedFileComparator.LASTMODIFIED_COMPARATOR); // Iterate the files list for (File file : files) { if (file.isFile()) { PDFTextStripperByArea textStripper = readDVER(file); generateDverXML(FilenameUtils.getBaseName(file.getName()), textStripper); } } } else { throw new WrongConfigurationException("The Path to look for DVER is not a directory"); } }
From source file:org.springframework.integration.file.FileReadingMessageSource.java
/** * Creates a FileReadingMessageSource with a bounded queue of the given * capacity. This can be used to reduce the memory footprint of this * component when reading from a large directory. * * @param internalQueueCapacity//from www.j a v a2 s .com * the size of the queue used to cache files to be received * internally. This queue can be made larger to optimize the * directory scanning. With scanEachPoll set to false and the * queue to a large size, it will be filled once and then * completely emptied before a new directory listing is done. * This is particularly useful to reduce scans of large numbers * of files in a directory. */ public FileReadingMessageSource(int internalQueueCapacity) { this(null); Assert.isTrue(internalQueueCapacity > 0, "Cannot create a queue with non positive capacity"); this.setScanner(new HeadDirectoryScanner(internalQueueCapacity)); }
From source file:uk.ac.bbsrc.tgac.miso.tools.run.FileQueueMessageSource.java
/** * Creates a FileReadingMessageSource with a bounded queue of the given * capacity. This can be used to reduce the memory footprint of this * component when reading from a large directory. * * @param internalQueueCapacity the size of the queue used to cache files to be received * internally. This queue can be made larger to optimize the * directory scanning. With scanEachPoll set to false and the * queue to a large size, it will be filled once and then * completely emptied before a new directory listing is done. * This is particularly useful to reduce scans of large numbers * of files in a directory. *///w w w. java 2 s . c o m public FileQueueMessageSource(int internalQueueCapacity) { this(null); Assert.isTrue(internalQueueCapacity > 0, "Cannot create a queue with non positive capacity"); this.setScanner(new HeadDirectoryScanner(internalQueueCapacity)); }
From source file:uk.ac.bbsrc.tgac.miso.tools.run.MultiFileQueueMessageSource.java
/** * Creates a MultiFileQueueMessageSource with a bounded queue of the given * capacity. This can be used to reduce the memory footprint of this * component when reading from a large directory. * * @param internalQueueCapacity the size of the queue used to cache files to be received * internally. This queue can be made larger to optimize the * directory scanning. With scanEachPoll set to false and the * queue to a large size, it will be filled once and then * completely emptied before a new directory listing is done. * This is particularly useful to reduce scans of large numbers * of files in a directory. *///from w w w. j av a 2 s. com public MultiFileQueueMessageSource(int internalQueueCapacity) { this(null); Assert.isTrue(internalQueueCapacity > 0, "Cannot create a queue with non positive capacity"); this.setScanner(new HeadDirectoryScanner(internalQueueCapacity)); }