INTSAMPLES-81 File Sample: Fix FWMH Field Access

FileWritingMessageHandler:

Sample accessed 'destinationDirectory' field; it
is now 'destinationDirectoryExpression'.
This commit is contained in:
Gary Russell
2012-08-22 12:24:00 -04:00
committed by Gunnar Hillert
parent 7a7733b3ed
commit cbd1a06a2c
2 changed files with 16 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,20 +20,23 @@ import java.io.File;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.ApplicationContext;
import org.springframework.expression.common.LiteralExpression;
import org.springframework.integration.file.FileReadingMessageSource;
import org.springframework.integration.file.FileWritingMessageHandler;
/**
* Displays the names of the input and output directories.
*
*
* @author Marius Bogoevici
* @author Mark Fisher
* @author Gary Russell
*/
public class FileCopyDemoCommon {
public static void displayDirectories(ApplicationContext context) {
File inDir = (File) new DirectFieldAccessor(context.getBean(FileReadingMessageSource.class)).getPropertyValue("directory");
File outDir = (File) new DirectFieldAccessor(context.getBean(FileWritingMessageHandler.class)).getPropertyValue("destinationDirectory");
LiteralExpression expression = (LiteralExpression) new DirectFieldAccessor(context.getBean(FileWritingMessageHandler.class)).getPropertyValue("destinationDirectoryExpression");
File outDir = new File(expression.getValue());
System.out.println("Input directory is: " + inDir.getAbsolutePath());
System.out.println("Output directory is: " + outDir.getAbsolutePath());
System.out.println("===================================================");