Hello all,
Since I've never posted to the list, a brief introduction... I'm brand new to community-style development, but I've been a hobbyist, OS-supporter, and semi-professional Java developer for several years. "Semi-professional" meaning I write Java applications and servers at work, but my main focus is in tech support (escalations). I'm currently rewriting a custom mail-processing application over to James using mailets. However, I need a few additional features, most of which I'm comfortable doing. I would love feedback on these:
1) Cron-scheduling in Steve Brewin's new fetchmail stuff. This way I can schedule fetchmail tasks to only run during business hours, MON-FRI.
My patch adds an optional <cronSchedule> to the <fetchmail> config, and schedules the fetchmail scheduler accordingly:
<!-- A cron-style way to specify when this fetchmail task should run -->
<!-- Value of -1 indicates EVERY, e.g., hour="-1" means "EVERY hour" -->
<!-- Use multiple <cronSchedule>s OR one <interval> for scheduling -->
<!-- See org.apache.avalon.cornerstone.services.scheduler.CronTimeTrigger -->
<cronSchedule minute="-1" hour="-1" month="-1" year="-1"
day="-1" isDayOfYear="false"/>
2) FetchMail search terms. With this feature, an optional <fetchfilter> may be specified in each fetch task that tells fetchmail to include and exclude certain emails. With this feature, fetchmail only fetches email that matches the search terms, and simply leaves other messages alone on the server. <fetchfilter> would effectively obsolete the <fetchall> option. It is documented/configured like this:
<!-- Filter the emails which are retrieved. -->
<!-- Messages that do not meet the filter conditions -->
<!-- are left unmodified on the server and are not -->
<!-- passed on to the JAMES queue -->
<!-- Search terms may be grouped with the logical -->
<!-- operators <and> and <or> -->
<!-- Terms can be negated using <not> -->
<!-- Terms used here are adapted from and implemented by -->
<!-- the javax.mail.search.SearchTerm subclasses -->
<!-- Available terms: -->
<!-- <body pattern="regex to find in body"/> -->
<!-- <subject pattern="regex to find in subject"/> -->
<!-- <flags set="true/false" answered="true" deleted="true" draft="true"
flagged="true" recent="true" seen="true"
user="true"/> -->
<!-- <fromstring pattern="regex From header"> -->
<!-- <from address="email address"> -->
<!-- <header name="header name" pattern="regex in header value"> -->
<!-- <messageid id="RFC822 message id"> -->
<!-- <messagenumber number="message number"> -->
<!-- <receiveddate comparison="GT/GE/LT/LE/EQ/NE" date="Simple date"> -->
<!-- <recipientstring pattern="regex To header"> -->
<!-- <recipient type="TO/CC/BCC" address="email address"> -->
<!-- <sentdate comparison="GT/GE/LT/LE/EQ/NE" date="Simple date"> -->
<!-- <size comparison="GT/GE/LT/LE/EQ/NE" bytes="integer"> -->
<!-- The example filter below will not fetch mails with 'Autoreply' -->
<!-- in the subject nor mail with Autoreply in the body -->
<!-- Finally, there must be only ONE term that is a child -->
<!-- of fetchfilter. Use <and> and <or> for more than one -->
<!-- condition. -->
<fetchfilter>
<and>
<not><subject pattern="Autoreply"/></not>
<not><body pattern="Autoreply"/></not>
</and>
</fetchfilter>
This sort of SearchTerm stuff is extremely flexible, and this could be easily adapted to a Matcher if the mailet spec changes to allow Matcher configuration of more than just a String -- which I hope is still being considered.
3) "Restart on config change" feature. When running in production, my app runs in a secured DMZ as an NT service where I don't have access to stop/restart it -- but I do have access to the files. My current (non-James) app monitors the config file, and when it notices a change, it shuts down and restarts. I added this to JAMES, but it's ugly (calls System.exit(199), which causes my modified run.bat to simply relaunch the container. I know, I know...)
There's an additional complexity because of the NT service wrapper: if the JVM is running in the wrapper, a simple call to WrapperManager.restart(); takes care of this.
I know there's got to be a better way to do this, independent of the way JAMES started up, so I'd like to hear people's ideas. I'm thinking JMX might be able to achieve this, but I don't know much about it. Plus, it would be kinda cool to be able to restart JAMES just by sending a command through email. A 'RestartServer' mailet could handle that (after checking credentials of course)...
Lastly, I'm a bit naive when it comes to CVS and creating diffs for patches. What I'm doing now is:
1) Make changes
2) Re-update to the label I'm writing the patch for (either HEAD or branch_2_1_fcs)
3) Go around to each directory where I've modified a file and run:
cvs diff -u -w -b -rbranch_2_1_fcs>>c:\patch-xyz.diff
If anyone can let me know if that's the best way to assemble a patch, I'll have the above patches out soon.
Oh, and my future messages to the list won't be so darn long ;)
Kevin Hunt
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
