Skip to content

Commit 1f05d3e

Browse files
committed
Polishing some Docs and JavaDocs
* Mentioned `byte[]` support for the `UnmarshallingTransformer` * Fix `AbstractInboundFileSynchronizingMessageSource` JavaDocs to mention the current `FileSystemPersistentAcceptOnceFileListFilter` usage by default, not an `AcceptOnceFileListFilter` * Polishing `AbstractInboundFileSynchronizingMessageSource` code style a bit
1 parent 7113236 commit 1f05d3e

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizingMessageSource.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
2929
import org.springframework.integration.file.DefaultDirectoryScanner;
3030
import org.springframework.integration.file.DirectoryScanner;
3131
import org.springframework.integration.file.FileReadingMessageSource;
32-
import org.springframework.integration.file.filters.AcceptOnceFileListFilter;
3332
import org.springframework.integration.file.filters.CompositeFileListFilter;
3433
import org.springframework.integration.file.filters.FileListFilter;
3534
import org.springframework.integration.file.filters.FileSystemPersistentAcceptOnceFileListFilter;
@@ -77,24 +76,25 @@ public abstract class AbstractInboundFileSynchronizingMessageSource<F>
7776
*/
7877
private final LocalFileReadingMessageSource fileSource;
7978

80-
private volatile boolean running;
81-
8279
/**
8380
* Should the endpoint attempt to create the local directory? True by default.
8481
*/
85-
private volatile boolean autoCreateLocalDirectory = true;
82+
private boolean autoCreateLocalDirectory = true;
8683

8784
/**
8885
* Directory to which things should be synchronized locally.
8986
*/
90-
private volatile File localDirectory;
87+
private File localDirectory;
9188

92-
private volatile FileListFilter<File> localFileListFilter;
89+
private FileListFilter<File> localFileListFilter;
9390

9491
/**
9592
* Whether the {@link DirectoryScanner} was explicitly set.
9693
*/
97-
private volatile boolean scannerExplicitlySet = false;
94+
private boolean scannerExplicitlySet = false;
95+
96+
private volatile boolean running;
97+
9898

9999
public AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer) {
100100
this(synchronizer, null);
@@ -127,10 +127,8 @@ public void setLocalDirectory(File localDirectory) {
127127
* after they have been synchronized. It will be combined with a filter that
128128
* will prevent accessing files that are in the process of being synchronized
129129
* (files having the {@link AbstractInboundFileSynchronizer#getTemporaryFileSuffix()}).
130-
* <p>
131-
* The default is an {@link AcceptOnceFileListFilter} which filters duplicate file
132-
* names (processed during the current execution).
133-
*
130+
* <p> The default is an {@link FileSystemPersistentAcceptOnceFileListFilter}
131+
* which filters duplicate file names (processed during the current execution).
134132
* @param localFileListFilter The local file list filter.
135133
*/
136134
public void setLocalFilter(FileListFilter<File> localFileListFilter) {
@@ -147,7 +145,8 @@ public void setLocalFilter(FileListFilter<File> localFileListFilter) {
147145
public void setUseWatchService(boolean useWatchService) {
148146
this.fileSource.setUseWatchService(useWatchService);
149147
if (useWatchService) {
150-
this.fileSource.setWatchEvents(FileReadingMessageSource.WatchEventType.CREATE,
148+
this.fileSource.setWatchEvents(
149+
FileReadingMessageSource.WatchEventType.CREATE,
151150
FileReadingMessageSource.WatchEventType.MODIFY,
152151
FileReadingMessageSource.WatchEventType.DELETE);
153152
}
@@ -182,14 +181,15 @@ public void afterPropertiesSet() throws Exception {
182181
}
183182
this.fileSource.setDirectory(this.localDirectory);
184183
if (this.localFileListFilter == null) {
185-
this.localFileListFilter = new FileSystemPersistentAcceptOnceFileListFilter(
186-
new SimpleMetadataStore(), getComponentName());
184+
this.localFileListFilter =
185+
new FileSystemPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), getComponentName());
187186
}
188187
FileListFilter<File> filter = buildFilter();
189188
if (this.scannerExplicitlySet) {
190189
Assert.state(!this.fileSource.isUseWatchService(),
191190
"'useWatchService' and 'scanner' are mutually exclusive.");
192-
this.fileSource.getScanner().setFilter(filter);
191+
this.fileSource.getScanner()
192+
.setFilter(filter);
193193
}
194194
else if (!this.fileSource.isUseWatchService()) {
195195
DirectoryScanner directoryScanner = new DefaultDirectoryScanner();
@@ -209,8 +209,7 @@ else if (!this.fileSource.isUseWatchService()) {
209209
throw e;
210210
}
211211
catch (Exception e) {
212-
throw new BeanInitializationException("Failure during initialization of MessageSource for: "
213-
+ this.getClass(), e);
212+
throw new BeanInitializationException("Failure during initialization for: " + this, e);
214213
}
215214
}
216215

src/reference/asciidoc/xml.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ An http://docs.spring.io/spring-integration/api/org/springframework/integration/
270270
Spring's Object/XML Mapping support provides several implementations supporting marshalling and unmarshalling using http://en.wikipedia.org/wiki/Java_Architecture_for_XML_Binding[JAXB], http://www.castor.org/[Castor] and http://jibx.sourceforge.net/[JiBX] amongst others.
271271
The unmarshaller requires an instance of `Source`.
272272
If the message payload is not an instance of `Source`, conversion will be attempted.
273-
Currently `String`, `File` and `org.w3c.dom.Document` payloads are supported.
273+
Currently `String`, `File`, `byte[]` and `org.w3c.dom.Document` payloads are supported.
274274
Custom conversion to a `Source` is also supported by injecting an implementation of a http://docs.spring.io/spring-integration/api/org/springframework/integration/xml/source/SourceFactory.html[SourceFactory].
275275

276276
NOTE: If a `SourceFactory` is not set explicitly, the property on the `UnmarshallingTransformer` will by default be set to a http://docs.spring.io/spring-integration/api/org/springframework/integration/xml/source/DomSourceFactory.html[DomSourceFactory].

0 commit comments

Comments
 (0)