2008-12-29

ANT path matcher

The Camel community is pushing in new requests. Lately Ramon Buckland from down under requested the need for ANT path styles. I couldn't agree more that this is truly a nice solution to express paths.

As Camel already leverage Spring in several of our components and other parts of Camel I wanted to create a solution using Spring only, to avoid bringing in a new dependency on ANT. As Spring already have nice AntPathMatcher support for it's resources I could quite easily add it to Camel as well.

So In Camel 2.0 you can use AntPathMatcherFileFilter as a java.io.FileFilter as the filter for which files to include when consuming files using the Camel File component.

As this is a Spring'ish solution it requires camel-spring.jar. You configure it using plain Spring bean, as a Spring Bean using properties for setting includes and exclude ANT paths.

I have provided a sample in the Camel File documentation - in the section "Filtering using ANT path matcher".

Yeah even during the holidays the Camel community and roadmap is moving - it's never standing still.

2008-12-12

Camel Community is Rocking

The Apache Camel community is a vibrant community with many contributors.

As Gert Venthiensen blogged two new tutorials has been created. Charles Mouillard have created a great tutorial on how to use Apache Camel in various OSGi containers such as Apache ServiceMix and Spring DM. And this is just part 1, he will continue the tutorial.

Ramon Buckland contributed a totally new component to Camel for tidying up ugly HTML using TagSoup. Yeah we had a challenge with the name as TagSoup isn't so catch, so it's named tidyMark in the DSL.

The Camel riders thanks these great contributions. We love contributions and welcome your contributions in any form, on the forums, IRC char, blogs, JIRA issue tracker, improving the documentation and of course also code contributions.

And there are more contributions in the brew. Check out the camel user and dev forums for the discussions.

2008-12-06

About Open Source Community

The Apache Camel community is very much alive and kicking. As my Camel rider journey started about 1 year ago I have seen a community with tremendous prospects. This is great news for Apache Camel that this community and it's contributors is around. In fact we are in talks to promote Apache Camel as a Apache Top Level Project (TLP).

I was wondering if anyone knows of some good stats aggregator for Open Source Communities? ohloh has potential but it only, to my knowledge, scans the source code commits. What I am looking for is metrics for activity in forums, irc channels, blogs on Camel, JIRA tickets analysis, talks about Camel on conventions, Authors write books about Camel, number of downloads, Companies offering training, support, etc. etc.

Anyone know of such metrics exists?

2008-12-01

Camel and file sorting

The file component to be used for file connectivity in Camel is a key component in the kind of integration works I am hustling with a clients. We are still doing a lot of file and messaging based on IBM platforms from large mainframes and other older platforms. So I am not riding on the Camel with the yellow jersey in the "peloton" (hint: Tour de France).

So my Camel is up for a maintenance upgrade now that we are working on Camel 2.0. A part of this upgrade is being able to support ease of use for pluggable file filtering and sorting.

The sorting comes in two flavors:
- comparator
- textual expressions

Sorting by comparator
We leverage the java.util.Comparator to allow end users to configure their own implementation to use, or use what we have on the shelves out-of-the-box for the regular sorting by name, modified date, size etc provided in org.apache.camel.component.file.DefaultFileSorter.

We can configure the comparator in the file endpoint using the sorterRef option:
from("file://inbox/?sorterRef=myFileSorter").to("bean:processInbox");

... where myFileSorter is lookup up in the registry, typically Spring application context defined as a spring bean:

<bean id="myFileSorter" class="com.mycompany.MyFileSorter"/>


Sorting by expressions
This is where we did go the extra mile and implemented textual configuration of sorting. You just add a sortBy option to the file endpoint URI configuration where you express what and how to sort.

A plain example would be:
from("file://inbox/?sortBy=file:name").to("bean:processInbox");

We can specify reverse if we wanted to sort in reverse order
from("file://inbox/?sortBy=reverse:file:name").to("bean:processInbox");

And the ignore case is also supported so you can process files regardless of the case
from("file://inbox/?sortBy=ignoreCase:file:name").to("bean:processInbox");

And on top of that we have grouped sorting so you can append a 2nd sort by, where the groups are separated with semi colon. So if we want to sort first by file extension and then by name we do:
from("file://inbox/?sortBy=file:name.ext;file:name").to("bean:processInbox");

As the expression is the file language you got its full power as well so if you want to sort by modified timestamp but it should only consider the date part, we can use the yyyyMMdd pattern and express this as:
from("file://inbox/?sortBy=date:file:yyyyMMdd").to("bean:processInbox");

Currently this is only implemented on the file component, but next up is to implement this for the FTP component as well.

Check out the file component and the file language to get an idea how this new sortBy option can be used.