From cbd1a06a2c58f9d99cb59edb71d4c37c4d82a14f Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 22 Aug 2012 12:24:00 -0400 Subject: [PATCH] INTSAMPLES-81 File Sample: Fix FWMH Field Access FileWritingMessageHandler: Sample accessed 'destinationDirectory' field; it is now 'destinationDirectoryExpression'. --- basic/file/pom.xml | 17 ++++++++++------- .../samples/filecopy/FileCopyDemoCommon.java | 9 ++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/basic/file/pom.xml b/basic/file/pom.xml index 722b1d5e..75d59ccc 100644 --- a/basic/file/pom.xml +++ b/basic/file/pom.xml @@ -4,13 +4,16 @@ 4.0.0 org.springframework.integration.samples file - 2.1.0.BUILD-SNAPSHOT + 2.2.0.BUILD-SNAPSHOT Samples (Basic) - File Copy jar + + 2.2.1 + UTF-8 - 2.1.0.RELEASE - 1.2.16 + 2.2.0.RC2 + 1.2.17 4.10 @@ -36,13 +39,13 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 2.5.1 - 1.5 - 1.5 + 1.6 + 1.6 -Xlint:all true - false + true diff --git a/basic/file/src/main/java/org/springframework/integration/samples/filecopy/FileCopyDemoCommon.java b/basic/file/src/main/java/org/springframework/integration/samples/filecopy/FileCopyDemoCommon.java index 72fb0187..627c5b27 100644 --- a/basic/file/src/main/java/org/springframework/integration/samples/filecopy/FileCopyDemoCommon.java +++ b/basic/file/src/main/java/org/springframework/integration/samples/filecopy/FileCopyDemoCommon.java @@ -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("===================================================");