ServiceMix :: FTP Component
So in the project I talked from in the post before we maybe want to use ServiceMix as something like an transfer/routing server. So I looked at the ftp component to be able to get data from servers which are not running on the same machine (now at todays point it seems like that the other servers will bring us the data, so we don’t need ftp, but earlier this was not clear). So the basic configuration of an ftp component is easily done and you find enough documentation to get started. But I want to try the filter property which must be of the type "java.io.FileFilter" so this means we have to create/use an class which implements the FileFilter interface. But how can we add the class to our configuration and how we get maven to compile this class during packaging our component? Here is my solution its something like combining the ftp component with the bean component:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0"
xmlns:bean="http://www.springframework.org/schema/beans"
xmlns:brockhaus="http://www.brockhaus.de/services"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://servicemix.apache.org/ftp/1.0
http://servicemix.apache.org/schema/servicemix-ftp-3.2.2.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<ftp:poller service="brockhaus:FtpInputService"
endpoint="endpoint"
targetService="brockhaus:ProductTransformerService"
uri="ftp://servicemix:rocks@localhost/smx/products"
filter="#XMLFilter" />
<bean:bean id="XMLFilter" class="de.brockhaus.utils.XMLFilter"/>
</beans>
So as you can see there is a bean tag added, which includes the full qualified name of the Java class. This class is stored equally to a bean componenten under src/main/java/<package_declaration>. Thats all.
Some basic informations: