org.springframework.integration.file.remote.session.SessionFactory Java Examples
The following examples show how to use
org.springframework.integration.file.remote.session.SessionFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FtpSinkConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 6 votes |
@Bean public IntegrationFlow ftpInboundFlow(FtpSinkProperties properties, SessionFactory<FTPFile> ftpSessionFactory) { FtpMessageHandlerSpec handlerSpec = Ftp.outboundAdapter(new FtpRemoteFileTemplate(ftpSessionFactory), properties.getMode()) .remoteDirectory(properties.getRemoteDir()) .remoteFileSeparator(properties.getRemoteFileSeparator()) .autoCreateDirectory(properties.isAutoCreateDir()) .temporaryFileSuffix(properties.getTmpFileSuffix()); if (properties.getFilenameExpression() != null) { handlerSpec.fileNameExpression(properties.getFilenameExpression().getExpressionString()); } return IntegrationFlows.from(Sink.INPUT) .handle(handlerSpec, new Consumer<GenericEndpointSpec<FileTransferringMessageHandler<FTPFile>>>() { @Override public void accept(GenericEndpointSpec<FileTransferringMessageHandler<FTPFile>> e) { e.autoStartup(false); } }) .get(); }
Example #2
Source File: SftpSinkConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 6 votes |
@Bean public IntegrationFlow ftpInboundFlow(SftpSinkProperties properties, SessionFactory<LsEntry> ftpSessionFactory) { SftpMessageHandlerSpec handlerSpec = Sftp.outboundAdapter(new SftpRemoteFileTemplate(ftpSessionFactory), properties.getMode()) .remoteDirectory(properties.getRemoteDir()) .remoteFileSeparator(properties.getRemoteFileSeparator()) .autoCreateDirectory(properties.isAutoCreateDir()) .temporaryFileSuffix(properties.getTmpFileSuffix()); if (properties.getFilenameExpression() != null) { handlerSpec.fileNameExpression(properties.getFilenameExpression().getExpressionString()); } return IntegrationFlows.from(Sink.INPUT) .handle(handlerSpec, new Consumer<GenericEndpointSpec<FileTransferringMessageHandler<LsEntry>>>() { @Override public void accept(GenericEndpointSpec<FileTransferringMessageHandler<LsEntry>> e) { e.autoStartup(false); } }) .get(); }
Example #3
Source File: SftpConfig.java From java-examples with MIT License | 5 votes |
@Bean public SessionFactory<LsEntry> sftpSessionFactory() { DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true); factory.setHost(sftpHost); factory.setPort(sftpPort); factory.setUser(sftpUser); if (sftpPrivateKey != null) { factory.setPrivateKey(sftpPrivateKey); factory.setPrivateKeyPassphrase(sftpPrivateKeyPassphrase); } else { factory.setPassword(sftpPasword); } factory.setAllowUnknownKeys(true); return new CachingSessionFactory<LsEntry>(factory); }
Example #4
Source File: SftpConfig.java From java-examples with MIT License | 5 votes |
@Bean public SessionFactory<LsEntry> sftpSessionFactory() { DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true); factory.setHost(sftpHost); factory.setPort(sftpPort); factory.setUser(sftpUser); if (sftpPrivateKey != null) { factory.setPrivateKey(sftpPrivateKey); factory.setPrivateKeyPassphrase(sftpPrivateKeyPassphrase); } else { factory.setPassword(sftpPasword); } factory.setAllowUnknownKeys(true); return new CachingSessionFactory<LsEntry>(factory); }
Example #5
Source File: FtpSourceConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Bean public IntegrationFlow ftpInboundFlow(SessionFactory<FTPFile> ftpSessionFactory, FtpSourceProperties properties, FileConsumerProperties fileConsumerProperties) { FtpInboundChannelAdapterSpec messageSourceBuilder = Ftp.inboundAdapter(ftpSessionFactory) .preserveTimestamp(properties.isPreserveTimestamp()) .remoteDirectory(properties.getRemoteDir()) .remoteFileSeparator(properties.getRemoteFileSeparator()) .localDirectory(properties.getLocalDir()) .autoCreateLocalDirectory(properties.isAutoCreateLocalDir()) .temporaryFileSuffix(properties.getTmpFileSuffix()) .deleteRemoteFiles(properties.isDeleteRemoteFiles()); if (StringUtils.hasText(properties.getFilenamePattern())) { messageSourceBuilder.filter(new FtpSimplePatternFileListFilter(properties.getFilenamePattern())); } else if (properties.getFilenameRegex() != null) { messageSourceBuilder .filter(new FtpRegexPatternFileListFilter(properties.getFilenameRegex())); } IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(messageSourceBuilder , new Consumer<SourcePollingChannelAdapterSpec>() { @Override public void accept(SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) { sourcePollingChannelAdapterSpec .poller(FtpSourceConfiguration.this.defaultPoller); } }); return FileUtils.enhanceFlowForReadingMode(flowBuilder, fileConsumerProperties) .channel(this.source.output()) .get(); }
Example #6
Source File: SftpSourceConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Bean public IntegrationFlow sftpInboundFlow(SessionFactory<LsEntry> sftpSessionFactory, SftpSourceProperties properties, FileConsumerProperties fileConsumerProperties) { SftpInboundChannelAdapterSpec messageSourceBuilder = Sftp.inboundAdapter(sftpSessionFactory) .preserveTimestamp(properties.isPreserveTimestamp()) .remoteDirectory(properties.getRemoteDir()) .remoteFileSeparator(properties.getRemoteFileSeparator()) .localDirectory(properties.getLocalDir()) .autoCreateLocalDirectory(properties.isAutoCreateLocalDir()) .temporaryFileSuffix(properties.getTmpFileSuffix()) .deleteRemoteFiles(properties.isDeleteRemoteFiles()); if (StringUtils.hasText(properties.getFilenamePattern())) { messageSourceBuilder.filter(new SftpSimplePatternFileListFilter(properties.getFilenamePattern())); } else if (properties.getFilenameRegex() != null) { messageSourceBuilder .filter(new SftpRegexPatternFileListFilter(properties.getFilenameRegex())); } IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(messageSourceBuilder , new Consumer<SourcePollingChannelAdapterSpec>() { @Override public void accept(SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) { sourcePollingChannelAdapterSpec .poller(SftpSourceConfiguration.this.defaultPoller); } }); return FileUtils.enhanceFlowForReadingMode(flowBuilder, fileConsumerProperties) .channel(this.source.output()) .get(); }
Example #7
Source File: SftpSourceTestConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Bean public SessionFactory<LsEntry> sftpSessionFactory() { @SuppressWarnings("unchecked") SessionFactory<LsEntry> ftpSessionFactory = Mockito.mock(SessionFactory.class); @SuppressWarnings("unchecked") Session<LsEntry> session = mock(Session.class); when(ftpSessionFactory.getSession()).thenReturn(session); return ftpSessionFactory; }
Example #8
Source File: GcsMessageHandler.java From spring-cloud-gcp with Apache License 2.0 | 4 votes |
public GcsMessageHandler(SessionFactory<BlobInfo> sessionFactory) { super(sessionFactory); }
Example #9
Source File: GcsRemoteFileTemplate.java From spring-cloud-gcp with Apache License 2.0 | 2 votes |
/** * Construct a {@link RemoteFileTemplate} with the supplied session factory. * * @param sessionFactory the session factory. */ public GcsRemoteFileTemplate(SessionFactory<BlobInfo> sessionFactory) { super(sessionFactory); }