Example usage for org.springframework.integration.metadata SimpleMetadataStore SimpleMetadataStore

List of usage examples for org.springframework.integration.metadata SimpleMetadataStore SimpleMetadataStore

Introduction

In this page you can find the example usage for org.springframework.integration.metadata SimpleMetadataStore SimpleMetadataStore.

Prototype

public SimpleMetadataStore() 

Source Link

Document

Instantiate a SimpleMetadataStore using an in-memory ConcurrentHashMap .

Usage

From source file:org.springframework.integration.ftp.dsl.FtpInboundChannelAdapterSpec.java

@SuppressWarnings("unchecked")
private CompositeFileListFilter<FTPFile> composeFilters(FileListFilter<FTPFile> fileListFilter) {
    CompositeFileListFilter<FTPFile> compositeFileListFilter = new CompositeFileListFilter<>();
    compositeFileListFilter.addFilters(fileListFilter,
            new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "ftpMessageSource"));
    return compositeFileListFilter;
}

From source file:org.springframework.integration.ftp.dsl.FtpStreamingInboundChannelAdapterSpec.java

@SuppressWarnings("unchecked")
private CompositeFileListFilter<FTPFile> composeFilters(FileListFilter<FTPFile> fileListFilter) {
    CompositeFileListFilter<FTPFile> compositeFileListFilter = new CompositeFileListFilter<>();
    compositeFileListFilter.addFilters(fileListFilter,
            new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "ftpStreamingMessageSource"));
    return compositeFileListFilter;
}

From source file:org.springframework.integration.ftp.filters.FtpPersistentAcceptOnceFileListFilterTests.java

@Test
public void testRollback() throws Exception {
    FtpPersistentAcceptOnceFileListFilter filter = new FtpPersistentAcceptOnceFileListFilter(
            new SimpleMetadataStore(), "rollback:");
    FTPFile ftpFile1 = new FTPFile();
    ftpFile1.setName("foo");
    ftpFile1.setTimestamp(Calendar.getInstance());
    FTPFile ftpFile2 = new FTPFile();
    ftpFile2.setName("bar");
    ftpFile2.setTimestamp(Calendar.getInstance());
    FTPFile ftpFile3 = new FTPFile();
    ftpFile3.setName("baz");
    ftpFile3.setTimestamp(Calendar.getInstance());
    FTPFile[] files = new FTPFile[] { ftpFile1, ftpFile2, ftpFile3 };
    List<FTPFile> passed = filter.filterFiles(files);
    assertTrue(Arrays.equals(files, passed.toArray()));
    List<FTPFile> now = filter.filterFiles(files);
    assertEquals(0, now.size());//  w  w w.  j av a 2 s  .  c  o m
    filter.rollback(passed.get(1), passed);
    now = filter.filterFiles(files);
    assertEquals(2, now.size());
    assertEquals("bar", now.get(0).getName());
    assertEquals("baz", now.get(1).getName());
    now = filter.filterFiles(files);
    assertEquals(0, now.size());
    filter.close();
}

From source file:org.springframework.integration.ftp.inbound.FtpStreamingMessageSource.java

/**
 * Construct an instance with the supplied template and comparator.
 * Note: the comparator is applied each time the remote directory is listed
 * which only occurs when the previous list is exhausted.
 * @param template the template./*w ww. j  a  v a2  s.  c om*/
 * @param comparator the comparator.
 */
public FtpStreamingMessageSource(RemoteFileTemplate<FTPFile> template,
        Comparator<AbstractFileInfo<FTPFile>> comparator) {
    super(template, comparator);
    doSetFilter(
            new FtpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "ftpStreamingMessageSource"));
}