org.springframework.integration.file.support.FileExistsMode Java Examples

The following examples show how to use org.springframework.integration.file.support.FileExistsMode. 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: FileWriterIntegrationConfig.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Profile("javaconfig")
@Bean
@ServiceActivator(inputChannel="fileWriterChannel")
public FileWritingMessageHandler fileWriter() {
  FileWritingMessageHandler handler =
      new FileWritingMessageHandler(new File("/tmp/sia5/files"));
  handler.setExpectReply(false);
  handler.setFileExistsMode(FileExistsMode.APPEND);
  handler.setAppendNewLine(true);
  return handler;
}
 
Example #2
Source File: FileWriterIntegrationConfig.java    From spring-in-action-5-samples with Apache License 2.0 5 votes vote down vote up
@Profile("javadsl")
@Bean
public IntegrationFlow fileWriterFlow() {
  return IntegrationFlows
      .from(MessageChannels.direct("textInChannel"))
      .<String, String>transform(t -> t.toUpperCase())
      .handle(Files
          .outboundAdapter(new File("/tmp/sia5/files"))
          .fileExistsMode(FileExistsMode.APPEND)
          .appendNewLine(true))
      .get(); 
}
 
Example #3
Source File: FtpSinkPropertiesTests.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@Test
public void fileExistsModeCanBeCustomized() {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, "ftp.mode:FAIL");
	context.register(Conf.class);
	context.refresh();
	FtpSinkProperties properties = context.getBean(FtpSinkProperties.class);
	assertThat(properties.getMode(), equalTo(FileExistsMode.FAIL));
}
 
Example #4
Source File: SftpSinkPropertiesTests.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@Test
public void fileExistsModeCanBeCustomized() {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, "sftp.mode:FAIL");
	context.register(Conf.class);
	context.refresh();
	SftpSinkProperties properties = context.getBean(SftpSinkProperties.class);
	assertThat(properties.getMode(), equalTo(FileExistsMode.FAIL));
}
 
Example #5
Source File: FileCopyConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
@ServiceActivator(inputChannel = "fileChannel")
public MessageHandler fileWritingMessageHandler() {
    FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR));
    handler.setFileExistsMode(FileExistsMode.REPLACE);
    handler.setExpectReply(false);
    return handler;
}
 
Example #6
Source File: GcsMessageHandler.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
public GcsMessageHandler(RemoteFileTemplate<BlobInfo> remoteFileTemplate, FileExistsMode mode) {
	super(remoteFileTemplate, mode);
}
 
Example #7
Source File: AbstractRemoteFileSinkProperties.java    From spring-cloud-stream-app-starters with Apache License 2.0 4 votes vote down vote up
@NotNull
public FileExistsMode getMode() {
	return this.mode;
}
 
Example #8
Source File: AbstractRemoteFileSinkProperties.java    From spring-cloud-stream-app-starters with Apache License 2.0 4 votes vote down vote up
public void setMode(FileExistsMode mode) {
	this.mode = mode;
}
 
Example #9
Source File: FileSinkProperties.java    From spring-cloud-stream-app-starters with Apache License 2.0 4 votes vote down vote up
public FileExistsMode getMode() {
	return mode;
}
 
Example #10
Source File: FileSinkProperties.java    From spring-cloud-stream-app-starters with Apache License 2.0 4 votes vote down vote up
public void setMode(FileExistsMode mode) {
	this.mode = mode;
}