Ok, that was a good idea and it works (btw. I don't need the dependency in
the pom because commons-io is also in smx lib). But I see one problem with
this class because it don't offers support for recursive directories here
the accept()-method from the source:
public boolean accept(File file) {
if (file.isDirectory()) {
return false;
}
for (int i = 0; i < wildcards.length; i++) {
if (FilenameUtils.wildcardMatch(file.getName(), wildcards[i])) {
return true;
}
}
return false;
}
So maybe I use my filter with the extension from before it works but first I
will look if there is another filter in commons-io which offers support for
that.
/Steffen
lhe77 wrote:
>
> No, the version is ok.
> The error is btw really strange. I can remember we had this issue before
> but
> I am not sure how to solve it.
>
> A workaround could be:
>
> ...
> <beans ...>
>
> <file:poller service="brockhaus:inbox"
> endpoint="endpoint"
> targetService="brockhaus:transformer"
> targetUri="operation:http://brockhaus-
> gruppe.de/products/ProductTransformerService/process"
> file="file:///home/smx/input/products/"
> deleteFile="true"
> recursive="true"
> period="10000"
> filter="#XMLFilter" />
>
> <bean id="XMLFilter"
> class="org.apache.commons.io.filefilter.WildcardFilter">
> <constructor-arg value="*.xml" />
> </bean>
>
> </beans>
>
>
> --
> Am Dienstag 23 September 2008 15:35:21 schrieb steff aka sid:
>> Hm don't really works during deployment I got following exception:
>> Caused by: org.springframework.beans.factory.BeanCreationException: Error
>> creating bean with name 'org.apache.servicemix.file.FilePollerEndpoint'
>> defined in file
>> [/home/smx/apache-servicemix-3.2.2/data/smx/service-assemblies/BrockhausPro
>>ductsAssembly/version_1/sus/servicemix-file/BrockhausProductsInbox/xbean.xml
>>]: Error setting property values; nested exception is
>> org.springframework.beans.NotWritablePropertyException: Invalid property
>> 'property' of bean class [org.apache.servicemix.file.FilePollerEndpoint]:
>> Bean property 'property' is not writable or has an invalid setter method.
>> Does the parameter type of the setter match the return type of the
>> getter?
>>
>> My configuration was:
>> <file:poller service="brockhaus:inbox" endpoint="endpoint"
>> targetService="brockhaus:transformer"
>>
>> targetUri="operation:http://brockhaus-gruppe.de/products/ProductTransformer
>>Service/process" file="file:///home/smx/input/products/" deleteFile="true"
>> recursive="true" period="10000">
>> <property name="filter">
>> <bean class="org.apache.commons.io.filefilter.WildcardFilter">
>> <constructor-arg value="*.xml" />
>> </bean>
>> </property>
>> </file:poller>
>> And in the pom I added:
>> <dependency>
>> <groupId>commons-io</groupId>
>> <artifactId>commons-io</artifactId>
>> <version>1.4</version>
>> </dependency>
>>
>> is there a specific version of commons-io to use?
>>
>> Regards
>> /Steffen
>>
>> steff aka sid wrote:
>> > Ok,
>> > I've read about that but from root directory my solution works so I
>> don't
>> > changed it. Maybe this works better with recursion. Thank you.
>> >
>> > Regards
>> > /Steffen
>> >
>> > lhe77 wrote:
>> >> Actually I never wrote my own filters and in your case it's not needed
>> >> to write
>> >> your own filter because you can use the predefined WildcardFilter from
>> >> commons.io lib.
>> >>
>> >> Just add the dependency to your su's pom.xml and have something like
>> the
>> >> below:
>> >>
>> >>
>> >> <f:poller
>> >> service="my:filePoller"
>> >> endpoint="pollerEndpoint"
>> >> autoCreateDirectory="true"
>> >> file="/home/user/myinput/"
>> >> targetService="..."
>> >> targetOperation="..."
>> >> period="10000"
>> >> recursive="true">
>> >>
>> >> <property name="filter">
>> >> <bean class="org.apache.commons.io.filefilter.WildcardFilter">
>> >> <constructor-arg value="*.xml" />
>> >> </bean>
>> >> </property>
>> >>
>> >> </f:poller>
>> >>
>> >> Lars
>> >>
>> >> Am Dienstag 23 September 2008 14:50:16 schrieb steff aka sid:
>> >>> No, thats not enough :) you have to read the contents of the
>> directory
>> >>> and
>> >>> to check them e.g. with pathname.listFiles() The problem is that it
>> is
>> >>> not
>> >>> possible. To get a result for each file... but I will try it maybe it
>> >>> works
>> >>> as asspected.
>> >>>
>> >>> Regards
>> >>> /Steffen
>> >>>
>> >>> lhe77 wrote:
>> >>> > public class XMLFilter implements FileFilter {
>> >>> >
>> >>> > public static String XML_FILEEXTENSION = ".xml";
>> >>> >
>> >>> > public boolean accept(File pathname) {
>> >>> >
>> >>> > if (pathname.isDirectory() ||
>> >>> > (pathname.isFile() &&
>> >>> > strFilename.endsWith(XML_FILEEXTENSION))
>> >>> > ) {
>> >>> > return true;
>> >>> > }
>> >>> > return false;
>> >>> > }
>> >>> > }
>> >>> >
>> >>> > should do the trick.
>> >>> >
>> >>> > Lars
>> >>> >
>> >>> > Am Dienstag 23 September 2008 14:38:13 schrieb steff aka sid:
>> >>> >> public class XMLFilter implements FileFilter {
>> >>> >>
>> >>> >> public static String XML_FILEEXTENSION = ".xml";
>> >>> >>
>> >>> >> public boolean accept(File pathname) {
>> >>> >> System.out.println(pathname);
>> >>> >> String strFilename = pathname.getName();
>> >>> >> if (strFilename.endsWith(XML_FILEEXTENSION)) {
>> >>> >> return true;
>> >>> >> }
>> >>> >> return false;
>> >>> >> }
>> >>> >> }
>> >>>
>> >>> -----
>> >>> Brockhaus GmbH
>> >>> COMPETITIVE THROUGH KNOWLEDGE
>> >>>
>> >>> Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
>> >>> http://www.brockhaus-group.com www.brockhaus-group.com
>>
>> -----
>> Brockhaus GmbH
>> COMPETITIVE THROUGH KNOWLEDGE
>>
>> Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
>> http://www.brockhaus-group.com www.brockhaus-group.com
>
>
>
-----
Brockhaus GmbH
COMPETITIVE THROUGH KNOWLEDGE
Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
http://www.brockhaus-group.com www.brockhaus-group.com
--
View this message in context:
http://www.nabble.com/recursive-file-polling-don%27t-work-on-linux-tp14841533p19628151.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.