INT-3223 Polishing

JIRA: https://jira.springsource.org/browse/INT-3223

Don't use primitives in Tail factory bean setters so that the placeholders
for attributes that force the Apache implementation can resolve to "".

Test for an empty string in native-options and don't set.
This commit is contained in:
Gary Russell
2013-12-09 14:47:00 -05:00
parent 1a21dd172f
commit 9c9c93479a
2 changed files with 25 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ import org.springframework.integration.file.tail.FileTailingMessageProducerSuppo
import org.springframework.integration.file.tail.OSDelegatingFileTailingMessageProducer;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* @author Gary Russell
@@ -67,7 +68,9 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
private volatile ApplicationEventPublisher applicationEventPublisher;
public void setNativeOptions(String nativeOptions) {
this.nativeOptions = nativeOptions;
if (StringUtils.hasText(nativeOptions)) {
this.nativeOptions = nativeOptions;
}
}
public void setFile(File file) {
@@ -82,11 +85,11 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
this.taskScheduler = taskScheduler;
}
public void setDelay(long delay) {
public void setDelay(Long delay) {
this.delay = delay;
}
public void setFileDelay(long fileDelay) {
public void setFileDelay(Long fileDelay) {
this.fileDelay = fileDelay;
}
@@ -107,11 +110,11 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
this.outputChannel = outputChannel;
}
public void setAutoStartup(boolean autoStartup) {
public void setAutoStartup(Boolean autoStartup) {
this.autoStartup = autoStartup;
}
public void setPhase(int phase) {
public void setPhase(Integer phase) {
this.phase = phase;
}

View File

@@ -4,10 +4,14 @@
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<int-file:tail-inbound-channel-adapter id="default"
channel="input"
@@ -24,17 +28,28 @@
file-delay="456"
file="/tmp/foo"
auto-startup="false"
delay="${empty}"
end="${empty}"
reopen="${empty}"
phase="123" />
<int-file:tail-inbound-channel-adapter id="apacheDefault"
channel="input"
native-options="${empty}"
task-executor="exec"
file="/tmp/bar"
delay="2000"
delay="${foo}"
file-delay="10000"
auto-startup="false"
phase="123" />
<context:property-placeholder properties-ref="props"/>
<util:properties id="props">
<prop key="foo">2000</prop>
<prop key="empty"></prop>
</util:properties>
<int-file:tail-inbound-channel-adapter id="apacheEndReopen"
channel="input"
task-executor="exec"