You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Norman Maurer (JIRA)" <se...@james.apache.org> on 2006/09/04 00:16:23 UTC

[jira] Commented: (JAMES-607) Rewrite MBoxMailRepository to use mstor

    [ http://issues.apache.org/jira/browse/JAMES-607?page=comments#action_12432382 ] 
            
Norman Maurer commented on JAMES-607:
-------------------------------------

Stefano point out that we don't need this class anymore after i did the work ;-P 

We can simply use the javamailstore which joachim develop and use mstor as javamailstore provider.

Here is what you have todo to get it work:

1. Get the javamailstore-mailrepository-5.jar from http://issues.apache.org/jira/browse/JAMES-461 and place it to /path/to/james/apps/james/SAR-INF/lib/ 

2. Change the mbox config to:
      <inboxRepository>
         <repository destinationURL="mstor://var/mail/" postfix="/" type="MAIL"/>
      </inboxRepository>

         <repository class="org.apache.james.mailrepository.javamail.HashJavamailStoreMailRepository">
            <protocols>
               <protocol>mstor</protocol>
            </protocols>
            <types>
               <type>MAIL</type>
            </types>
         </repository>


Thats all. I whould be +1 to include joachims work finally to james trunk





> Rewrite MBoxMailRepository to use mstor
> ---------------------------------------
>
>                 Key: JAMES-607
>                 URL: http://issues.apache.org/jira/browse/JAMES-607
>             Project: James
>          Issue Type: Improvement
>          Components: MailStore & MailRepository
>            Reporter: Norman Maurer
>         Assigned To: Norman Maurer
>             Fix For: 3.0
>
>         Attachments: mbox.diff
>
>
> MBoxMailRepository should be rewritten to use mstor. Mstor provide a clean way to access mbox files etc

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Re: [jira] Commented: (JAMES-607) Rewrite MBoxMailRepository to use mstor

Posted by Stefano Bagnara <ap...@bago.org>.
Norman Maurer (JIRA) wrote:
>     [ http://issues.apache.org/jira/browse/JAMES-607?page=comments#action_12432382 ] 
>             
> Norman Maurer commented on JAMES-607:
> -------------------------------------
> 
> Stefano point out that we don't need this class anymore after i did the work ;-P 

I'm sorry. I thought you were already working on the Joachim stuff and I 
found out that you did it differently only when you attached your diff 
to this issue! Btw all's well that ends well.

Great news here:

> We can simply use the javamailstore which joachim develop and use mstor as javamailstore provider.
> 
> Here is what you have todo to get it work:
> 
> 1. Get the javamailstore-mailrepository-5.jar from http://issues.apache.org/jira/browse/JAMES-461 and place it to /path/to/james/apps/james/SAR-INF/lib/ 
> 
> 2. Change the mbox config to:
>       <inboxRepository>
>          <repository destinationURL="mstor://var/mail/" postfix="/" type="MAIL"/>
>       </inboxRepository>
> 
>          <repository class="org.apache.james.mailrepository.javamail.HashJavamailStoreMailRepository">
>             <protocols>
>                <protocol>mstor</protocol>
>             </protocols>
>             <types>
>                <type>MAIL</type>
>             </types>
>          </repository>
> 
> 
> Thats all. I whould be +1 to include joachims work finally to james trunk

The HashJavamailStoreMailRepository is not so performant but we may try 
to find out how to make the mstor folder to implement the UidPlusFolder 
interface later. (maybe this is not easy, maybe we should talk with Ben 
Fortuna about this).

+1 !!!
Stefano


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


Re: [jira] Commented: (JAMES-607) Rewrite MBoxMailRepository to use mstor

Posted by Norman Maurer <nm...@byteaction.de>.
Am Montag, den 04.09.2006, 01:10 +0200 schrieb Stefano Bagnara:
> Norman Maurer (JIRA) wrote:
> >     [ http://issues.apache.org/jira/browse/JAMES-607?page=comments#action_12432382 ] 
> >             
> > Norman Maurer commented on JAMES-607:
> > -------------------------------------
> > 
> > Stefano point out that we don't need this class anymore after i did the work ;-P 
> 
> I'm sorry. I thought you were already working on the Joachim stuff and I 
> found out that you did it differently only when you attached your diff 
> to this issue! Btw all's well that ends well.

No problems.. Everytime i code something on james i know it better next
time ;-)

> 
> Great news here:
> 
> > We can simply use the javamailstore which joachim develop and use mstor as javamailstore provider.
> > 
> > Here is what you have todo to get it work:
> > 
> > 1. Get the javamailstore-mailrepository-5.jar from http://issues.apache.org/jira/browse/JAMES-461 and place it to /path/to/james/apps/james/SAR-INF/lib/ 
> > 
> > 2. Change the mbox config to:
> >       <inboxRepository>
> >          <repository destinationURL="mstor://var/mail/" postfix="/" type="MAIL"/>
> >       </inboxRepository>
> > 
> >          <repository class="org.apache.james.mailrepository.javamail.HashJavamailStoreMailRepository">
> >             <protocols>
> >                <protocol>mstor</protocol>
> >             </protocols>
> >             <types>
> >                <type>MAIL</type>
> >             </types>
> >          </repository>
> > 
> > 
> > Thats all. I whould be +1 to include joachims work finally to james trunk
> 
> The HashJavamailStoreMailRepository is not so performant but we may try 
> to find out how to make the mstor folder to implement the UidPlusFolder 
> interface later. (maybe this is not easy, maybe we should talk with Ben 
> Fortuna about this).
> 
> +1 !!!
> Stefano

I will ask Ben to join us.

bye
Norman

Re: [jira] Commented: (JAMES-607) Rewrite MBoxMailRepository to use mstor

Posted by Norman Maurer <nm...@byteaction.de>.
Am Montag, den 04.09.2006, 19:24 +0200 schrieb Norman Maurer:
<snip>
> > The HashJavamailStoreMailRepository is not so performant but we may try 
> > to find out how to make the mstor folder to implement the UidPlusFolder 
> > interface later. (maybe this is not easy, maybe we should talk with Ben 
> > Fortuna about this).
> > 
> > +1 !!!
> > Stefano
> 
> I will ask Ben to join us.

I posted this message to the mstor mailinglist. Let us see what Ben
answer:

Unique id per message when stored 
2006-09-04 20:38  Hi Ben, 

we develop a java mail server named james ( james.apache.org ). We
thought about to use mstor to provide a backend for mbox. We need to
have a persist unique uid (key) per message we add to retrieve the mail
later by using the "unique" id. Any idea how to adapted this ? 

Here his the interface we using for such needs: 

package org.apache.james.mailrepository.javamail; 

import javax.mail.Message; 
import javax.mail.MessagingException; 
import javax.mail.UIDFolder; 

/** 
* Interim interface to provide access to UID PLUS methods reflecting RFC
2359, 
* until official Javamail API offers this. 
*/ 

public interface UIDPlusFolder extends UIDFolder, FolderInterface { 
/** 
* Appends the given messages to the folder and returns corresponding
uids.<br> 
* Implementations may require the folder to be open. 
* 
* @see javax.mail.Folder#appendMessages(javax.mail.Message[]) 
* 
* @param msgs 
* messages to append 
* @return array of same size and sequenze of msgs containing
corresponding 
* uids or -1, if something went wrong 
* @throws MessagingException 
* @throws IllegalStateException when folder has to be open 
*/ 
public long[] addUIDMessages(Message[] msgs) throws MessagingException; 

/** 
* Appends the given messages to the folder and returns corresponding 
* instances of the appended messages.<br> 
* Implementations may require the folder to be open. 
* 
* @see javax.mail.Folder#appendMessages(javax.mail.Message[]) 
* 
* @param msgs 
* messages to append 
* @return array of same size and sequenze of msgs containing
corresponding 
* added messages or null, if something went wrong 
* @throws MessagingException 
* @throws IllegalStateException when folder has to be open 
*/ 
public Message[] addMessages(Message[] msgs) throws MessagingException; 

}

bye
Norman

Folder interface and UID ! [was: Re: [jira] Commented: (JAMES-607) Rewrite MBoxMailRepository to use mstor]

Posted by Norman Maurer <nm...@byteaction.de>.
Here is what Ben was answer:

Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=3899074
By: fortuna

Hi Norman,

I would assume the best place to store the message UID would be as a
custom
header in the message. eg:

X-Apache-James-UID: JVBERi0xLjQKMyAwIG9iaiA8PA

Then to retrieve a messages you could use a search term like this:

HeaderTerm uidSearch = new HeaderTerm("X-Apache-James-UID",
"JVBERi0xLjQKMyAwIG9iaiA8PA");

// messages should contain only one (1) message..
Message[] messages = folder.search(uidSearch);

Your implementation of UIDPlusFolder could encapsulate this
functionality along
with a way to generate the unique UIDs. The benefit of using the
standard JavaMail
APIs like this is that you wouldn't be tied to any particular mail store
provider,
so you could choose to use mbox, MailDir, etc. without needing code
changes.

Let me know if this is not what you meant.

regards,
ben

ps. I've used strings for the UID, but longs would also work here.


After talk to Stefano the idea raise to adapt this idea but use FLAGS to
do the UID storing. I did a fast check of the javamail apidocs and ti
seems to be possible. 

Any comments, feedback or somthing else ?

bye
Norman

Am Montag, den 04.09.2006, 20:44 +0200 schrieb Norman Maurer:
> Am Montag, den 04.09.2006, 19:24 +0200 schrieb Norman Maurer:
> <snip>
> > > The HashJavamailStoreMailRepository is not so performant but we may try 
> > > to find out how to make the mstor folder to implement the UidPlusFolder 
> > > interface later. (maybe this is not easy, maybe we should talk with Ben 
> > > Fortuna about this).
> > > 
> > > +1 !!!
> > > Stefano
> > 
> > I will ask Ben to join us.
> 
> I posted this message to the mstor mailinglist. Let us see what Ben
> answer:
> 
> Unique id per message when stored 
> 2006-09-04 20:38  Hi Ben, 
> 
> we develop a java mail server named james ( james.apache.org ). We
> thought about to use mstor to provide a backend for mbox. We need to
> have a persist unique uid (key) per message we add to retrieve the mail
> later by using the "unique" id. Any idea how to adapted this ? 
> 
> Here his the interface we using for such needs: 
> 
> package org.apache.james.mailrepository.javamail; 
> 
> import javax.mail.Message; 
> import javax.mail.MessagingException; 
> import javax.mail.UIDFolder; 
> 
> /** 
> * Interim interface to provide access to UID PLUS methods reflecting RFC
> 2359, 
> * until official Javamail API offers this. 
> */ 
> 
> public interface UIDPlusFolder extends UIDFolder, FolderInterface { 
> /** 
> * Appends the given messages to the folder and returns corresponding
> uids.<br> 
> * Implementations may require the folder to be open. 
> * 
> * @see javax.mail.Folder#appendMessages(javax.mail.Message[]) 
> * 
> * @param msgs 
> * messages to append 
> * @return array of same size and sequenze of msgs containing
> corresponding 
> * uids or -1, if something went wrong 
> * @throws MessagingException 
> * @throws IllegalStateException when folder has to be open 
> */ 
> public long[] addUIDMessages(Message[] msgs) throws MessagingException; 
> 
> /** 
> * Appends the given messages to the folder and returns corresponding 
> * instances of the appended messages.<br> 
> * Implementations may require the folder to be open. 
> * 
> * @see javax.mail.Folder#appendMessages(javax.mail.Message[]) 
> * 
> * @param msgs 
> * messages to append 
> * @return array of same size and sequenze of msgs containing
> corresponding 
> * added messages or null, if something went wrong 
> * @throws MessagingException 
> * @throws IllegalStateException when folder has to be open 
> */ 
> public Message[] addMessages(Message[] msgs) throws MessagingException; 
> 
> }
> 
> bye
> Norman