Miroslav Nachev wrote:
Hi,

I need to start a daemon (class extended thread) which have to be started with James and stopped when James is stopped. The task of this Daemon will be to check for received Faxes and send them as E-Mail to the related e-mail recipient. One of my idea is to start this daemon class (SendFaxAsEMail) at initialization of SendMailAsFax mailet. This daemon class will use Database to retrieve necessary data.

*Can you suggest me where is the right place to put this daemon class SendFaxAsEMail?*

I would create a new Avalon Block.

Alter assembly.xml to add:
  <block name="yourblock" class="YourClass" >
    <provide name="James" role="org.apache.james.services.MailServer"/>
<provide name="database-connections" role="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" />
  </block>

The you have to create YourClass component that will implement (avalon interface) Serviceable so to be able to lookup the DataSourceSelector (used to access the db) and the MailServer (used to inject new mails).

And to create YourClass.xinfo:

<?xml version="1.0"?>
<blockinfo>
  <!-- section to describe block -->
  <block>
    <version>1.0</version>
  </block>
  <dependencies>
    <dependency>
      <service name="org.apache.james.services.MailServer" version="1.0"/>
    </dependency>
    <dependency>
<service name="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" version="1.0"/>
    </dependency>
  </dependencies>
</blockinfo>

YourClass.xinfo must be placed in the same place of YourClass.class

You put everything into jamesfolder/apps/james/SAR-INF/classes and you restart james.

If YourClass implements Configurable and you add a <yourblock> configuration to config.xml Phoenix automatically will call the configure of your class.

You may also want to implement this interfaces to complete your creation/destroy lifecycles: Initializable, Disposable

Stefano

Just for information the application use HylaFAX, IAXmodem, SpanDSP and Asterisk. All are open source projects. The GUI is Java Swing running with JNLP (Java Web Start). I am not decided which program to use for connection between server side and Swing client. I doubt between ICE <http://www.zeroc.com/ice.html>, Embedded ICE <http://www.zeroc.com/icee/index.html>, Apache Tomcat <http://tomcat.apache.org/> or another lightweight, small and fast program. *Any suggestions or ideas?*


Regards,
Miro.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to