james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Re: Questions on the Mail and MailRepository interfaces
Date Tue, 15 May 2007 00:04:05 GMT
Jukka Zitting ha scritto:
> Hi,
> I'm working on the JCR mail repository for James, and I'd like to
> better understand the Mail and MailRepository interfaces.
> a) Should implementations of the MailRepository class be thread-safe?


> b) Should the Avalon lifecycle interfaces be used when implementing
> MailRepository?

If you need a lifecycle yes.
If you don't have resources/dependencies/configuration/initialization
you can skip this.
My suggestion is to place the core non-avalon code in the main class and
then write an avalonized wrapper to that class (or an extended version
implementing avalon interfaces).

> c) What parts of a mail message need to be stored when
> MailRepository.store(Mail) is called? For example should the mail name
> (Mail.getName()) or attributes (Mail.hasAttributes(), etc.) be stored?

the name is the key used to retrieve it later.
attributes must be persisted. Every property you see in the Mail object
is persisted (name, sender, recipients, remoteaddr, remotehost,
errormessage, message, state, lastupdated).

> d) Should mailRepository.store(mailRepository.retrieve(...)) update
> the existing message or create a new one?

Update the existing message.
Store using an existing key is an update. Store using a new key is an

> e) Should mailRepository.retrieve(...).setMessage(...) update the mail
> repository?

no. You have to call store if you want to update the repository.

> f) Should mailRepository.retrieve(...).getMessage().setFrom(...)
> update the mail repository?

same as "e)"

> g) Should mail.setRecipients(...) affect
> mail.getMessage().getAllRecipients()?

No. mail recipients are the envelope recipients and are not related to
the mimemessage header recipients. A repository implementation should
completely ignore the "message" content and behaviour.

> h) Should mail.getMessage().addRecipients(...) affect mail.getRecipients()?

same as "g)".

> I'll probably come up with more questions, but I guess these are a
> good starting point. :-)

You're welcome :-)

> BR,
> Jukka Zitting

Maybe some of this things should be changed, I simply replied with what
the current code does and expects.


To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org

View raw message