You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by ja...@nemonik.com on 2002/02/06 22:55:29 UTC

How do I Access the BlockContext and Context from a Mailet


I need to access the James server's org.apache.avalon.phoenix.BlockContext and org.apache.avalon.framework.context.Context from a Mailet to access sub-directories off the base directory of the sar.  These sub-directories would be described in the james-config.xml to initialize the mailet, but I've been unable to determine how to do this.

I'd like to configure the mailet to open files from two paths as described by "applePath" and "orangePath" like so:

<mailet match="RecipientIs=account@localhost"
class="myMailet">
  <applePath>file:///apple</applePath>
  <orangePath>file:///orange</orangePath>
  <loggingFilename>file:///logs/myMailetLog.txt</loggingFilename>
</mailet>      

And then in the mailet's init method correct for the base directory of the sar like so: 

String applePath = getInitParameter( "applePath" );
applePath= applePath.substring("file://".length());
applePath = ((BlockContext)context).getBaseDirectory() + File.separator + applePath;

Please, any pointers?

-Michael



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>