You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Jentu Jain <je...@datacert.com> on 2012/01/25 13:53:57 UTC
Create IMAP wrapper
Hello,
My requirement is to create a server-side IMAP component that would fetch information from another web application and expose it as IMAP folders.
How can this be done?
Regards
------------------------------------
Jentu Jain | Datacert, Inc.
Why are major companies rapidly migrating to Passport? Find Out Here<http://www.datacert.com/>
[Description: cid:image001.gif@01CBF2C7.283B26D0]<http://www.datacert.com/feed.xml>[Description: cid:image002.gif@01CBF2C7.283B26D0]<http://twitter.com/datacert>
Re: Create IMAP wrapper
Posted by Eric Charles <er...@apache.org>.
Hi,
You can find the JPA mailbox sources here
https://svn.apache.org/repos/asf/james/mailbox/trunk/jpa/
If you are looking for a file based storage, the maildir mailbox is a
better start
https://svn.apache.org/repos/asf/james/mailbox/trunk/maildir/
You will find information on how to build from server source here
http://james.apache.org/server/3/dev-build.html
You can apply the principle (svn co, maven import,...) to the mailbox
sources.
Thx,
Eric
On 27/01/12 14:20, Jentu Jain wrote:
> Thanks Eric and Norman for your response.
> I understand that the default store for mailbox is JPA but I was unable to download the JPA binary and source. Can you please guide me on changing this to a file system to test the created mailbox.
>
> I'm using the following code to create mailbox but nothing is listed when I call mapper.list(). Please advice.
>
> @Override
> public void createMailbox(MailboxPath mailboxPath, final MailboxSession mailboxSession)
> throws MailboxException {
>
> final int length = mailboxPath.getName().length();
> if (length == 0) {
> System.out.println("Ignoring mailbox with empty name");
>
> } else {
> if (mailboxPath.getName().charAt(length - 1) == getDelimiter())
> mailboxPath.setName(mailboxPath.getName().substring(0, length - 1));
>
> for (final MailboxPath mailbox : mailboxPath.getHierarchyLevels(getDelimiter()))
>
>
>
>
> if (!mailboxExists(mailbox, mailboxSession)) {
> final org.apache.james.mailbox.store.mail.model.Mailbox<UUID> m = doCreateMailbox(mailbox, mailboxSession);
> final org.apache.james.mailbox.store.mail.MailboxMapper<UUID> mapper = getMapperFactory().getMailboxMapper(mailboxSession);
> mapper.execute(new TransactionalMapper.VoidTransaction() {
>
> public void runVoid() throws MailboxException {
> mapper.save(m);
> }
>
> });
>
> // notify listeners
> getEventDispatcher().mailboxAdded(mailboxSession, m);
> }
> //return null;
>
> }
> }
>
> Regards
> ------------------------------------
> Jentu Jain | Datacert, Inc.
>
> Why are major companies rapidly migrating to Passport? Find Out Here
>
>
> -----Original Message-----
> From: Eric Charles [mailto:eric@apache.org]
> Sent: Friday, January 27, 2012 12:36 AM
> To: James Users List
> Subject: Re: Create IMAP wrapper
>
> http://james.apache.org/mailbox/mailbox-store.html
>
> is the place we should enhance to further help guys like you.
>
> But yes, for now, the best place to learn is to checkout the source code, and look at it in your favorite IDE.
>
> Mailbox JPA has more implementations has more classes than mailbox maildir which relies more on the simple model provided in mailbox store.
>
> Thx,
>
> Eric
>
> On 26/01/12 17:00, Norman Maurer wrote:
>> Just implement your own MailboxManager. This can then be used in the
>> IMAP code.
>>
>> Bye,
>> Norman
>>
>>
>> 2012/1/25 Jentu Jain<je...@datacert.com>
>>
>>> Hello,****
>>>
>>> My requirement is to create a server-side IMAP component that would
>>> fetch information from another web application and expose it as IMAP
>>> folders. **
>>> **
>>>
>>> How can this be done?****
>>>
>>> ** **
>>>
>>> Regards****
>>>
>>> ------------------------------------
>>> Jentu Jain | Datacert, Inc.****
>>>
>>> ** **
>>>
>>> *Why are major companies rapidly migrating to Passport? Find Out
>>> Here<http://www.datacert.com/>
>>> *
>>>
>>> [image: Description: cid:image001.gif@01CBF2C7.283B26D0]<http://www.datacert.com/feed.xml>[image:
>>> Description:
>>> cid:image002.gif@01CBF2C7.283B26D0]<http://twitter.com/datacert>
>>> ****
>>>
>>> ** **
>>>
>>
>
> --
> eric | http://about.echarles.net | @echarles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
--
eric | http://about.echarles.net | @echarles
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
RE: Create IMAP wrapper
Posted by Jentu Jain <je...@datacert.com>.
Thanks Eric and Norman for your response.
I understand that the default store for mailbox is JPA but I was unable to download the JPA binary and source. Can you please guide me on changing this to a file system to test the created mailbox.
I'm using the following code to create mailbox but nothing is listed when I call mapper.list(). Please advice.
@Override
public void createMailbox(MailboxPath mailboxPath, final MailboxSession mailboxSession)
throws MailboxException {
final int length = mailboxPath.getName().length();
if (length == 0) {
System.out.println("Ignoring mailbox with empty name");
} else {
if (mailboxPath.getName().charAt(length - 1) == getDelimiter())
mailboxPath.setName(mailboxPath.getName().substring(0, length - 1));
for (final MailboxPath mailbox : mailboxPath.getHierarchyLevels(getDelimiter()))
if (!mailboxExists(mailbox, mailboxSession)) {
final org.apache.james.mailbox.store.mail.model.Mailbox<UUID> m = doCreateMailbox(mailbox, mailboxSession);
final org.apache.james.mailbox.store.mail.MailboxMapper<UUID> mapper = getMapperFactory().getMailboxMapper(mailboxSession);
mapper.execute(new TransactionalMapper.VoidTransaction() {
public void runVoid() throws MailboxException {
mapper.save(m);
}
});
// notify listeners
getEventDispatcher().mailboxAdded(mailboxSession, m);
}
//return null;
}
}
Regards
------------------------------------
Jentu Jain | Datacert, Inc.
Why are major companies rapidly migrating to Passport? Find Out Here
-----Original Message-----
From: Eric Charles [mailto:eric@apache.org]
Sent: Friday, January 27, 2012 12:36 AM
To: James Users List
Subject: Re: Create IMAP wrapper
http://james.apache.org/mailbox/mailbox-store.html
is the place we should enhance to further help guys like you.
But yes, for now, the best place to learn is to checkout the source code, and look at it in your favorite IDE.
Mailbox JPA has more implementations has more classes than mailbox maildir which relies more on the simple model provided in mailbox store.
Thx,
Eric
On 26/01/12 17:00, Norman Maurer wrote:
> Just implement your own MailboxManager. This can then be used in the
> IMAP code.
>
> Bye,
> Norman
>
>
> 2012/1/25 Jentu Jain<je...@datacert.com>
>
>> Hello,****
>>
>> My requirement is to create a server-side IMAP component that would
>> fetch information from another web application and expose it as IMAP
>> folders. **
>> **
>>
>> How can this be done?****
>>
>> ** **
>>
>> Regards****
>>
>> ------------------------------------
>> Jentu Jain | Datacert, Inc.****
>>
>> ** **
>>
>> *Why are major companies rapidly migrating to Passport? Find Out
>> Here<http://www.datacert.com/>
>> *
>>
>> [image: Description: cid:image001.gif@01CBF2C7.283B26D0]<http://www.datacert.com/feed.xml>[image:
>> Description:
>> cid:image002.gif@01CBF2C7.283B26D0]<http://twitter.com/datacert>
>> ****
>>
>> ** **
>>
>
--
eric | http://about.echarles.net | @echarles
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: Create IMAP wrapper
Posted by Eric Charles <er...@apache.org>.
http://james.apache.org/mailbox/mailbox-store.html
is the place we should enhance to further help guys like you.
But yes, for now, the best place to learn is to checkout the source
code, and look at it in your favorite IDE.
Mailbox JPA has more implementations has more classes than mailbox
maildir which relies more on the simple model provided in mailbox store.
Thx,
Eric
On 26/01/12 17:00, Norman Maurer wrote:
> Just implement your own MailboxManager. This can then be used in the IMAP
> code.
>
> Bye,
> Norman
>
>
> 2012/1/25 Jentu Jain<je...@datacert.com>
>
>> Hello,****
>>
>> My requirement is to create a server-side IMAP component that would fetch
>> information from another web application and expose it as IMAP folders. **
>> **
>>
>> How can this be done?****
>>
>> ** **
>>
>> Regards****
>>
>> ------------------------------------
>> Jentu Jain | Datacert, Inc.****
>>
>> ** **
>>
>> *Why are major companies rapidly migrating to Passport? Find Out Here<http://www.datacert.com/>
>> *
>>
>> [image: Description: cid:image001.gif@01CBF2C7.283B26D0]<http://www.datacert.com/feed.xml>[image:
>> Description: cid:image002.gif@01CBF2C7.283B26D0]<http://twitter.com/datacert>
>> ****
>>
>> ** **
>>
>
--
eric | http://about.echarles.net | @echarles
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: Create IMAP wrapper
Posted by Norman Maurer <no...@googlemail.com>.
Just implement your own MailboxManager. This can then be used in the IMAP
code.
Bye,
Norman
2012/1/25 Jentu Jain <je...@datacert.com>
> Hello,****
>
> My requirement is to create a server-side IMAP component that would fetch
> information from another web application and expose it as IMAP folders. **
> **
>
> How can this be done?****
>
> ** **
>
> Regards****
>
> ------------------------------------
> Jentu Jain | Datacert, Inc.****
>
> ** **
>
> *Why are major companies rapidly migrating to Passport? Find Out Here<http://www.datacert.com/>
> *
>
> [image: Description: cid:image001.gif@01CBF2C7.283B26D0]<http://www.datacert.com/feed.xml>[image:
> Description: cid:image002.gif@01CBF2C7.283B26D0]<http://twitter.com/datacert>
> ****
>
> ** **
>