On 11/2/07, Robert Burrell Donkin < [EMAIL PROTECTED]> wrote: > > On Nov 2, 2007 12:54 AM, Stefano Bagnara <[EMAIL PROTECTED]> wrote: > > Robert Burrell Donkin ha scritto: > > > the problem is that session is used in two different senses: database > > > session and a session of a (session-oriented) protocol > > > > > > if you're using a transactional datastore then yes, you'll need a > > > datastore session to execute transactions but there is no necessity > > > for this to equal the MailboxAPI session > > > > Maybe there are *3* different sessions: the protocol session (for POP3, > > IMAP, SMTP), the mailboxapi session, the datastore session. > > Or you are saying that the MailboxAPI session will be the same as (or 1 > > to 1 to) the protocols session? > > it's not clearly defined how the MailboxAPI session relates to the > protocol and database sessions > > i've done a class diagram for the interfaces in MailboxAPI see > http://wiki.apache.org/james/BackendMailboxAPI > > IMO this is excessively complex
Yes, I feel the same pain :) And you skipped the drawing of lots of wrapper classes :) in particular: > > * what is the difference between the various Mailbox interfaces and > the various MailboxSession interfaces? > * why are so many interfaces necessary? > > - robert I understand the reasoning behind the multiple interfaces - it tries to group various separate feature which the IMAP frontend needs from the backend (SearchableMailbox,FlaggedMailbox, etc) It is, i think a good thing, the problem lies in the mixing the Mailbox and the MailboxSession and the wrapping of the objects. I'm not sure how to simplify the code, but I think, if i were the original author I would done in the following way: The backend constitutes the following class/interfaces : - MailboxName - it groups namespace,username,folder name - MailboxListener - similar to the current MailboxListener interface - Mailbox - with add/remove/expunge/search/flag functionality (probably with some IMAP specific methods for getting unseen/recent count), The object should be stateless. For every MailboxName, it should be one Mailbox object in the VM. - MailboxManager - the entry point for the backend, with the following methods: Mailbox getMailbox(MailboxName); void registerListener(MailboxName, MailboxListener) void unregisterListener(MailboxName, MailboxListener) The IMAP module should contain the MSN number, UID mappings, and the other 'mailbox session' related codes, but probably names as Imap(Client)Session, which is a MailboxListener also to get notification from other clients, and from itself. So the implementation of the IDLE command would be easier. It just set the 'session' object to 'forwardEveryMailboxChangeToClient' mode, until it receives the 'DONE' command. And in that mode, every MailboxListener method call results in an apropriate IDLE response line. What do you think? Zsombor
