[ 
https://issues.apache.org/jira/browse/IMAP-148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim-Christian Mundt updated IMAP-148:
-------------------------------------

    Attachment: refactorStore1-server.svn.patch
                refactorStore1-imap.patch

On my way implementing Maildir I first tried to fully understand the Store* 
structure. During that process I got some ideas which I'm gonna explain here. 
Although the changes are in the IMAP library, the server component needs a 
little patch for the configuration and one test. Because I renamed and then 
changed some files, I couldn't create a working svn diff for the IMAP 
component, because it would create a diff between the original file and the 
changed one, although it needs to contain the whole content (as the file is 
basically new). If you know a way to do this properly, let me know and I'll 
upload it. The patch for the IMAP component is a diff between the exports of 
the current revision (948453) and my working copy generated with (diff -r -u 
-N). If you apply it you need to use the -N flag to remove emptied files. 
That's enough paperwork, now the real thing:

1) The main change is the introduction of a mapperFactory - injected via spring 
- for all three mappers (mailbox, message, subscription). The mappers are 
basically collections of (pseudo) static functions, there's no need to create 
them over and over again, so they are stored in sessions for reuse. This makes 
things like per-request-entity-managers much easier to implement (the 
respective MailboxSessionEntityManagerFactory is not needed any more).

2) A change that takes a lot of space in the patch but is not really an effort, 
is to put all streaming-related stuff in store.mail into a dedicated package. 
It was just too crowded.

3) I renamed ...mail.*Mailbox to ...mail.*MessageManager to match the model 
(*Mailbox and *Message), be consistent with the *MailboxManager and 
*SubscriptionManager and remove the irritating duplication of the name 
*Mailbox. (This renaming is the part which makes the patch complicated.)

4) The Store* stuff is still a little too much database focused. As a _little_ 
starting point I renamed StoreMessageManager.getMailboxRow() to 
StoreMessageManager.getMailboxEntity() - there is really more important stuff 
concerning this issue, that will come later...

5) Moved the model classes for the inmemory store to a .model package according 
to the other implementations.

6) A space here, a blank line there, whatever I stumbled upon, nothing worth 
mentioning.

I'd be glad to hear your opinion regarding my suggestions. I'm sure this patch 
cannot be used as is (if only because rename/move is best done as svn 
operations rather than a patch). As said, there are a few more changes I'd like 
to make, but this is already big enough (most of the size is due to moving 
files).

> Refactor Store
> --------------
>
>                 Key: IMAP-148
>                 URL: https://issues.apache.org/jira/browse/IMAP-148
>             Project: JAMES Imap
>          Issue Type: Task
>          Components: Mailbox
>            Reporter: Tim-Christian Mundt
>         Attachments: refactorStore1-imap.patch, 
> refactorStore1-server.svn.patch
>
>
> While the Store stuff is really great to quickly implement new storage 
> back-ends for James, I think it needs some changes in the structure, some 
> names etc in order to make it easier to understand. Moreover, even 
> performance may be improved by not instantiating the same object over and 
> over again. I'll post a suggestion soon...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to