diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java
index 23a813e391..22a01da987 100644
--- a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java
+++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileNamespaceHandler.java
@@ -27,6 +27,7 @@ public class FileNamespaceHandler extends NamespaceHandlerSupport {
public void init() {
registerBeanDefinitionParser("inbound-channel-adapter", new FileInboundChannelAdapterParser());
+ registerBeanDefinitionParser("outbound-channel-adapter", new FileOutboundChannelAdapterParser());
}
}
diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParser.java b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParser.java
new file mode 100644
index 0000000000..60134ea868
--- /dev/null
+++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParser.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2002-2008 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.file.config;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.integration.config.AbstractOutboundChannelAdapterParser;
+import org.springframework.integration.file.FileWritingMessageConsumer;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+
+/**
+ * Parser for the <outbound-channel-adapter/> element of the 'file' namespace.
+ *
+ * @author Mark Fisher
+ */
+public class FileOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser {
+
+ @Override
+ protected String parseConsumer(Element element, ParserContext parserContext) {
+ String directory = element.getAttribute("directory");
+ Assert.hasText(directory, "directory is required");
+ BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(FileWritingMessageConsumer.class);
+ builder.addConstructorArgValue(directory);
+ String fileNameGenerator = element.getAttribute("filename-generator");
+ if (StringUtils.hasText(fileNameGenerator)) {
+ builder.addPropertyReference("fileNameGenerator", fileNameGenerator);
+ }
+ return BeanDefinitionReaderUtils.registerWithGeneratedName(
+ builder.getBeanDefinition(), parserContext.getRegistry());
+ }
+
+}
diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/spring-integration-file-1.0.xsd b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/spring-integration-file-1.0.xsd
index d6bb945b0d..dc487c5b16 100644
--- a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/spring-integration-file-1.0.xsd
+++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/config/spring-integration-file-1.0.xsd
@@ -29,11 +29,25 @@
-
+
+
+
+
+
+ Configures an outbound Channel Adapter that writes Message payloads to a File.
+
+
+
+
+
+
+
+
+