INT-606 Added support for the 'delete-source-files' attribute on the 'outbound-channel-adapter' in the file namespace.

This commit is contained in:
Mark Fisher
2009-06-30 22:25:40 +00:00
parent 5fe7ee6b6c
commit 3ea4a2c9d9
2 changed files with 12 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.util.StringUtils;
@@ -47,6 +48,7 @@ public class FileOutboundChannelAdapterParser extends AbstractOutboundChannelAda
.genericBeanDefinition("org.springframework.integration.file.FileWritingMessageHandler");
builder.addConstructorArgValue(directory);
builder.addPropertyReference("outputChannel", IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME);
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delete-source-files");
String fileNameGenerator = element.getAttribute("filename-generator");
if (StringUtils.hasText(fileNameGenerator)) {
builder.addPropertyReference("fileNameGenerator", fileNameGenerator);

View File

@@ -105,6 +105,16 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="delete-source-files" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Specify whether to delete source files after writing to the destination directory.
This will take effect if the Message payload is the actual source File instance
or if the original File instance (or its path) is available in the header value
associated with the FileHeaders.ORIGINAL_FILE constant. The default value is false.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>