-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Xavier Marin edited this page Mar 11, 2014
·
7 revisions
For a complete usage and an up-to-date documentation, see here.
Camel-dav is an Apache Camel component designed for interacting with a webdav server.
mvn clean package -DskipTests
dav://host[:port]/path[?options]
or for a https connection :
davs://host[:port]/path[?options]
See File for more options as all the options from File is inherited.
| Property | Default | Description |
|---|---|---|
| localWorkDirectory | null | When consuming, a local work directory can be used to store the remote file content directly in local files, to avoid loading the content into memory. This is beneficial, if you consume a very big remote file and thus can conserve memory. See below for more details. |
| separator | Auto | Camel 2.6: Dictates what path separator char to use when uploading files. Auto = Use the path provided without altering it. UNIX = Use unix style path separators. Windows = Use Windows style path separators. |
| Property | Default | Description |
|---|---|---|
| CamelFileName | Specifies the output file name (relative to the endpoint directory) to be used for the output message when sending to the endpoint. If this is not present and no expression either, then a generated message ID is used as the filename instead. | |
| CamelFileNameProduced | The actual absolute filepath (path + name) for the output file that was written. This header is set by Camel and its purpose is providing end-users the name of the file that was written. | |
| CamelFileBatchIndex | Current index out of total number of files being consumed in this batch. | |
| CamelFileBatchSize | Total number of files being consumed in this batch. | |
| CamelFileHost | The remote hostname. | |
| CamelFileLocalWorkPath | Path to the local work file, if local work directory is used. |
from("file:/home/giwi/tmp/input").to("dav:localhost/webdav?autoCreate=false").to("log:result");
from("dav:localhost/webdav?autoCreate=false&idempotent=true&recursive=true").to("file:/home/giwi/tmp/output");
Camel supports pluggable filtering strategies. This strategy it to use the build in org.apache.camel.component.file.GenericFileFilter in Java. You can then configure the endpoint with such a filter to skip certain filters before being processed.
In the sample we have built our own filter that only accepts files starting with report in the filename.
public class MyFileFilter<T> implements GenericFileFilter<T> {
public boolean accept(GenericFile<T> file) {
// we only want report files
return file.getFileName().startsWith("report");
}
}
And then we can configure our route using the filter attribute to reference our filter (using # notation) that we have defined in the spring XML file:
<!-- define our sorter as a plain spring bean -->
<bean id="myFilter" class="com.mycompany.MyFileFilter"/>
<route>
<from uri="dav://somedavserver.com?&filter=#myFilter"/>
<to uri="bean:processInbox"/>
</route>