You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lenp <le...@redpill-linpro.com> on 2011/09/29 12:20:39 UTC

Need help on using Ant path matcher

Camel 2.8.1

Using FTP endpoint that should recursively find all xml-files, but not look
into a specific directory.

Scenario:
Parent dir: /a/b/c

There we find directories d, e, f, g and h. Each of them having sub
directories with files.

Directory f am I not allowed to take files from. How do I configure filter
includes and excludes? I thought it would go as below:

Preparing the filter:
		AntPathMatcherGenericFileFilter filter = new
AntPathMatcherGenericFileFilter();
		filter.setIncludes("**/*.xml");
		filter.setExcludes("f");

and the endpoint:
ftp://user@host//a/b/c?filter=#filter&password=******&recursive=true

But TRACE tells me that it do look into directory f anyway...

thanks,

/L

--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852531.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help on using Ant path matcher

Posted by lenp <le...@redpill-linpro.com>.
Hi!

Tried both them without success. 

What I think is strange is that org.apache.camel.spring.util.SpringAntPathMatcherFileFilter is only TRACE'in when filtering on the files, never see it filtering on directories. Is it really supported to filter on directory name?

Example - I can see this in log:

2011-09-29 15:35:03,767 TRACE [org.apache.camel.spring.util.SpringAntPathMatcherFileFilter] (Camel (camel-25) thread #48 - ftp://USERNAME@HOSTNAME//data/wrk/viv) Filtering file: cvat/TSTVANFVTM110817145157.xml

but never that it is filtering on the cvat directory which is the directory that I actually want it to skip!


mvh,

/L

-- 
Lennart Petersson
Redpill Linpro AB - Changing the game
Mobil:   +46 70 603 36 33
Kontor: +46 54 15 09 40



29 sep 2011 kl. 13:00 skrev Claus Ibsen-2 [via Camel]:

> Hi 
> 
> Try setting something like "f/**" or "**/f/**" to exclude any f directories. 
> 
> 
> 
> 
> On Thu, Sep 29, 2011 at 12:20 PM, lenp 
> <[hidden email]> wrote:
> 
> > Camel 2.8.1 
> > 
> > Using FTP endpoint that should recursively find all xml-files, but not look 
> > into a specific directory. 
> > 
> > Scenario: 
> > Parent dir: /a/b/c 
> > 
> > There we find directories d, e, f, g and h. Each of them having sub 
> > directories with files. 
> > 
> > Directory f am I not allowed to take files from. How do I configure filter 
> > includes and excludes? I thought it would go as below: 
> > 
> > Preparing the filter: 
> >                AntPathMatcherGenericFileFilter filter = new 
> > AntPathMatcherGenericFileFilter(); 
> >                filter.setIncludes("**/*.xml"); 
> >                filter.setExcludes("f"); 
> > 
> > and the endpoint: 
> > ftp://user@host//a/b/c?filter=#filter&password=******&recursive=true 
> > 
> > But TRACE tells me that it do look into directory f anyway... 
> > 
> > thanks, 
> > 
> > /L 
> > 
> > -- 
> > View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852531.html
> > Sent from the Camel - Users mailing list archive at Nabble.com. 
> >
> 
> 
> 
> -- 
> Claus Ibsen 
> ----------------- 
> FuseSource 
> Email: [hidden email] 
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews 
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852616.html
> To unsubscribe from Need help on using Ant path matcher, click here.



--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4853146.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help on using Ant path matcher

Posted by lenp <le...@redpill-linpro.com>.
:(

According to GenericFileConsumer.java and the method 

    protected boolean isMatched(GenericFile<T> file, boolean isDirectory) {

I can see following code snippet:

        // directories so far is always regarded as matched (matching on the name is only for files)
        if (isDirectory) {
            return true;
        }

Is that really a good idea? Why shouldn't it be possible to filter on dir names? Or am i missing something?

mvh,

/L

-- 
Lennart Petersson
Redpill Linpro AB - Changing the game
Mobil:   +46 70 603 36 33
Kontor: +46 54 15 09 40



29 sep 2011 kl. 15:44 skrev Lennart Petersson:

> Hi!
> 
> Tried both them without success. 
> 
> What I think is strange is that org.apache.camel.spring.util.SpringAntPathMatcherFileFilter is only TRACE'in when filtering on the files, never see it filtering on directories. Is it really supported to filter on directory name?
> 
> Example - I can see this in log:
> 
> 2011-09-29 15:35:03,767 TRACE [org.apache.camel.spring.util.SpringAntPathMatcherFileFilter] (Camel (camel-25) thread #48 - ftp://USERNAME@HOSTNAME//data/wrk/viv) Filtering file: cvat/TSTVANFVTM110817145157.xml
> 
> but never that it is filtering on the cvat directory which is the directory that I actually want it to skip!
> 
> 
> mvh,
> 
> /L
> 
> -- 
> Lennart Petersson
> Redpill Linpro AB - Changing the game
> Mobil:   +46 70 603 36 33
> Kontor: +46 54 15 09 40
> 
> 
> 
> 29 sep 2011 kl. 13:00 skrev Claus Ibsen-2 [via Camel]:
> 
>> Hi 
>> 
>> Try setting something like "f/**" or "**/f/**" to exclude any f directories. 
>> 
>> 
>> 
>> 
>> On Thu, Sep 29, 2011 at 12:20 PM, lenp 
>> <[hidden email]> wrote:
>> 
>> > Camel 2.8.1 
>> > 
>> > Using FTP endpoint that should recursively find all xml-files, but not look 
>> > into a specific directory. 
>> > 
>> > Scenario: 
>> > Parent dir: /a/b/c 
>> > 
>> > There we find directories d, e, f, g and h. Each of them having sub 
>> > directories with files. 
>> > 
>> > Directory f am I not allowed to take files from. How do I configure filter 
>> > includes and excludes? I thought it would go as below: 
>> > 
>> > Preparing the filter: 
>> >                AntPathMatcherGenericFileFilter filter = new 
>> > AntPathMatcherGenericFileFilter(); 
>> >                filter.setIncludes("**/*.xml"); 
>> >                filter.setExcludes("f"); 
>> > 
>> > and the endpoint: 
>> > ftp://user@host//a/b/c?filter=#filter&password=******&recursive=true 
>> > 
>> > But TRACE tells me that it do look into directory f anyway... 
>> > 
>> > thanks, 
>> > 
>> > /L 
>> > 
>> > -- 
>> > View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852531.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com. 
>> >
>> 
>> 
>> 
>> -- 
>> Claus Ibsen 
>> ----------------- 
>> FuseSource 
>> Email: [hidden email] 
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews 
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> 
>> 
>> If you reply to this email, your message will be added to the discussion below:
>> http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852616.html
>> To unsubscribe from Need help on using Ant path matcher, click here.
> 



--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4853207.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help on using Ant path matcher

Posted by lenp <le...@redpill-linpro.com>.
Ah... solved by adding excludes=cvat/*.* that is filtering away all files in
dir dir instead of filtering the actual dir.

Thanks for inputs!

/L

--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4853277.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help on using Ant path matcher

Posted by lenp <le...@redpill-linpro.com>.
:(

According to GenericFileConsumer.java and the method 

    protected boolean isMatched(GenericFile<T> file, boolean isDirectory) {

I can see following code snippet:

        // directories so far is always regarded as matched (matching on the name is only for files)
        if (isDirectory) {
            return true;
        }

Is that really a good idea? Why shouldn't it be possible to filter on dir names? Or am i missing something?

mvh,

/L

-- 
Lennart Petersson
Redpill Linpro AB - Changing the game
Mobil:   +46 70 603 36 33
Kontor: +46 54 15 09 40



29 sep 2011 kl. 15:44 skrev Lennart Petersson:

> Hi!
> 
> Tried both them without success. 
> 
> What I think is strange is that org.apache.camel.spring.util.SpringAntPathMatcherFileFilter is only TRACE'in when filtering on the files, never see it filtering on directories. Is it really supported to filter on directory name?
> 
> Example - I can see this in log:
> 
> 2011-09-29 15:35:03,767 TRACE [org.apache.camel.spring.util.SpringAntPathMatcherFileFilter] (Camel (camel-25) thread #48 - ftp://USERNAME@HOSTNAME//data/wrk/viv) Filtering file: cvat/TSTVANFVTM110817145157.xml
> 
> but never that it is filtering on the cvat directory which is the directory that I actually want it to skip!
> 
> 
> mvh,
> 
> /L
> 
> -- 
> Lennart Petersson
> Redpill Linpro AB - Changing the game
> Mobil:   +46 70 603 36 33
> Kontor: +46 54 15 09 40
> 
> 
> 
> 29 sep 2011 kl. 13:00 skrev Claus Ibsen-2 [via Camel]:
> 
>> Hi 
>> 
>> Try setting something like "f/**" or "**/f/**" to exclude any f directories. 
>> 
>> 
>> 
>> 
>> On Thu, Sep 29, 2011 at 12:20 PM, lenp 
>> <[hidden email]> wrote:
>> 
>> > Camel 2.8.1 
>> > 
>> > Using FTP endpoint that should recursively find all xml-files, but not look 
>> > into a specific directory. 
>> > 
>> > Scenario: 
>> > Parent dir: /a/b/c 
>> > 
>> > There we find directories d, e, f, g and h. Each of them having sub 
>> > directories with files. 
>> > 
>> > Directory f am I not allowed to take files from. How do I configure filter 
>> > includes and excludes? I thought it would go as below: 
>> > 
>> > Preparing the filter: 
>> >                AntPathMatcherGenericFileFilter filter = new 
>> > AntPathMatcherGenericFileFilter(); 
>> >                filter.setIncludes("**/*.xml"); 
>> >                filter.setExcludes("f"); 
>> > 
>> > and the endpoint: 
>> > ftp://user@host//a/b/c?filter=#filter&password=******&recursive=true 
>> > 
>> > But TRACE tells me that it do look into directory f anyway... 
>> > 
>> > thanks, 
>> > 
>> > /L 
>> > 
>> > -- 
>> > View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852531.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com. 
>> >
>> 
>> 
>> 
>> -- 
>> Claus Ibsen 
>> ----------------- 
>> FuseSource 
>> Email: [hidden email] 
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews 
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> 
>> 
>> If you reply to this email, your message will be added to the discussion below:
>> http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852616.html
>> To unsubscribe from Need help on using Ant path matcher, click here.
> 



--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4853208.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help on using Ant path matcher

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Try setting something like "f/**" or "**/f/**" to exclude any f directories.




On Thu, Sep 29, 2011 at 12:20 PM, lenp
<le...@redpill-linpro.com> wrote:
> Camel 2.8.1
>
> Using FTP endpoint that should recursively find all xml-files, but not look
> into a specific directory.
>
> Scenario:
> Parent dir: /a/b/c
>
> There we find directories d, e, f, g and h. Each of them having sub
> directories with files.
>
> Directory f am I not allowed to take files from. How do I configure filter
> includes and excludes? I thought it would go as below:
>
> Preparing the filter:
>                AntPathMatcherGenericFileFilter filter = new
> AntPathMatcherGenericFileFilter();
>                filter.setIncludes("**/*.xml");
>                filter.setExcludes("f");
>
> and the endpoint:
> ftp://user@host//a/b/c?filter=#filter&password=******&recursive=true
>
> But TRACE tells me that it do look into directory f anyway...
>
> thanks,
>
> /L
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Need-help-on-using-Ant-path-matcher-tp4852531p4852531.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/