JFetch Home‎ > ‎

Configuring and Extending JFetch

JFetch uses XML for configuration. The configuration file is jfetch.xml . This file exists in $JFETCH_HOME/conf - if $JFETCH_HOME is where your JFetch binary distribution is.

The configuration file is accompanied by a detailed document instructing one on how to configure JFetch. I would recommend referring to that document whenever you have some problem following what i'm saying. This document is called Configuration.txt and is located in the $JFETCH_HOME/docs directory.

Essentially, there are maildrops to download mail from - they contain all the information about accessing a maildrop. There is a global sequence of filters which are checked for each maildrop before the maildrop-local sequence of filters. Filters can be configured through the configuration file. For example a size based filter would like to know what size it should filter at and also what action it should take when a message is of a greater size. Each of the filters themselves may have some additional configuration options. The additional configuration is totally dependent on the filter itself. You could add your own filter and want to be configured from the configuration file. I shall expand on that later in this section.

There is also the option of delivery agents. After a message passes through all the filters and none of them have an objection with it being downloaded, it is downloaded and sent to DeliveryAgent who is responsible to delivering it (to a mailbox, maildir, smtp host etc). Jfetch supports different kinds of delivery agents and you can choose one of them for delivery of your mail. You can go so far as to make each of your maildrops deliver messages to a different delivery agent! A Maildrop itself needs to specify its delivery agent when all the filters let the message pass through. Each delivery agent has an id - it can thereafter be referred to by its id. Some filters support delivering messages to a delivery agent specified in their configuration. For example, all messages from the execve@users.sourceforge.net would go to the execve mailbox if the SenderMailFilter is configured.

You can implement your own filters by implementing the jfetch.filters.MailFilter interface. You will need to specify the name of the class you have implemented in the configuration, so that JFetch can initialise it as required. Note that the class has to be in the system classpath. This can be easily achieved by putting the class in a jar and putting it in the lib directory. The script picks up all the jars from the directory and places them in the classpath before invoking JFetch. All the delivery agents specified in the configuration are available to the filters through a jfetch.delivery.DeliveryManager object. This object allows access to these agents based on their ids. NOTE that the id of the agent has to known by the filter requesting for the agent. A DeliveryEvent is generated when a message is delivered after passing through all the filters. NOTE that there is no event generated when a filter itself delivers a message through an agent. The easiest way to get a hang of how to implement the filter of your choice is to get a hold of the source and checkout some of the implemented filters (like NullMailFilter!!)

Thats about it in terms of JFetch configuration. Go on, open the conf/jfetch.xml file in the JFetch directory and play with it. Do let me know of any problems you face; let me know even if you dont ;).